From c9bd67017ab93fa97a418dfc816f22867dc88fc2 Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Fri, 12 Sep 2025 23:06:05 +0000 Subject: [PATCH 1/4] chore!: promote Compute to v2 --- Compute/.OwlBot.yaml | 4 +- Compute/owlbot.py | 47 +- Compute/src/V1/AWSV4Signature.php | 8 +- ...onInstancesInstanceGroupManagerRequest.php | 10 +- ...ancesRegionInstanceGroupManagerRequest.php | 10 +- Compute/src/V1/AcceleratorConfig.php | 4 +- Compute/src/V1/AcceleratorType.php | 18 +- .../src/V1/AcceleratorTypeAggregatedList.php | 10 +- Compute/src/V1/AcceleratorTypeList.php | 10 +- Compute/src/V1/AcceleratorTypesClient.php | 34 - Compute/src/V1/AcceleratorTypesScopedList.php | 2 +- Compute/src/V1/Accelerators.php | 4 +- Compute/src/V1/AccessConfig.php | 20 +- .../src/V1/AddAccessConfigInstanceRequest.php | 12 +- .../AddAssociationFirewallPolicyRequest.php | 8 +- ...ssociationNetworkFirewallPolicyRequest.php | 10 +- ...tionRegionNetworkFirewallPolicyRequest.php | 12 +- .../V1/AddHealthCheckTargetPoolRequest.php | 10 +- .../src/V1/AddInstanceTargetPoolRequest.php | 10 +- .../V1/AddInstancesInstanceGroupRequest.php | 10 +- Compute/src/V1/AddNodesNodeGroupRequest.php | 10 +- ...roringRuleNetworkFirewallPolicyRequest.php | 12 +- Compute/src/V1/AddPeeringNetworkRequest.php | 8 +- .../src/V1/AddResourcePoliciesDiskRequest.php | 10 +- .../V1/AddResourcePoliciesInstanceRequest.php | 10 +- .../AddResourcePoliciesRegionDiskRequest.php | 10 +- .../src/V1/AddRuleFirewallPolicyRequest.php | 6 +- .../AddRuleNetworkFirewallPolicyRequest.php | 12 +- ...RuleRegionNetworkFirewallPolicyRequest.php | 14 +- .../V1/AddRuleRegionSecurityPolicyRequest.php | 10 +- .../src/V1/AddRuleSecurityPolicyRequest.php | 8 +- .../AddSignedUrlKeyBackendBucketRequest.php | 8 +- .../AddSignedUrlKeyBackendServiceRequest.php | 8 +- Compute/src/V1/Address.php | 36 +- Compute/src/V1/AddressAggregatedList.php | 10 +- Compute/src/V1/AddressList.php | 10 +- Compute/src/V1/AddressesClient.php | 34 - Compute/src/V1/AddressesScopedList.php | 2 +- Compute/src/V1/AdvancedMachineFeatures.php | 12 +- .../AggregatedListAcceleratorTypesRequest.php | 16 +- .../src/V1/AggregatedListAddressesRequest.php | 16 +- .../V1/AggregatedListAutoscalersRequest.php | 16 +- .../AggregatedListBackendServicesRequest.php | 16 +- .../src/V1/AggregatedListDiskTypesRequest.php | 16 +- Compute/src/V1/AggregatedListDisksRequest.php | 16 +- .../AggregatedListForwardingRulesRequest.php | 16 +- .../AggregatedListGlobalOperationsRequest.php | 16 +- .../V1/AggregatedListHealthChecksRequest.php | 16 +- ...egatedListInstanceGroupManagersRequest.php | 16 +- .../AggregatedListInstanceGroupsRequest.php | 16 +- ...AggregatedListInstanceTemplatesRequest.php | 16 +- .../src/V1/AggregatedListInstancesRequest.php | 16 +- .../AggregatedListInstantSnapshotsRequest.php | 16 +- ...atedListInterconnectAttachmentsRequest.php | 16 +- .../V1/AggregatedListMachineTypesRequest.php | 16 +- ...ggregatedListNetworkAttachmentsRequest.php | 16 +- ...ListNetworkEdgeSecurityServicesRequest.php | 16 +- ...egatedListNetworkEndpointGroupsRequest.php | 16 +- ...atedListNetworkFirewallPoliciesRequest.php | 16 +- .../V1/AggregatedListNodeGroupsRequest.php | 16 +- .../V1/AggregatedListNodeTemplatesRequest.php | 16 +- .../src/V1/AggregatedListNodeTypesRequest.php | 16 +- .../AggregatedListPacketMirroringsRequest.php | 16 +- ...atedListPublicDelegatedPrefixesRequest.php | 16 +- ...AggregatedListRegionCommitmentsRequest.php | 16 +- .../V1/AggregatedListReservationsRequest.php | 16 +- .../AggregatedListResourcePoliciesRequest.php | 16 +- .../src/V1/AggregatedListRoutersRequest.php | 16 +- .../AggregatedListSecurityPoliciesRequest.php | 16 +- ...ggregatedListServiceAttachmentsRequest.php | 16 +- .../AggregatedListSslCertificatesRequest.php | 16 +- .../V1/AggregatedListSslPoliciesRequest.php | 16 +- .../AggregatedListStoragePoolTypesRequest.php | 16 +- .../V1/AggregatedListStoragePoolsRequest.php | 16 +- .../V1/AggregatedListSubnetworksRequest.php | 16 +- ...AggregatedListTargetHttpProxiesRequest.php | 16 +- ...ggregatedListTargetHttpsProxiesRequest.php | 16 +- .../AggregatedListTargetInstancesRequest.php | 16 +- .../V1/AggregatedListTargetPoolsRequest.php | 16 +- .../AggregatedListTargetTcpProxiesRequest.php | 16 +- ...AggregatedListTargetVpnGatewaysRequest.php | 16 +- .../src/V1/AggregatedListUrlMapsRequest.php | 16 +- .../V1/AggregatedListVpnGatewaysRequest.php | 16 +- .../V1/AggregatedListVpnTunnelsRequest.php | 16 +- Compute/src/V1/AliasIpRange.php | 4 +- .../src/V1/AllocationAggregateReservation.php | 4 +- ...gregateReservationReservedResourceInfo.php | 2 +- ...rvationReservedResourceInfoAccelerator.php | 4 +- .../V1/AllocationReservationSharingPolicy.php | 2 +- Compute/src/V1/AllocationResourceStatus.php | 8 +- .../V1/AllocationResourceStatusHealthInfo.php | 6 +- ...ionResourceStatusSpecificSKUAllocation.php | 2 +- ...llocatedInstancePropertiesReservedDisk.php | 4 +- ...KUAllocationReservedInstanceProperties.php | 6 +- .../MaintenanceInterval.php | 61 - .../V1/AllocationSpecificSKUReservation.php | 10 +- Compute/src/V1/Allowed.php | 2 +- ...AnnouncePublicAdvertisedPrefixeRequest.php | 6 +- .../AnnouncePublicDelegatedPrefixeRequest.php | 8 +- ...ToInstancesInstanceGroupManagerRequest.php | 8 +- ...ancesRegionInstanceGroupManagerRequest.php | 8 +- Compute/src/V1/AttachDiskInstanceRequest.php | 12 +- ...ointsGlobalNetworkEndpointGroupRequest.php | 8 +- ...rkEndpointsNetworkEndpointGroupRequest.php | 10 +- ...ointsRegionNetworkEndpointGroupRequest.php | 10 +- Compute/src/V1/AttachedDisk.php | 32 +- .../src/V1/AttachedDiskInitializeParams.php | 28 +- Compute/src/V1/AuditConfig.php | 2 +- Compute/src/V1/AuditLogConfig.php | 4 +- .../src/V1/AuthorizationLoggingOptions.php | 81 - .../PermissionType.php | 83 - Compute/src/V1/Autoscaler.php | 26 +- Compute/src/V1/AutoscalerAggregatedList.php | 10 +- Compute/src/V1/AutoscalerList.php | 10 +- Compute/src/V1/AutoscalerStatusDetails.php | 4 +- Compute/src/V1/AutoscalersClient.php | 34 - Compute/src/V1/AutoscalersScopedList.php | 2 +- Compute/src/V1/AutoscalingPolicy.php | 22 +- .../V1/AutoscalingPolicyCpuUtilization.php | 4 +- ...toscalingPolicyCustomMetricUtilization.php | 10 +- ...oscalingPolicyLoadBalancingUtilization.php | 2 +- .../V1/AutoscalingPolicyScaleInControl.php | 4 +- .../V1/AutoscalingPolicyScalingSchedule.php | 12 +- Compute/src/V1/Backend.php | 26 +- Compute/src/V1/BackendBucket.php | 26 +- Compute/src/V1/BackendBucketCdnPolicy.php | 18 +- ...ketCdnPolicyBypassCacheOnRequestHeader.php | 2 +- ...ndBucketCdnPolicyNegativeCachingPolicy.php | 4 +- Compute/src/V1/BackendBucketList.php | 10 +- Compute/src/V1/BackendBucketUsedBy.php | 2 +- Compute/src/V1/BackendBucketsClient.php | 34 - Compute/src/V1/BackendCustomMetric.php | 6 +- Compute/src/V1/BackendService.php | 82 +- .../src/V1/BackendServiceAggregatedList.php | 10 +- Compute/src/V1/BackendServiceCdnPolicy.php | 18 +- ...iceCdnPolicyBypassCacheOnRequestHeader.php | 2 +- ...dServiceCdnPolicyNegativeCachingPolicy.php | 4 +- ...BackendServiceConnectionTrackingPolicy.php | 8 +- Compute/src/V1/BackendServiceCustomMetric.php | 4 +- .../src/V1/BackendServiceFailoverPolicy.php | 6 +- Compute/src/V1/BackendServiceGroupHealth.php | 2 +- Compute/src/V1/BackendServiceHAPolicy.php | 4 +- .../src/V1/BackendServiceHAPolicyLeader.php | 4 +- ...ndServiceHAPolicyLeaderNetworkEndpoint.php | 2 +- Compute/src/V1/BackendServiceHttpCookie.php | 6 +- Compute/src/V1/BackendServiceIAP.php | 8 +- Compute/src/V1/BackendServiceList.php | 10 +- Compute/src/V1/BackendServiceListUsable.php | 10 +- ...rviceLocalityLoadBalancingPolicyConfig.php | 4 +- ...yLoadBalancingPolicyConfigCustomPolicy.php | 4 +- ...ocalityLoadBalancingPolicyConfigPolicy.php | 2 +- Compute/src/V1/BackendServiceLogConfig.php | 6 +- Compute/src/V1/BackendServiceReference.php | 2 +- Compute/src/V1/BackendServiceTlsSettings.php | 4 +- ...ackendServiceTlsSettingsSubjectAltName.php | 4 +- Compute/src/V1/BackendServiceUsedBy.php | 2 +- Compute/src/V1/BackendServicesClient.php | 34 - Compute/src/V1/BackendServicesScopedList.php | 2 +- Compute/src/V1/BfdPacket.php | 32 +- Compute/src/V1/BfdStatus.php | 18 +- Compute/src/V1/BfdStatusPacketCounts.php | 8 +- Compute/src/V1/BgpRoute.php | 6 +- Compute/src/V1/BgpRouteAsPath.php | 2 +- ...uteNetworkLayerReachabilityInformation.php | 4 +- Compute/src/V1/Binding.php | 6 +- Compute/src/V1/BulkInsertDiskRequest.php | 8 +- Compute/src/V1/BulkInsertDiskResource.php | 2 +- Compute/src/V1/BulkInsertInstanceRequest.php | 8 +- Compute/src/V1/BulkInsertInstanceResource.php | 12 +- ...tInstanceResourcePerInstanceProperties.php | 4 +- Compute/src/V1/BulkInsertOperationStatus.php | 10 +- .../src/V1/BulkInsertRegionDiskRequest.php | 8 +- .../V1/BulkInsertRegionInstanceRequest.php | 8 +- Compute/src/V1/BulkSetLabelsDiskRequest.php | 10 +- Compute/src/V1/BulkSetLabelsRequest.php | 2 +- Compute/src/V1/CacheInvalidationRule.php | 4 +- Compute/src/V1/CacheKeyPolicy.php | 6 +- ...stanceGroupManagerResizeRequestRequest.php | 10 +- Compute/src/V1/CircuitBreakers.php | 10 +- .../src/V1/Client/AcceleratorTypesClient.php | 12 +- Compute/src/V1/Client/AddressesClient.php | 36 +- Compute/src/V1/Client/AutoscalersClient.php | 42 +- .../src/V1/Client/BackendBucketsClient.php | 59 +- .../src/V1/Client/BackendServicesClient.php | 77 +- Compute/src/V1/Client/DiskTypesClient.php | 6 +- Compute/src/V1/Client/DisksClient.php | 72 +- .../V1/Client/ExternalVpnGatewaysClient.php | 41 +- .../src/V1/Client/FirewallPoliciesClient.php | 61 +- Compute/src/V1/Client/FirewallsClient.php | 35 +- .../src/V1/Client/ForwardingRulesClient.php | 42 +- .../src/V1/Client/GlobalAddressesClient.php | 35 +- .../V1/Client/GlobalForwardingRulesClient.php | 35 +- .../GlobalNetworkEndpointGroupsClient.php | 56 +- .../src/V1/Client/GlobalOperationsClient.php | 18 +- .../GlobalOrganizationOperationsClient.php | 15 +- .../GlobalPublicDelegatedPrefixesClient.php | 50 +- Compute/src/V1/Client/HealthChecksClient.php | 41 +- .../src/V1/Client/ImageFamilyViewsClient.php | 6 +- Compute/src/V1/Client/ImagesClient.php | 41 +- ...stanceGroupManagerResizeRequestsClient.php | 72 +- .../V1/Client/InstanceGroupManagersClient.php | 144 +- .../src/V1/Client/InstanceGroupsClient.php | 60 +- .../Client/InstanceSettingsServiceClient.php | 39 +- .../src/V1/Client/InstanceTemplatesClient.php | 47 +- Compute/src/V1/Client/InstancesClient.php | 180 +- .../src/V1/Client/InstantSnapshotsClient.php | 48 +- .../InterconnectAttachmentGroupsClient.php | 84 +- .../Client/InterconnectAttachmentsClient.php | 48 +- .../V1/Client/InterconnectGroupsClient.php | 57 +- .../V1/Client/InterconnectLocationsClient.php | 6 +- .../InterconnectRemoteLocationsClient.php | 15 +- Compute/src/V1/Client/InterconnectsClient.php | 47 +- Compute/src/V1/Client/LicenseCodesClient.php | 12 +- Compute/src/V1/Client/LicensesClient.php | 41 +- Compute/src/V1/Client/MachineImagesClient.php | 41 +- Compute/src/V1/Client/MachineTypesClient.php | 12 +- .../V1/Client/NetworkAttachmentsClient.php | 48 +- .../NetworkEdgeSecurityServicesClient.php | 51 +- .../V1/Client/NetworkEndpointGroupsClient.php | 66 +- .../Client/NetworkFirewallPoliciesClient.php | 110 +- .../src/V1/Client/NetworkProfilesClient.php | 6 +- Compute/src/V1/Client/NetworksClient.php | 59 +- Compute/src/V1/Client/NodeGroupsClient.php | 60 +- Compute/src/V1/Client/NodeTemplatesClient.php | 48 +- Compute/src/V1/Client/NodeTypesClient.php | 6 +- .../src/V1/Client/PacketMirroringsClient.php | 48 +- Compute/src/V1/Client/ProjectsClient.php | 73 +- .../Client/PublicAdvertisedPrefixesClient.php | 50 +- .../Client/PublicDelegatedPrefixesClient.php | 45 +- .../src/V1/Client/RegionAutoscalersClient.php | 36 +- .../V1/Client/RegionBackendServicesClient.php | 60 +- .../src/V1/Client/RegionCommitmentsClient.php | 42 +- .../src/V1/Client/RegionDiskTypesClient.php | 6 +- Compute/src/V1/Client/RegionDisksClient.php | 72 +- .../RegionHealthCheckServicesClient.php | 39 +- .../V1/Client/RegionHealthChecksClient.php | 36 +- .../RegionInstanceGroupManagersClient.php | 141 +- .../V1/Client/RegionInstanceGroupsClient.php | 48 +- .../Client/RegionInstanceTemplatesClient.php | 39 +- .../src/V1/Client/RegionInstancesClient.php | 36 +- .../Client/RegionInstantSnapshotsClient.php | 48 +- .../RegionNetworkEndpointGroupsClient.php | 57 +- .../RegionNetworkFirewallPoliciesClient.php | 123 +- .../RegionNotificationEndpointsClient.php | 39 +- .../src/V1/Client/RegionOperationsClient.php | 12 +- .../Client/RegionSecurityPoliciesClient.php | 42 +- .../V1/Client/RegionSslCertificatesClient.php | 36 +- .../src/V1/Client/RegionSslPoliciesClient.php | 42 +- .../Client/RegionTargetHttpProxiesClient.php | 45 +- .../Client/RegionTargetHttpsProxiesClient.php | 51 +- .../Client/RegionTargetTcpProxiesClient.php | 39 +- Compute/src/V1/Client/RegionUrlMapsClient.php | 36 +- Compute/src/V1/Client/RegionZonesClient.php | 6 +- Compute/src/V1/Client/RegionsClient.php | 6 +- .../src/V1/Client/ReservationBlocksClient.php | 40 +- .../V1/Client/ReservationSubBlocksClient.php | 46 +- Compute/src/V1/Client/ReservationsClient.php | 54 +- .../src/V1/Client/ResourcePoliciesClient.php | 48 +- Compute/src/V1/Client/RoutersClient.php | 72 +- Compute/src/V1/Client/RoutesClient.php | 35 +- .../src/V1/Client/SecurityPoliciesClient.php | 47 +- .../V1/Client/ServiceAttachmentsClient.php | 48 +- .../Client/SnapshotSettingsServiceClient.php | 38 +- Compute/src/V1/Client/SnapshotsClient.php | 41 +- .../src/V1/Client/SslCertificatesClient.php | 41 +- Compute/src/V1/Client/SslPoliciesClient.php | 47 +- .../src/V1/Client/StoragePoolTypesClient.php | 12 +- Compute/src/V1/Client/StoragePoolsClient.php | 48 +- Compute/src/V1/Client/SubnetworksClient.php | 60 +- .../src/V1/Client/TargetGrpcProxiesClient.php | 35 +- .../src/V1/Client/TargetHttpProxiesClient.php | 41 +- .../V1/Client/TargetHttpsProxiesClient.php | 65 +- .../src/V1/Client/TargetInstancesClient.php | 48 +- Compute/src/V1/Client/TargetPoolsClient.php | 54 +- .../src/V1/Client/TargetSslProxiesClient.php | 59 +- .../src/V1/Client/TargetTcpProxiesClient.php | 53 +- .../src/V1/Client/TargetVpnGatewaysClient.php | 42 +- Compute/src/V1/Client/UrlMapsClient.php | 37 +- Compute/src/V1/Client/VpnGatewaysClient.php | 54 +- Compute/src/V1/Client/VpnTunnelsClient.php | 36 +- .../src/V1/Client/ZoneOperationsClient.php | 6 +- Compute/src/V1/Client/ZonesClient.php | 6 +- .../V1/CloneRulesFirewallPolicyRequest.php | 6 +- ...CloneRulesNetworkFirewallPolicyRequest.php | 8 +- ...ulesRegionNetworkFirewallPolicyRequest.php | 10 +- Compute/src/V1/Commitment.php | 38 +- Compute/src/V1/CommitmentAggregatedList.php | 10 +- Compute/src/V1/CommitmentList.php | 10 +- Compute/src/V1/CommitmentResourceStatus.php | 2 +- Compute/src/V1/CommitmentsScopedList.php | 2 +- Compute/src/V1/Condition.php | 255 - Compute/src/V1/Condition/Iam.php | 99 - Compute/src/V1/Condition/Op.php | 90 - Compute/src/V1/Condition/Sys.php | 78 - Compute/src/V1/ConfidentialInstanceConfig.php | 4 +- Compute/src/V1/ConnectionDraining.php | 2 +- .../V1/ConsistentHashLoadBalancerSettings.php | 6 +- ...tentHashLoadBalancerSettingsHttpCookie.php | 6 +- Compute/src/V1/CorsPolicy.php | 6 +- ...teInstancesInstanceGroupManagerRequest.php | 10 +- ...ancesRegionInstanceGroupManagerRequest.php | 10 +- .../CreateMembersInterconnectGroupRequest.php | 6 +- Compute/src/V1/CreateSnapshotDiskRequest.php | 12 +- .../V1/CreateSnapshotRegionDiskRequest.php | 10 +- Compute/src/V1/CustomErrorResponsePolicy.php | 2 +- ...rResponsePolicyCustomErrorResponseRule.php | 4 +- Compute/src/V1/CustomerEncryptionKey.php | 10 +- .../V1/CustomerEncryptionKeyProtectedDisk.php | 4 +- Compute/src/V1/Data.php | 4 +- .../V1/DeleteAccessConfigInstanceRequest.php | 12 +- Compute/src/V1/DeleteAddressRequest.php | 8 +- Compute/src/V1/DeleteAutoscalerRequest.php | 8 +- Compute/src/V1/DeleteBackendBucketRequest.php | 6 +- .../src/V1/DeleteBackendServiceRequest.php | 6 +- Compute/src/V1/DeleteDiskRequest.php | 8 +- .../V1/DeleteExternalVpnGatewayRequest.php | 6 +- .../src/V1/DeleteFirewallPolicyRequest.php | 4 +- Compute/src/V1/DeleteFirewallRequest.php | 6 +- .../src/V1/DeleteForwardingRuleRequest.php | 8 +- Compute/src/V1/DeleteGlobalAddressRequest.php | 6 +- .../V1/DeleteGlobalForwardingRuleRequest.php | 6 +- ...eleteGlobalNetworkEndpointGroupRequest.php | 6 +- .../src/V1/DeleteGlobalOperationRequest.php | 4 +- ...leteGlobalOrganizationOperationRequest.php | 4 +- ...eteGlobalPublicDelegatedPrefixeRequest.php | 6 +- Compute/src/V1/DeleteHealthCheckRequest.php | 6 +- Compute/src/V1/DeleteImageRequest.php | 6 +- .../V1/DeleteInstanceGroupManagerRequest.php | 8 +- ...stanceGroupManagerResizeRequestRequest.php | 10 +- Compute/src/V1/DeleteInstanceGroupRequest.php | 8 +- Compute/src/V1/DeleteInstanceRequest.php | 8 +- .../src/V1/DeleteInstanceTemplateRequest.php | 6 +- ...teInstancesInstanceGroupManagerRequest.php | 10 +- ...ancesRegionInstanceGroupManagerRequest.php | 10 +- .../src/V1/DeleteInstantSnapshotRequest.php | 8 +- ...leteInterconnectAttachmentGroupRequest.php | 6 +- .../DeleteInterconnectAttachmentRequest.php | 8 +- .../src/V1/DeleteInterconnectGroupRequest.php | 6 +- Compute/src/V1/DeleteInterconnectRequest.php | 6 +- Compute/src/V1/DeleteLicenseRequest.php | 6 +- Compute/src/V1/DeleteMachineImageRequest.php | 6 +- .../src/V1/DeleteNetworkAttachmentRequest.php | 8 +- ...eleteNetworkEdgeSecurityServiceRequest.php | 8 +- .../V1/DeleteNetworkEndpointGroupRequest.php | 8 +- .../V1/DeleteNetworkFirewallPolicyRequest.php | 6 +- Compute/src/V1/DeleteNetworkRequest.php | 6 +- Compute/src/V1/DeleteNodeGroupRequest.php | 8 +- Compute/src/V1/DeleteNodeTemplateRequest.php | 8 +- .../src/V1/DeleteNodesNodeGroupRequest.php | 10 +- .../src/V1/DeletePacketMirroringRequest.php | 8 +- ...anceConfigsInstanceGroupManagerRequest.php | 8 +- ...nfigsRegionInstanceGroupManagerRequest.php | 8 +- .../DeletePublicAdvertisedPrefixeRequest.php | 6 +- .../DeletePublicDelegatedPrefixeRequest.php | 8 +- .../src/V1/DeleteRegionAutoscalerRequest.php | 8 +- .../V1/DeleteRegionBackendServiceRequest.php | 8 +- Compute/src/V1/DeleteRegionDiskRequest.php | 8 +- .../src/V1/DeleteRegionHealthCheckRequest.php | 8 +- .../DeleteRegionHealthCheckServiceRequest.php | 8 +- ...eleteRegionInstanceGroupManagerRequest.php | 8 +- .../DeleteRegionInstanceTemplateRequest.php | 8 +- .../V1/DeleteRegionInstantSnapshotRequest.php | 8 +- ...eleteRegionNetworkEndpointGroupRequest.php | 8 +- ...leteRegionNetworkFirewallPolicyRequest.php | 8 +- ...eleteRegionNotificationEndpointRequest.php | 8 +- .../src/V1/DeleteRegionOperationRequest.php | 6 +- .../V1/DeleteRegionSecurityPolicyRequest.php | 8 +- .../V1/DeleteRegionSslCertificateRequest.php | 8 +- .../src/V1/DeleteRegionSslPolicyRequest.php | 8 +- .../V1/DeleteRegionTargetHttpProxyRequest.php | 8 +- .../DeleteRegionTargetHttpsProxyRequest.php | 8 +- .../V1/DeleteRegionTargetTcpProxyRequest.php | 8 +- Compute/src/V1/DeleteRegionUrlMapRequest.php | 8 +- Compute/src/V1/DeleteReservationRequest.php | 8 +- .../src/V1/DeleteResourcePolicyRequest.php | 8 +- .../src/V1/DeleteRoutePolicyRouterRequest.php | 10 +- Compute/src/V1/DeleteRouteRequest.php | 6 +- Compute/src/V1/DeleteRouterRequest.php | 8 +- .../src/V1/DeleteSecurityPolicyRequest.php | 6 +- .../src/V1/DeleteServiceAttachmentRequest.php | 8 +- ...DeleteSignedUrlKeyBackendBucketRequest.php | 8 +- ...eleteSignedUrlKeyBackendServiceRequest.php | 8 +- Compute/src/V1/DeleteSnapshotRequest.php | 6 +- .../src/V1/DeleteSslCertificateRequest.php | 6 +- Compute/src/V1/DeleteSslPolicyRequest.php | 6 +- Compute/src/V1/DeleteStoragePoolRequest.php | 8 +- Compute/src/V1/DeleteSubnetworkRequest.php | 8 +- .../src/V1/DeleteTargetGrpcProxyRequest.php | 6 +- .../src/V1/DeleteTargetHttpProxyRequest.php | 6 +- .../src/V1/DeleteTargetHttpsProxyRequest.php | 6 +- .../src/V1/DeleteTargetInstanceRequest.php | 8 +- Compute/src/V1/DeleteTargetPoolRequest.php | 8 +- .../src/V1/DeleteTargetSslProxyRequest.php | 6 +- .../src/V1/DeleteTargetTcpProxyRequest.php | 6 +- .../src/V1/DeleteTargetVpnGatewayRequest.php | 8 +- Compute/src/V1/DeleteUrlMapRequest.php | 6 +- Compute/src/V1/DeleteVpnGatewayRequest.php | 8 +- Compute/src/V1/DeleteVpnTunnelRequest.php | 8 +- Compute/src/V1/DeleteZoneOperationRequest.php | 6 +- Compute/src/V1/Denied.php | 2 +- Compute/src/V1/DeprecateImageRequest.php | 8 +- Compute/src/V1/DeprecationStatus.php | 10 +- Compute/src/V1/DetachDiskInstanceRequest.php | 10 +- ...ointsGlobalNetworkEndpointGroupRequest.php | 8 +- ...rkEndpointsNetworkEndpointGroupRequest.php | 10 +- ...ointsRegionNetworkEndpointGroupRequest.php | 10 +- .../src/V1/DisableXpnHostProjectRequest.php | 4 +- .../V1/DisableXpnResourceProjectRequest.php | 6 +- Compute/src/V1/Disk.php | 86 +- Compute/src/V1/DiskAggregatedList.php | 10 +- Compute/src/V1/DiskAsyncReplication.php | 8 +- Compute/src/V1/DiskAsyncReplicationList.php | 2 +- Compute/src/V1/DiskInstantiationConfig.php | 8 +- Compute/src/V1/DiskList.php | 10 +- Compute/src/V1/DiskMoveRequest.php | 4 +- Compute/src/V1/DiskResourceStatus.php | 2 +- ...skResourceStatusAsyncReplicationStatus.php | 2 +- Compute/src/V1/DiskType.php | 24 +- Compute/src/V1/DiskTypeAggregatedList.php | 10 +- Compute/src/V1/DiskTypeList.php | 10 +- Compute/src/V1/DiskTypesClient.php | 34 - Compute/src/V1/DiskTypesScopedList.php | 2 +- Compute/src/V1/DisksClient.php | 34 - Compute/src/V1/DisksResizeRequest.php | 2 +- Compute/src/V1/DisksScopedList.php | 2 +- .../V1/DisksStartAsyncReplicationRequest.php | 2 +- ...DisksStopGroupAsyncReplicationResource.php | 2 +- Compute/src/V1/DisplayDevice.php | 2 +- Compute/src/V1/DistributionPolicy.php | 2 +- .../DistributionPolicyZoneConfiguration.php | 2 +- Compute/src/V1/Duration.php | 4 +- .../src/V1/EnableXpnHostProjectRequest.php | 4 +- .../V1/EnableXpnResourceProjectRequest.php | 6 +- .../src/V1/Enums/AccessConfig/NetworkTier.php | 42 - Compute/src/V1/Enums/AccessConfig/Type.php | 38 - Compute/src/V1/Enums/Address/AddressType.php | 40 - Compute/src/V1/Enums/Address/IpVersion.php | 40 - .../src/V1/Enums/Address/Ipv6EndpointType.php | 38 - Compute/src/V1/Enums/Address/NetworkTier.php | 42 - Compute/src/V1/Enums/Address/Purpose.php | 50 - Compute/src/V1/Enums/Address/Status.php | 40 - .../PerformanceMonitoringUnit.php | 44 - .../VmFamily.php | 48 - .../WorkloadType.php | 41 - .../ServiceShareType.php | 42 - .../HealthStatus.php | 41 - .../PBInterface.php | 40 - .../V1/Enums/AttachedDisk/Architecture.php | 40 - Compute/src/V1/Enums/AttachedDisk/Mode.php | 38 - .../src/V1/Enums/AttachedDisk/PBInterface.php | 38 - .../src/V1/Enums/AttachedDisk/SavedState.php | 38 - Compute/src/V1/Enums/AttachedDisk/Type.php | 38 - .../Architecture.php | 41 - .../OnUpdateAction.php | 41 - .../src/V1/Enums/AuditLogConfig/LogType.php | 42 - .../PermissionType.php | 45 - Compute/src/V1/Enums/Autoscaler/Status.php | 42 - .../V1/Enums/AutoscalerStatusDetails/Type.php | 74 - .../src/V1/Enums/AutoscalingPolicy/Mode.php | 42 - .../PredictiveMethod.php | 40 - .../UtilizationTargetType.php | 42 - .../src/V1/Enums/Backend/BalancingMode.php | 42 - Compute/src/V1/Enums/Backend/Preference.php | 40 - .../Enums/BackendBucket/CompressionMode.php | 38 - .../BackendBucket/LoadBalancingScheme.php | 37 - .../BackendBucketCdnPolicy/CacheMode.php | 42 - .../Enums/BackendService/CompressionMode.php | 38 - .../ExternalManagedMigrationState.php | 41 - .../IpAddressSelectionPolicy.php | 43 - .../BackendService/LoadBalancingScheme.php | 47 - .../Enums/BackendService/LocalityLbPolicy.php | 54 - .../src/V1/Enums/BackendService/Protocol.php | 52 - .../Enums/BackendService/SessionAffinity.php | 52 - .../BackendServiceCdnPolicy/CacheMode.php | 42 - ...nnectionPersistenceOnUnhealthyBackends.php | 42 - .../TrackingMode.php | 41 - .../BackendServiceHAPolicy/FastIPMove.php | 38 - .../Name.php | 55 - .../BackendServiceLogConfig/OptionalMode.php | 40 - Compute/src/V1/Enums/BfdPacket/Diagnostic.php | 54 - Compute/src/V1/Enums/BfdPacket/State.php | 44 - .../BfdSessionInitializationMode.php | 41 - .../V1/Enums/BfdStatus/LocalDiagnostic.php | 54 - Compute/src/V1/Enums/BfdStatus/LocalState.php | 44 - Compute/src/V1/Enums/BgpRoute/Origin.php | 40 - Compute/src/V1/Enums/BgpRouteAsPath/Type.php | 38 - .../BulkInsertOperationStatus/Status.php | 42 - Compute/src/V1/Enums/Commitment/Category.php | 40 - Compute/src/V1/Enums/Commitment/Plan.php | 40 - Compute/src/V1/Enums/Commitment/Status.php | 44 - Compute/src/V1/Enums/Commitment/Type.php | 94 - Compute/src/V1/Enums/Condition/Iam.php | 48 - Compute/src/V1/Enums/Condition/Op.php | 46 - Compute/src/V1/Enums/Condition/Sys.php | 42 - .../ConfidentialInstanceType.php | 44 - .../src/V1/Enums/DeprecationStatus/State.php | 42 - Compute/src/V1/Enums/Disk/AccessMode.php | 40 - Compute/src/V1/Enums/Disk/Architecture.php | 40 - Compute/src/V1/Enums/Disk/Status.php | 46 - .../InstantiateFrom.php | 49 - .../State.php | 47 - .../Enums/DistributionPolicy/TargetShape.php | 42 - .../V1/Enums/ExchangedPeeringRoute/Type.php | 40 - .../ExternalVpnGateway/RedundancyType.php | 40 - .../V1/Enums/FileContentBuffer/FileType.php | 40 - Compute/src/V1/Enums/Firewall/Direction.php | 38 - .../V1/Enums/FirewallLogConfig/Metadata.php | 38 - .../V1/Enums/FirewallPolicyRule/Direction.php | 38 - .../DestNetworkType.php | 35 - .../SrcNetworkType.php | 35 - .../FirewallPolicyRuleSecureTag/State.php | 38 - ...rnalManagedBackendBucketMigrationState.php | 42 - .../Enums/ForwardingRule/IPProtocolEnum.php | 48 - .../src/V1/Enums/ForwardingRule/IpVersion.php | 40 - .../ForwardingRule/LoadBalancingScheme.php | 47 - .../V1/Enums/ForwardingRule/NetworkTier.php | 42 - .../ForwardingRule/PscConnectionStatus.php | 47 - .../GRPCHealthCheck/PortSpecification.php | 41 - .../Enums/GetReservationBlockRequest/View.php | 40 - .../GroupMaintenanceInfo/SchedulingType.php | 40 - Compute/src/V1/Enums/GuestOsFeature/Type.php | 64 - .../HTTP2HealthCheck/PortSpecification.php | 41 - .../V1/Enums/HTTP2HealthCheck/ProxyHeader.php | 38 - .../HTTPHealthCheck/PortSpecification.php | 41 - .../V1/Enums/HTTPHealthCheck/ProxyHeader.php | 38 - .../HTTPSHealthCheck/PortSpecification.php | 41 - .../V1/Enums/HTTPSHealthCheck/ProxyHeader.php | 38 - Compute/src/V1/Enums/HealthCheck/Type.php | 48 - .../HealthStatusAggregationPolicy.php | 40 - .../src/V1/Enums/HealthStatus/HealthState.php | 38 - .../V1/Enums/HealthStatus/Ipv6HealthState.php | 34 - .../src/V1/Enums/HealthStatus/WeightError.php | 42 - .../HealthState.php | 43 - .../Ipv6HealthState.php | 35 - .../RedirectResponseCode.php | 45 - Compute/src/V1/Enums/Image/Architecture.php | 40 - Compute/src/V1/Enums/Image/SourceType.php | 36 - Compute/src/V1/Enums/Image/Status.php | 42 - .../Instance/KeyRevocationActionType.php | 41 - .../Instance/PrivateIpv6GoogleAccess.php | 41 - Compute/src/V1/Enums/Instance/Status.php | 54 - .../ListManagedInstancesResults.php | 40 - .../DefaultActionOnFailure.php | 40 - .../ForceUpdateOnRepair.php | 40 - .../State.php | 46 - .../Mode.php | 38 - .../InstanceRedistributionType.php | 36 - .../MinimalAction.php | 35 - .../MostDisruptiveAllowedAction.php | 36 - .../ReplacementMethod.php | 40 - .../InstanceGroupManagerUpdatePolicy/Type.php | 36 - .../MinimalAction.php | 36 - .../MostDisruptiveAllowedAction.php | 36 - .../InstanceState.php | 39 - .../Action.php | 61 - .../KeyRevocationActionType.php | 41 - .../PrivateIpv6GoogleAccess.php | 41 - .../Enums/InstanceWithNamedPorts/Status.php | 54 - .../Type.php | 47 - .../DisruptionSchedule.php | 42 - .../Behavior.php | 43 - .../V1/Enums/InstantSnapshot/Architecture.php | 40 - .../src/V1/Enums/InstantSnapshot/Status.php | 44 - .../Enums/Interconnect/AvailableFeatures.php | 34 - .../Enums/Interconnect/InterconnectType.php | 40 - .../src/V1/Enums/Interconnect/LinkType.php | 40 - .../Enums/Interconnect/OperationalStatus.php | 38 - .../Enums/Interconnect/RequestedFeatures.php | 34 - Compute/src/V1/Enums/Interconnect/State.php | 38 - .../TrafficClass.php | 48 - .../InterconnectAttachment/Bandwidth.php | 60 - .../EdgeAvailabilityDomain.php | 42 - .../InterconnectAttachment/Encryption.php | 38 - .../OperationalStatus.php | 39 - .../InterconnectAttachment/StackType.php | 38 - .../V1/Enums/InterconnectAttachment/State.php | 48 - .../V1/Enums/InterconnectAttachment/Type.php | 40 - .../BgpMd5.php | 41 - .../EffectiveSla.php | 44 - .../BlockerType.php | 50 - .../AvailabilitySla.php | 43 - .../GroupStatus.php | 44 - .../IsActive.php | 41 - .../Status.php | 65 - .../BundleAggregationType.php | 40 - .../BundleOperationalStatus.php | 40 - .../State.php | 38 - .../State.php | 45 - .../OperationalStatus.php | 40 - .../SupportedSla.php | 44 - .../BlockerType.php | 48 - .../TopologyCapability.php | 43 - .../IntentMismatchBehavior.php | 42 - .../InterconnectType.php | 42 - .../LinkType.php | 41 - .../RequestedFeatures.php | 38 - .../GroupStatus.php | 43 - .../IsActive.php | 41 - .../AvailableFeatures.php | 37 - .../AvailableLinkTypes.php | 41 - .../Enums/InterconnectLocation/Continent.php | 54 - .../V1/Enums/InterconnectLocation/Status.php | 38 - .../LocationPresence.php | 44 - .../IssueType.php | 42 - .../InterconnectOutageNotification/Source.php | 38 - .../InterconnectOutageNotification/State.php | 44 - .../InterconnectRemoteLocation/Continent.php | 44 - .../Enums/InterconnectRemoteLocation/Lacp.php | 38 - .../InterconnectRemoteLocation/Status.php | 38 - .../PortPairRemoteLocation.php | 40 - .../PortPairVlan.php | 39 - Compute/src/V1/Enums/LicenseCode/State.php | 44 - .../AddressFamily.php | 41 - .../ListBgpRoutesRoutersRequest/RouteType.php | 40 - .../Direction.php | 39 - .../V1/Enums/LocationPolicy/TargetShape.php | 40 - .../LocationPolicyLocation/Preference.php | 40 - .../LogConfigCloudAuditOptions/LogName.php | 40 - .../LogConfigDataAccessOptions/LogMode.php | 38 - Compute/src/V1/Enums/MachineImage/Status.php | 44 - .../src/V1/Enums/MachineType/Architecture.php | 40 - .../Enums/ManagedInstance/CurrentAction.php | 56 - .../Enums/ManagedInstance/InstanceStatus.php | 54 - .../DetailedHealthState.php | 46 - .../MetadataFilter/FilterMatchCriteria.php | 41 - .../Enums/NatIpInfoNatIpInfoMapping/Mode.php | 38 - .../Enums/NatIpInfoNatIpInfoMapping/Usage.php | 38 - .../NetworkFirewallPolicyEnforcementOrder.php | 40 - .../ConnectionPreference.php | 41 - .../Status.php | 46 - .../NetworkEndpointType.php | 51 - .../PscConnectionStatus.php | 48 - .../HealthStatus.php | 40 - .../Enums/NetworkInterface/Ipv6AccessType.php | 40 - .../src/V1/Enums/NetworkInterface/NicType.php | 46 - .../V1/Enums/NetworkInterface/StackType.php | 42 - .../src/V1/Enums/NetworkPeering/StackType.php | 38 - Compute/src/V1/Enums/NetworkPeering/State.php | 38 - .../Enums/NetworkPeering/UpdateStrategy.php | 40 - .../UpdateStrategy.php | 41 - .../DeleteStatus.php | 44 - .../UpdateStatus.php | 44 - .../StackType.php | 40 - .../TotalEgressBandwidthTier.php | 40 - .../V1/Enums/NetworkProfileLocation/Scope.php | 38 - .../AddressPurposes.php | 51 - .../AllowAliasIpRanges.php | 40 - .../AllowAutoModeSubnet.php | 40 - .../AllowClassDFirewalls.php | 40 - .../AllowCloudNat.php | 39 - .../AllowCloudRouter.php | 40 - .../AllowDefaultNicAttachment.php | 40 - .../AllowExternalIpAccess.php | 40 - .../AllowInterconnect.php | 40 - .../AllowIpForwarding.php | 40 - .../AllowLoadBalancing.php | 40 - .../AllowMultiNicInSameNetwork.php | 40 - .../AllowNcc.php | 38 - .../AllowNetworkMigration.php | 40 - .../AllowPacketMirroring.php | 40 - .../AllowPrivateGoogleAccess.php | 40 - .../AllowPsc.php | 38 - .../AllowSameNetworkUnicast.php | 40 - .../AllowStaticRoutes.php | 40 - .../AllowSubInterfaces.php | 40 - .../AllowVpcPeering.php | 39 - .../AllowVpn.php | 38 - .../InterfaceTypes.php | 47 - .../SubnetPurposes.php | 39 - .../SubnetStackTypes.php | 42 - .../SubnetworkPurposes.php | 50 - .../SubnetworkStackTypes.php | 42 - .../NetworkProfileNetworkFeatures/Unicast.php | 38 - .../BgpBestPathSelectionMode.php | 40 - .../BgpInterRegionCost.php | 39 - .../EffectiveBgpInterRegionCost.php | 36 - .../NetworkRoutingConfig/RoutingMode.php | 38 - .../Type.php | 43 - .../Enums/NodeGroup/MaintenanceInterval.php | 38 - .../V1/Enums/NodeGroup/MaintenancePolicy.php | 42 - Compute/src/V1/Enums/NodeGroup/Status.php | 42 - .../Enums/NodeGroupAutoscalingPolicy/Mode.php | 42 - .../Enums/NodeGroupNode/CpuOvercommitType.php | 40 - Compute/src/V1/Enums/NodeGroupNode/Status.php | 44 - .../Enums/NodeTemplate/CpuOvercommitType.php | 40 - Compute/src/V1/Enums/NodeTemplate/Status.php | 42 - Compute/src/V1/Enums/Operation/Status.php | 40 - .../src/V1/Enums/PacketIntervals/Duration.php | 42 - Compute/src/V1/Enums/PacketIntervals/Type.php | 42 - .../src/V1/Enums/PacketMirroring/Enable.php | 38 - .../Enums/PacketMirroringFilter/Direction.php | 40 - .../src/V1/Enums/PerInstanceConfig/Status.php | 46 - .../AutoDelete.php | 38 - .../PreservedStatePreservedDisk/Mode.php | 38 - .../AutoDelete.php | 39 - .../src/V1/Enums/Project/CloudArmorTier.php | 40 - .../V1/Enums/Project/DefaultNetworkTier.php | 42 - Compute/src/V1/Enums/Project/VmDnsSetting.php | 42 - .../src/V1/Enums/Project/XpnProjectStatus.php | 38 - .../CloudArmorTier.php | 41 - .../NetworkTier.php | 43 - .../ByoipApiVersion.php | 39 - .../Enums/PublicAdvertisedPrefix/PdpScope.php | 40 - .../Enums/PublicAdvertisedPrefix/Status.php | 52 - .../PublicDelegatedPrefix/ByoipApiVersion.php | 38 - .../V1/Enums/PublicDelegatedPrefix/Mode.php | 40 - .../V1/Enums/PublicDelegatedPrefix/Status.php | 46 - .../Mode.php | 41 - .../Status.php | 39 - Compute/src/V1/Enums/Quota/Metric.php | 362 -- .../Enums/QuotaExceededInfo/RolloutStatus.php | 38 - .../src/V1/Enums/QuotaStatusWarning/Code.php | 92 - .../src/V1/Enums/RawDisk/ContainerType.php | 36 - Compute/src/V1/Enums/Region/Status.php | 38 - .../MinimalAction.php | 36 - .../MostDisruptiveAllowedAction.php | 36 - .../InstanceState.php | 40 - .../Type.php | 47 - .../V1/Enums/Reservation/DeploymentType.php | 38 - .../V1/Enums/Reservation/SchedulingType.php | 40 - Compute/src/V1/Enums/Reservation/Status.php | 44 - .../ReservationOperationalMode.php | 42 - .../ConsumeReservationType.php | 43 - .../src/V1/Enums/ReservationBlock/Status.php | 42 - .../HealthStatus.php | 40 - .../V1/Enums/ReservationSubBlock/Status.php | 42 - .../HealthStatus.php | 41 - .../MaintenanceScope.php | 44 - .../MaintenanceScope.php | 44 - .../src/V1/Enums/ResourceCommitment/Type.php | 44 - .../src/V1/Enums/ResourcePolicy/Status.php | 44 - .../Collocation.php | 39 - .../OnSourceDiskDelete.php | 42 - .../Day.php | 50 - .../MaxTopologyDistance.php | 42 - .../ResourcePolicyWorkloadPolicy/Type.php | 38 - Compute/src/V1/Enums/Route/NextHopOrigin.php | 40 - Compute/src/V1/Enums/Route/RouteStatus.php | 42 - Compute/src/V1/Enums/Route/RouteType.php | 42 - .../V1/Enums/RouteAsPath/PathSegmentType.php | 42 - Compute/src/V1/Enums/RoutePolicy/Type.php | 38 - .../src/V1/Enums/RouterBgp/AdvertiseMode.php | 38 - .../V1/Enums/RouterBgp/AdvertisedGroups.php | 36 - .../V1/Enums/RouterBgpPeer/AdvertiseMode.php | 38 - .../Enums/RouterBgpPeer/AdvertisedGroups.php | 36 - Compute/src/V1/Enums/RouterBgpPeer/Enable.php | 38 - .../V1/Enums/RouterBgpPeer/ManagementType.php | 38 - .../SessionInitializationMode.php | 41 - .../V1/Enums/RouterInterface/IpVersion.php | 38 - .../Enums/RouterInterface/ManagementType.php | 38 - .../V1/Enums/RouterNat/AutoNetworkTier.php | 42 - .../src/V1/Enums/RouterNat/EndpointTypes.php | 40 - .../Enums/RouterNat/NatIpAllocateOption.php | 38 - .../SourceSubnetworkIpRangesToNat.php | 41 - .../SourceSubnetworkIpRangesToNat64.php | 39 - Compute/src/V1/Enums/RouterNat/Type.php | 38 - .../V1/Enums/RouterNatLogConfig/Filter.php | 40 - .../SourceIpRangesToNat.php | 41 - .../RouterStatusBgpPeerStatus/Status.php | 40 - .../StatusReason.php | 42 - Compute/src/V1/Enums/Rule/Action.php | 46 - .../SSLHealthCheck/PortSpecification.php | 41 - .../V1/Enums/SSLHealthCheck/ProxyHeader.php | 38 - .../src/V1/Enums/SavedAttachedDisk/Mode.php | 38 - .../Enums/SavedAttachedDisk/PBInterface.php | 38 - .../SavedAttachedDisk/StorageBytesStatus.php | 39 - .../src/V1/Enums/SavedAttachedDisk/Type.php | 38 - .../src/V1/Enums/SavedDisk/Architecture.php | 40 - .../V1/Enums/SavedDisk/StorageBytesStatus.php | 38 - .../V1/Enums/ScalingScheduleStatus/State.php | 42 - .../Scheduling/InstanceTerminationAction.php | 41 - .../V1/Enums/Scheduling/OnHostMaintenance.php | 38 - .../V1/Enums/Scheduling/ProvisioningModel.php | 40 - .../Enums/SchedulingNodeAffinity/Operator.php | 40 - Compute/src/V1/Enums/SecurityPolicy/Type.php | 40 - .../RuleVisibility.php | 40 - .../Type.php | 41 - .../JsonParsing.php | 41 - .../LogLevel.php | 38 - .../DdosProtection.php | 41 - .../VersionedExpr.php | 37 - .../Op.php | 45 - .../EnforceOnKey.php | 57 - .../EnforceOnKeyType.php | 58 - .../Type.php | 38 - .../SecurityPolicyUserDefinedField/Base.php | 42 - Compute/src/V1/Enums/ServerBinding/Type.php | 40 - .../ConnectionPreference.php | 41 - .../Status.php | 46 - .../State.php | 47 - .../src/V1/Enums/ShareSettings/ShareType.php | 42 - .../src/V1/Enums/Snapshot/Architecture.php | 40 - .../src/V1/Enums/Snapshot/SnapshotType.php | 38 - Compute/src/V1/Enums/Snapshot/Status.php | 44 - .../V1/Enums/Snapshot/StorageBytesStatus.php | 38 - .../Policy.php | 43 - .../KeyRevocationActionType.php | 42 - Compute/src/V1/Enums/SslCertificate/Type.php | 40 - .../Status.php | 46 - .../src/V1/Enums/SslPolicy/MinTlsVersion.php | 40 - Compute/src/V1/Enums/SslPolicy/Profile.php | 42 - .../AutoDelete.php | 39 - .../AutoDelete.php | 39 - .../StoragePool/CapacityProvisioningType.php | 35 - .../PerformanceProvisioningType.php | 35 - Compute/src/V1/Enums/StoragePool/State.php | 42 - .../src/V1/Enums/StoragePoolDisk/Status.php | 46 - .../V1/Enums/Subnetwork/Ipv6AccessType.php | 40 - .../V1/Enums/Subnetwork/Ipv6GceEndpoint.php | 38 - .../Subnetwork/PrivateIpv6GoogleAccess.php | 41 - Compute/src/V1/Enums/Subnetwork/Purpose.php | 50 - Compute/src/V1/Enums/Subnetwork/Role.php | 38 - Compute/src/V1/Enums/Subnetwork/StackType.php | 42 - Compute/src/V1/Enums/Subnetwork/State.php | 38 - .../AggregationInterval.php | 47 - .../V1/Enums/SubnetworkLogConfig/Metadata.php | 40 - Compute/src/V1/Enums/Subsetting/Policy.php | 38 - .../TCPHealthCheck/PortSpecification.php | 41 - .../V1/Enums/TCPHealthCheck/ProxyHeader.php | 38 - .../QuicOverride.php | 42 - .../Enums/TargetHttpsProxy/QuicOverride.php | 40 - .../Enums/TargetHttpsProxy/TlsEarlyData.php | 42 - .../src/V1/Enums/TargetInstance/NatPolicy.php | 36 - .../V1/Enums/TargetPool/SessionAffinity.php | 52 - .../ProxyHeader.php | 39 - .../V1/Enums/TargetSslProxy/ProxyHeader.php | 38 - .../ProxyHeader.php | 39 - .../V1/Enums/TargetTcpProxy/ProxyHeader.php | 38 - .../src/V1/Enums/TargetVpnGateway/Status.php | 42 - .../MaintenanceReasons.php | 63 - .../UpcomingMaintenance/MaintenanceStatus.php | 41 - .../src/V1/Enums/UpcomingMaintenance/Type.php | 42 - .../UpdateInstanceRequest/MinimalAction.php | 34 - .../MostDisruptiveAllowedAction.php | 36 - .../LoadBalancingSchemes.php | 41 - .../Enums/UsableSubnetwork/Ipv6AccessType.php | 38 - .../src/V1/Enums/UsableSubnetwork/Purpose.php | 50 - .../src/V1/Enums/UsableSubnetwork/Role.php | 38 - .../V1/Enums/UsableSubnetwork/StackType.php | 40 - .../V1/Enums/VpnGateway/GatewayIpVersion.php | 38 - Compute/src/V1/Enums/VpnGateway/StackType.php | 40 - .../State.php | 39 - .../UnsatisfiedReason.php | 38 - Compute/src/V1/Enums/VpnTunnel/Status.php | 60 - Compute/src/V1/Enums/Warning/Code.php | 92 - Compute/src/V1/Enums/Warnings/Code.php | 92 - Compute/src/V1/Enums/XpnResourceId/Type.php | 38 - Compute/src/V1/Enums/Zone/Status.php | 38 - Compute/src/V1/ErrorDetails.php | 8 +- Compute/src/V1/ErrorInfo.php | 4 +- Compute/src/V1/Errors.php | 6 +- Compute/src/V1/ExchangedPeeringRoute.php | 10 +- Compute/src/V1/ExchangedPeeringRoutesList.php | 10 +- .../V1/ExpandIpCidrRangeSubnetworkRequest.php | 10 +- Compute/src/V1/Expr.php | 8 +- Compute/src/V1/ExternalVpnGateway.php | 16 +- .../src/V1/ExternalVpnGatewayInterface.php | 6 +- Compute/src/V1/ExternalVpnGatewayList.php | 12 +- Compute/src/V1/ExternalVpnGatewaysClient.php | 34 - Compute/src/V1/FileContentBuffer.php | 4 +- Compute/src/V1/Firewall.php | 24 +- Compute/src/V1/FirewallList.php | 10 +- Compute/src/V1/FirewallLogConfig.php | 4 +- Compute/src/V1/FirewallPoliciesClient.php | 34 - ...rewallPoliciesListAssociationsResponse.php | 2 +- Compute/src/V1/FirewallPoliciesScopedList.php | 2 +- Compute/src/V1/FirewallPolicy.php | 26 +- Compute/src/V1/FirewallPolicyAssociation.php | 10 +- Compute/src/V1/FirewallPolicyList.php | 8 +- Compute/src/V1/FirewallPolicyRule.php | 24 +- Compute/src/V1/FirewallPolicyRuleMatcher.php | 4 +- .../FirewallPolicyRuleMatcherLayer4Config.php | 2 +- .../src/V1/FirewallPolicyRuleSecureTag.php | 4 +- Compute/src/V1/FirewallsClient.php | 34 - Compute/src/V1/FixedOrPercent.php | 6 +- Compute/src/V1/ForwardingRule.php | 66 +- Compute/src/V1/ForwardingRule/IPProtocol.php | 85 - .../src/V1/ForwardingRuleAggregatedList.php | 10 +- Compute/src/V1/ForwardingRuleList.php | 10 +- Compute/src/V1/ForwardingRuleReference.php | 2 +- ...ardingRuleServiceDirectoryRegistration.php | 6 +- Compute/src/V1/ForwardingRulesClient.php | 34 - Compute/src/V1/ForwardingRulesScopedList.php | 2 +- Compute/src/V1/GRPCHealthCheck.php | 8 +- .../V1/Gapic/AcceleratorTypesGapicClient.php | 425 -- Compute/src/V1/Gapic/AddressesGapicClient.php | 794 --- .../src/V1/Gapic/AutoscalersGapicClient.php | 796 --- .../V1/Gapic/BackendBucketsGapicClient.php | 1060 ---- .../V1/Gapic/BackendServicesGapicClient.php | 1369 ---- Compute/src/V1/Gapic/DiskTypesGapicClient.php | 422 -- Compute/src/V1/Gapic/DisksGapicClient.php | 1709 ----- .../Gapic/ExternalVpnGatewaysGapicClient.php | 649 -- .../V1/Gapic/FirewallPoliciesGapicClient.php | 1382 ----- Compute/src/V1/Gapic/FirewallsGapicClient.php | 681 -- .../V1/Gapic/ForwardingRulesGapicClient.php | 874 --- .../V1/Gapic/GlobalAddressesGapicClient.php | 677 -- .../GlobalForwardingRulesGapicClient.php | 753 --- ...GlobalNetworkEndpointGroupsGapicClient.php | 774 --- .../V1/Gapic/GlobalOperationsGapicClient.php | 502 -- ...lobalOrganizationOperationsGapicClient.php | 351 -- ...obalPublicDelegatedPrefixesGapicClient.php | 605 -- .../src/V1/Gapic/HealthChecksGapicClient.php | 767 --- .../V1/Gapic/ImageFamilyViewsGapicClient.php | 224 - Compute/src/V1/Gapic/ImagesGapicClient.php | 951 --- ...eGroupManagerResizeRequestsGapicClient.php | 645 -- .../InstanceGroupManagersGapicClient.php | 2210 ------- .../V1/Gapic/InstanceGroupsGapicClient.php | 987 --- .../InstanceSettingsServiceGapicClient.php | 358 -- .../V1/Gapic/InstanceTemplatesGapicClient.php | 763 --- Compute/src/V1/Gapic/InstancesGapicClient.php | 4006 ------------ .../V1/Gapic/InstantSnapshotsGapicClient.php | 873 --- ...nterconnectAttachmentGroupsGapicClient.php | 789 --- .../InterconnectAttachmentsGapicClient.php | 799 --- .../Gapic/InterconnectGroupsGapicClient.php | 861 --- .../InterconnectLocationsGapicClient.php | 305 - ...InterconnectRemoteLocationsGapicClient.php | 305 - .../src/V1/Gapic/InterconnectsGapicClient.php | 766 --- .../src/V1/Gapic/LicenseCodesGapicClient.php | 268 - Compute/src/V1/Gapic/LicensesGapicClient.php | 759 --- .../src/V1/Gapic/MachineImagesGapicClient.php | 754 --- .../src/V1/Gapic/MachineTypesGapicClient.php | 422 -- .../Gapic/NetworkAttachmentsGapicClient.php | 872 --- ...NetworkEdgeSecurityServicesGapicClient.php | 639 -- .../NetworkEndpointGroupsGapicClient.php | 945 --- .../NetworkFirewallPoliciesGapicClient.php | 1742 ------ .../V1/Gapic/NetworkProfilesGapicClient.php | 290 - Compute/src/V1/Gapic/NetworksGapicClient.php | 1141 ---- .../src/V1/Gapic/NodeGroupsGapicClient.php | 1388 ----- .../src/V1/Gapic/NodeTemplatesGapicClient.php | 792 --- Compute/src/V1/Gapic/NodeTypesGapicClient.php | 422 -- .../V1/Gapic/PacketMirroringsGapicClient.php | 765 --- Compute/src/V1/Gapic/ProjectsGapicClient.php | 1231 ---- .../PublicAdvertisedPrefixesGapicClient.php | 751 --- .../PublicDelegatedPrefixesGapicClient.php | 866 --- .../V1/Gapic/RegionAutoscalersGapicClient.php | 711 --- .../RegionBackendServicesGapicClient.php | 1091 ---- .../V1/Gapic/RegionCommitmentsGapicClient.php | 646 -- .../V1/Gapic/RegionDiskTypesGapicClient.php | 314 - .../src/V1/Gapic/RegionDisksGapicClient.php | 1522 ----- .../RegionHealthCheckServicesGapicClient.php | 627 -- .../Gapic/RegionHealthChecksGapicClient.php | 707 --- ...RegionInstanceGroupManagersGapicClient.php | 2112 ------- .../Gapic/RegionInstanceGroupsGapicClient.php | 550 -- .../RegionInstanceTemplatesGapicClient.php | 547 -- .../V1/Gapic/RegionInstancesGapicClient.php | 332 - .../RegionInstantSnapshotsGapicClient.php | 788 --- ...RegionNetworkEndpointGroupsGapicClient.php | 804 --- ...gionNetworkFirewallPoliciesGapicClient.php | 1459 ----- ...RegionNotificationEndpointsGapicClient.php | 547 -- .../V1/Gapic/RegionOperationsGapicClient.php | 410 -- .../RegionSecurityPoliciesGapicClient.php | 1025 --- .../RegionSslCertificatesGapicClient.php | 547 -- .../V1/Gapic/RegionSslPoliciesGapicClient.php | 702 --- .../RegionTargetHttpProxiesGapicClient.php | 628 -- .../RegionTargetHttpsProxiesGapicClient.php | 789 --- .../RegionTargetTcpProxiesGapicClient.php | 547 -- .../src/V1/Gapic/RegionUrlMapsGapicClient.php | 760 --- .../src/V1/Gapic/RegionZonesGapicClient.php | 276 - Compute/src/V1/Gapic/RegionsGapicClient.php | 305 - .../V1/Gapic/ReservationBlocksGapicClient.php | 472 -- .../Gapic/ReservationSubBlocksGapicClient.php | 461 -- .../src/V1/Gapic/ReservationsGapicClient.php | 1045 ---- .../V1/Gapic/ResourcePoliciesGapicClient.php | 878 --- Compute/src/V1/Gapic/RoutersGapicClient.php | 1537 ----- Compute/src/V1/Gapic/RoutesGapicClient.php | 529 -- .../V1/Gapic/SecurityPoliciesGapicClient.php | 1146 ---- .../Gapic/ServiceAttachmentsGapicClient.php | 872 --- .../SnapshotSettingsServiceGapicClient.php | 348 -- Compute/src/V1/Gapic/SnapshotsGapicClient.php | 748 --- .../V1/Gapic/SslCertificatesGapicClient.php | 615 -- .../src/V1/Gapic/SslPoliciesGapicClient.php | 762 --- .../V1/Gapic/StoragePoolTypesGapicClient.php | 422 -- .../src/V1/Gapic/StoragePoolsGapicClient.php | 942 --- .../src/V1/Gapic/SubnetworksGapicClient.php | 1132 ---- .../V1/Gapic/TargetGrpcProxiesGapicClient.php | 605 -- .../V1/Gapic/TargetHttpProxiesGapicClient.php | 768 --- .../Gapic/TargetHttpsProxiesGapicClient.php | 1076 ---- .../V1/Gapic/TargetInstancesGapicClient.php | 713 --- .../src/V1/Gapic/TargetPoolsGapicClient.php | 1191 ---- .../V1/Gapic/TargetSslProxiesGapicClient.php | 914 --- .../V1/Gapic/TargetTcpProxiesGapicClient.php | 769 --- .../V1/Gapic/TargetVpnGatewaysGapicClient.php | 713 --- Compute/src/V1/Gapic/UrlMapsGapicClient.php | 893 --- .../src/V1/Gapic/VpnGatewaysGapicClient.php | 815 --- .../src/V1/Gapic/VpnTunnelsGapicClient.php | 713 --- .../V1/Gapic/ZoneOperationsGapicClient.php | 410 -- Compute/src/V1/Gapic/ZonesGapicClient.php | 305 - Compute/src/V1/GetAcceleratorTypeRequest.php | 6 +- Compute/src/V1/GetAddressRequest.php | 6 +- .../GetAssociationFirewallPolicyRequest.php | 4 +- ...ssociationNetworkFirewallPolicyRequest.php | 6 +- ...tionRegionNetworkFirewallPolicyRequest.php | 8 +- Compute/src/V1/GetAutoscalerRequest.php | 6 +- Compute/src/V1/GetBackendBucketRequest.php | 4 +- Compute/src/V1/GetBackendServiceRequest.php | 4 +- .../V1/GetDiagnosticsInterconnectRequest.php | 4 +- Compute/src/V1/GetDiskRequest.php | 6 +- Compute/src/V1/GetDiskTypeRequest.php | 6 +- .../GetEffectiveFirewallsInstanceRequest.php | 8 +- .../GetEffectiveFirewallsNetworkRequest.php | 4 +- ...allsRegionNetworkFirewallPolicyRequest.php | 6 +- .../src/V1/GetExternalVpnGatewayRequest.php | 4 +- Compute/src/V1/GetFirewallPolicyRequest.php | 2 +- Compute/src/V1/GetFirewallRequest.php | 4 +- Compute/src/V1/GetForwardingRuleRequest.php | 6 +- Compute/src/V1/GetFromFamilyImageRequest.php | 4 +- Compute/src/V1/GetGlobalAddressRequest.php | 4 +- .../src/V1/GetGlobalForwardingRuleRequest.php | 4 +- .../GetGlobalNetworkEndpointGroupRequest.php | 4 +- Compute/src/V1/GetGlobalOperationRequest.php | 4 +- .../GetGlobalOrganizationOperationRequest.php | 4 +- ...GetGlobalPublicDelegatedPrefixeRequest.php | 4 +- .../V1/GetGuestAttributesInstanceRequest.php | 10 +- .../src/V1/GetHealthBackendServiceRequest.php | 6 +- Compute/src/V1/GetHealthCheckRequest.php | 4 +- .../GetHealthRegionBackendServiceRequest.php | 8 +- Compute/src/V1/GetHealthTargetPoolRequest.php | 8 +- .../V1/GetIamPolicyBackendBucketRequest.php | 6 +- .../V1/GetIamPolicyBackendServiceRequest.php | 6 +- Compute/src/V1/GetIamPolicyDiskRequest.php | 8 +- .../V1/GetIamPolicyFirewallPolicyRequest.php | 4 +- Compute/src/V1/GetIamPolicyImageRequest.php | 6 +- .../src/V1/GetIamPolicyInstanceRequest.php | 8 +- .../GetIamPolicyInstanceTemplateRequest.php | 6 +- .../V1/GetIamPolicyInstantSnapshotRequest.php | 8 +- ...licyInterconnectAttachmentGroupRequest.php | 6 +- .../GetIamPolicyInterconnectGroupRequest.php | 6 +- Compute/src/V1/GetIamPolicyLicenseRequest.php | 6 +- .../V1/GetIamPolicyMachineImageRequest.php | 6 +- .../GetIamPolicyNetworkAttachmentRequest.php | 8 +- ...tIamPolicyNetworkFirewallPolicyRequest.php | 6 +- .../src/V1/GetIamPolicyNodeGroupRequest.php | 8 +- .../V1/GetIamPolicyNodeTemplateRequest.php | 8 +- ...etIamPolicyRegionBackendServiceRequest.php | 8 +- .../src/V1/GetIamPolicyRegionDiskRequest.php | 8 +- ...tIamPolicyRegionInstantSnapshotRequest.php | 8 +- ...licyRegionNetworkFirewallPolicyRequest.php | 8 +- .../src/V1/GetIamPolicyReservationRequest.php | 8 +- .../V1/GetIamPolicyResourcePolicyRequest.php | 8 +- .../GetIamPolicyServiceAttachmentRequest.php | 8 +- .../src/V1/GetIamPolicySnapshotRequest.php | 6 +- .../src/V1/GetIamPolicyStoragePoolRequest.php | 8 +- .../src/V1/GetIamPolicySubnetworkRequest.php | 8 +- Compute/src/V1/GetImageFamilyViewRequest.php | 6 +- Compute/src/V1/GetImageRequest.php | 4 +- .../src/V1/GetInstanceGroupManagerRequest.php | 6 +- ...stanceGroupManagerResizeRequestRequest.php | 8 +- Compute/src/V1/GetInstanceGroupRequest.php | 6 +- Compute/src/V1/GetInstanceRequest.php | 6 +- Compute/src/V1/GetInstanceSettingRequest.php | 4 +- Compute/src/V1/GetInstanceTemplateRequest.php | 4 +- Compute/src/V1/GetInstantSnapshotRequest.php | 6 +- .../GetInterconnectAttachmentGroupRequest.php | 4 +- .../V1/GetInterconnectAttachmentRequest.php | 6 +- .../src/V1/GetInterconnectGroupRequest.php | 4 +- .../src/V1/GetInterconnectLocationRequest.php | 4 +- .../GetInterconnectRemoteLocationRequest.php | 4 +- Compute/src/V1/GetInterconnectRequest.php | 4 +- Compute/src/V1/GetLicenseCodeRequest.php | 4 +- Compute/src/V1/GetLicenseRequest.php | 4 +- Compute/src/V1/GetMachineImageRequest.php | 4 +- Compute/src/V1/GetMachineTypeRequest.php | 6 +- .../V1/GetMacsecConfigInterconnectRequest.php | 4 +- Compute/src/V1/GetNatIpInfoRouterRequest.php | 8 +- .../V1/GetNatMappingInfoRoutersRequest.php | 18 +- .../src/V1/GetNetworkAttachmentRequest.php | 6 +- .../GetNetworkEdgeSecurityServiceRequest.php | 6 +- .../src/V1/GetNetworkEndpointGroupRequest.php | 6 +- .../V1/GetNetworkFirewallPolicyRequest.php | 4 +- Compute/src/V1/GetNetworkProfileRequest.php | 4 +- Compute/src/V1/GetNetworkRequest.php | 4 +- Compute/src/V1/GetNodeGroupRequest.php | 6 +- Compute/src/V1/GetNodeTemplateRequest.php | 6 +- Compute/src/V1/GetNodeTypeRequest.php | 6 +- ...atusInterconnectAttachmentGroupRequest.php | 4 +- ...rationalStatusInterconnectGroupRequest.php | 4 +- Compute/src/V1/GetPacketMirroringRequest.php | 6 +- ...roringRuleNetworkFirewallPolicyRequest.php | 6 +- Compute/src/V1/GetProjectRequest.php | 2 +- .../V1/GetPublicAdvertisedPrefixeRequest.php | 4 +- .../V1/GetPublicDelegatedPrefixeRequest.php | 6 +- Compute/src/V1/GetRegionAutoscalerRequest.php | 6 +- .../src/V1/GetRegionBackendServiceRequest.php | 6 +- Compute/src/V1/GetRegionCommitmentRequest.php | 6 +- Compute/src/V1/GetRegionDiskRequest.php | 6 +- Compute/src/V1/GetRegionDiskTypeRequest.php | 6 +- .../src/V1/GetRegionHealthCheckRequest.php | 6 +- .../V1/GetRegionHealthCheckServiceRequest.php | 6 +- .../GetRegionInstanceGroupManagerRequest.php | 6 +- .../src/V1/GetRegionInstanceGroupRequest.php | 6 +- .../V1/GetRegionInstanceTemplateRequest.php | 6 +- .../V1/GetRegionInstantSnapshotRequest.php | 6 +- .../GetRegionNetworkEndpointGroupRequest.php | 6 +- .../GetRegionNetworkFirewallPolicyRequest.php | 6 +- .../GetRegionNotificationEndpointRequest.php | 6 +- Compute/src/V1/GetRegionOperationRequest.php | 6 +- Compute/src/V1/GetRegionRequest.php | 4 +- .../src/V1/GetRegionSecurityPolicyRequest.php | 6 +- .../src/V1/GetRegionSslCertificateRequest.php | 6 +- Compute/src/V1/GetRegionSslPolicyRequest.php | 6 +- .../V1/GetRegionTargetHttpProxyRequest.php | 6 +- .../V1/GetRegionTargetHttpsProxyRequest.php | 6 +- .../src/V1/GetRegionTargetTcpProxyRequest.php | 6 +- Compute/src/V1/GetRegionUrlMapRequest.php | 6 +- Compute/src/V1/GetReservationBlockRequest.php | 10 +- Compute/src/V1/GetReservationRequest.php | 6 +- .../src/V1/GetReservationSubBlockRequest.php | 8 +- Compute/src/V1/GetResourcePolicyRequest.php | 6 +- .../src/V1/GetRoutePolicyRouterRequest.php | 8 +- Compute/src/V1/GetRouteRequest.php | 4 +- Compute/src/V1/GetRouterRequest.php | 6 +- .../src/V1/GetRouterStatusRouterRequest.php | 6 +- .../src/V1/GetRuleFirewallPolicyRequest.php | 4 +- .../GetRuleNetworkFirewallPolicyRequest.php | 6 +- ...RuleRegionNetworkFirewallPolicyRequest.php | 8 +- .../V1/GetRuleRegionSecurityPolicyRequest.php | 8 +- .../src/V1/GetRuleSecurityPolicyRequest.php | 6 +- .../src/V1/GetScreenshotInstanceRequest.php | 6 +- Compute/src/V1/GetSecurityPolicyRequest.php | 4 +- .../V1/GetSerialPortOutputInstanceRequest.php | 10 +- .../src/V1/GetServiceAttachmentRequest.php | 6 +- ...hieldedInstanceIdentityInstanceRequest.php | 6 +- Compute/src/V1/GetSnapshotRequest.php | 4 +- Compute/src/V1/GetSnapshotSettingRequest.php | 2 +- Compute/src/V1/GetSslCertificateRequest.php | 4 +- Compute/src/V1/GetSslPolicyRequest.php | 4 +- Compute/src/V1/GetStatusVpnGatewayRequest.php | 6 +- Compute/src/V1/GetStoragePoolRequest.php | 6 +- Compute/src/V1/GetStoragePoolTypeRequest.php | 6 +- Compute/src/V1/GetSubnetworkRequest.php | 6 +- Compute/src/V1/GetTargetGrpcProxyRequest.php | 4 +- Compute/src/V1/GetTargetHttpProxyRequest.php | 4 +- Compute/src/V1/GetTargetHttpsProxyRequest.php | 4 +- Compute/src/V1/GetTargetInstanceRequest.php | 6 +- Compute/src/V1/GetTargetPoolRequest.php | 6 +- Compute/src/V1/GetTargetSslProxyRequest.php | 4 +- Compute/src/V1/GetTargetTcpProxyRequest.php | 4 +- Compute/src/V1/GetTargetVpnGatewayRequest.php | 6 +- Compute/src/V1/GetUrlMapRequest.php | 4 +- Compute/src/V1/GetVpnGatewayRequest.php | 6 +- Compute/src/V1/GetVpnTunnelRequest.php | 6 +- Compute/src/V1/GetXpnHostProjectRequest.php | 2 +- .../src/V1/GetXpnResourcesProjectsRequest.php | 12 +- Compute/src/V1/GetZoneOperationRequest.php | 6 +- Compute/src/V1/GetZoneRequest.php | 4 +- Compute/src/V1/GlobalAddressesClient.php | 34 - Compute/src/V1/GlobalAddressesMoveRequest.php | 4 +- .../src/V1/GlobalForwardingRulesClient.php | 34 - .../V1/GlobalNetworkEndpointGroupsClient.php | 34 - Compute/src/V1/GlobalOperationsClient.php | 34 - .../V1/GlobalOrganizationOperationsClient.php | 34 - .../V1/GlobalOrganizationSetPolicyRequest.php | 4 +- .../GlobalPublicDelegatedPrefixesClient.php | 34 - Compute/src/V1/GlobalSetLabelsRequest.php | 2 +- Compute/src/V1/GlobalSetPolicyRequest.php | 4 +- Compute/src/V1/GroupMaintenanceInfo.php | 16 +- Compute/src/V1/GuestAttributes.php | 12 +- Compute/src/V1/GuestAttributesEntry.php | 6 +- Compute/src/V1/GuestOsFeature.php | 2 +- Compute/src/V1/HTTP2HealthCheck.php | 14 +- Compute/src/V1/HTTPHealthCheck.php | 14 +- Compute/src/V1/HTTPSHealthCheck.php | 14 +- Compute/src/V1/HealthCheck.php | 40 +- Compute/src/V1/HealthCheckList.php | 10 +- Compute/src/V1/HealthCheckLogConfig.php | 2 +- Compute/src/V1/HealthCheckReference.php | 2 +- Compute/src/V1/HealthCheckService.php | 18 +- .../src/V1/HealthCheckServiceReference.php | 2 +- Compute/src/V1/HealthCheckServicesList.php | 10 +- Compute/src/V1/HealthChecksAggregatedList.php | 10 +- Compute/src/V1/HealthChecksClient.php | 34 - Compute/src/V1/HealthChecksScopedList.php | 2 +- Compute/src/V1/HealthStatus.php | 20 +- .../src/V1/HealthStatusForNetworkEndpoint.php | 12 +- Compute/src/V1/HelpLink.php | 4 +- Compute/src/V1/HostRule.php | 4 +- Compute/src/V1/HttpFaultAbort.php | 4 +- Compute/src/V1/HttpFaultDelay.php | 4 +- Compute/src/V1/HttpFaultInjection.php | 4 +- Compute/src/V1/HttpHeaderMatch.php | 16 +- Compute/src/V1/HttpHeaderOption.php | 6 +- Compute/src/V1/HttpQueryParameterMatch.php | 8 +- Compute/src/V1/HttpRedirectAction.php | 12 +- Compute/src/V1/HttpRetryPolicy.php | 4 +- Compute/src/V1/HttpRouteAction.php | 14 +- Compute/src/V1/HttpRouteRule.php | 14 +- Compute/src/V1/HttpRouteRuleMatch.php | 10 +- Compute/src/V1/Image.php | 58 +- Compute/src/V1/ImageFamilyView.php | 2 +- Compute/src/V1/ImageFamilyViewsClient.php | 34 - Compute/src/V1/ImageList.php | 10 +- Compute/src/V1/ImagesClient.php | 34 - Compute/src/V1/InitialStateConfig.php | 2 +- Compute/src/V1/InsertAddressRequest.php | 8 +- Compute/src/V1/InsertAutoscalerRequest.php | 8 +- Compute/src/V1/InsertBackendBucketRequest.php | 6 +- .../src/V1/InsertBackendServiceRequest.php | 6 +- Compute/src/V1/InsertDiskRequest.php | 10 +- .../V1/InsertExternalVpnGatewayRequest.php | 6 +- .../src/V1/InsertFirewallPolicyRequest.php | 6 +- Compute/src/V1/InsertFirewallRequest.php | 6 +- .../src/V1/InsertForwardingRuleRequest.php | 8 +- Compute/src/V1/InsertGlobalAddressRequest.php | 6 +- .../V1/InsertGlobalForwardingRuleRequest.php | 6 +- ...nsertGlobalNetworkEndpointGroupRequest.php | 6 +- ...ertGlobalPublicDelegatedPrefixeRequest.php | 6 +- Compute/src/V1/InsertHealthCheckRequest.php | 6 +- Compute/src/V1/InsertImageRequest.php | 8 +- .../V1/InsertInstanceGroupManagerRequest.php | 8 +- ...stanceGroupManagerResizeRequestRequest.php | 10 +- Compute/src/V1/InsertInstanceGroupRequest.php | 8 +- Compute/src/V1/InsertInstanceRequest.php | 12 +- .../src/V1/InsertInstanceTemplateRequest.php | 6 +- .../src/V1/InsertInstantSnapshotRequest.php | 8 +- ...sertInterconnectAttachmentGroupRequest.php | 6 +- .../InsertInterconnectAttachmentRequest.php | 10 +- .../src/V1/InsertInterconnectGroupRequest.php | 6 +- Compute/src/V1/InsertInterconnectRequest.php | 6 +- Compute/src/V1/InsertLicenseRequest.php | 6 +- Compute/src/V1/InsertMachineImageRequest.php | 8 +- .../src/V1/InsertNetworkAttachmentRequest.php | 8 +- ...nsertNetworkEdgeSecurityServiceRequest.php | 10 +- .../V1/InsertNetworkEndpointGroupRequest.php | 8 +- .../V1/InsertNetworkFirewallPolicyRequest.php | 6 +- Compute/src/V1/InsertNetworkRequest.php | 6 +- Compute/src/V1/InsertNodeGroupRequest.php | 10 +- Compute/src/V1/InsertNodeTemplateRequest.php | 8 +- .../src/V1/InsertPacketMirroringRequest.php | 8 +- .../InsertPublicAdvertisedPrefixeRequest.php | 6 +- .../InsertPublicDelegatedPrefixeRequest.php | 8 +- .../src/V1/InsertRegionAutoscalerRequest.php | 8 +- .../V1/InsertRegionBackendServiceRequest.php | 8 +- .../src/V1/InsertRegionCommitmentRequest.php | 8 +- Compute/src/V1/InsertRegionDiskRequest.php | 10 +- .../src/V1/InsertRegionHealthCheckRequest.php | 8 +- .../InsertRegionHealthCheckServiceRequest.php | 8 +- ...nsertRegionInstanceGroupManagerRequest.php | 8 +- .../InsertRegionInstanceTemplateRequest.php | 8 +- .../V1/InsertRegionInstantSnapshotRequest.php | 8 +- ...nsertRegionNetworkEndpointGroupRequest.php | 8 +- ...sertRegionNetworkFirewallPolicyRequest.php | 8 +- ...nsertRegionNotificationEndpointRequest.php | 8 +- .../V1/InsertRegionSecurityPolicyRequest.php | 10 +- .../V1/InsertRegionSslCertificateRequest.php | 8 +- .../src/V1/InsertRegionSslPolicyRequest.php | 8 +- .../V1/InsertRegionTargetHttpProxyRequest.php | 8 +- .../InsertRegionTargetHttpsProxyRequest.php | 8 +- .../V1/InsertRegionTargetTcpProxyRequest.php | 8 +- Compute/src/V1/InsertRegionUrlMapRequest.php | 8 +- Compute/src/V1/InsertReservationRequest.php | 8 +- .../src/V1/InsertResourcePolicyRequest.php | 8 +- Compute/src/V1/InsertRouteRequest.php | 6 +- Compute/src/V1/InsertRouterRequest.php | 8 +- .../src/V1/InsertSecurityPolicyRequest.php | 8 +- .../src/V1/InsertServiceAttachmentRequest.php | 8 +- Compute/src/V1/InsertSnapshotRequest.php | 6 +- .../src/V1/InsertSslCertificateRequest.php | 6 +- Compute/src/V1/InsertSslPolicyRequest.php | 6 +- Compute/src/V1/InsertStoragePoolRequest.php | 8 +- Compute/src/V1/InsertSubnetworkRequest.php | 8 +- .../src/V1/InsertTargetGrpcProxyRequest.php | 6 +- .../src/V1/InsertTargetHttpProxyRequest.php | 6 +- .../src/V1/InsertTargetHttpsProxyRequest.php | 6 +- .../src/V1/InsertTargetInstanceRequest.php | 8 +- Compute/src/V1/InsertTargetPoolRequest.php | 8 +- .../src/V1/InsertTargetSslProxyRequest.php | 6 +- .../src/V1/InsertTargetTcpProxyRequest.php | 6 +- .../src/V1/InsertTargetVpnGatewayRequest.php | 8 +- Compute/src/V1/InsertUrlMapRequest.php | 6 +- Compute/src/V1/InsertVpnGatewayRequest.php | 8 +- Compute/src/V1/InsertVpnTunnelRequest.php | 8 +- Compute/src/V1/Instance.php | 80 +- Compute/src/V1/InstanceAggregatedList.php | 10 +- Compute/src/V1/InstanceConsumptionData.php | 4 +- Compute/src/V1/InstanceConsumptionInfo.php | 8 +- Compute/src/V1/InstanceGroup.php | 24 +- .../src/V1/InstanceGroupAggregatedList.php | 10 +- Compute/src/V1/InstanceGroupList.php | 10 +- Compute/src/V1/InstanceGroupManager.php | 56 +- .../V1/InstanceGroupManagerActionsSummary.php | 26 +- .../V1/InstanceGroupManagerAggregatedList.php | 10 +- ...InstanceGroupManagerAllInstancesConfig.php | 2 +- .../InstanceGroupManagerAutoHealingPolicy.php | 4 +- ...anceFlexibilityPolicyInstanceSelection.php | 2 +- ...nceGroupManagerInstanceLifecyclePolicy.php | 4 +- Compute/src/V1/InstanceGroupManagerList.php | 10 +- .../V1/InstanceGroupManagerResizeRequest.php | 24 +- ...nstanceGroupManagerResizeRequestStatus.php | 4 +- ...pManagerResizeRequestStatusLastAttempt.php | 2 +- ...stanceGroupManagerResizeRequestsClient.php | 34 - ...GroupManagerResizeRequestsListResponse.php | 10 +- .../InstanceGroupManagerResourcePolicies.php | 2 +- .../V1/InstanceGroupManagerStandbyPolicy.php | 4 +- Compute/src/V1/InstanceGroupManagerStatus.php | 10 +- ...ceGroupManagerStatusAllInstancesConfig.php | 4 +- .../V1/InstanceGroupManagerStatusStateful.php | 4 +- ...anagerStatusStatefulPerInstanceConfigs.php | 2 +- ...nstanceGroupManagerStatusVersionTarget.php | 2 +- .../V1/InstanceGroupManagerUpdatePolicy.php | 14 +- .../src/V1/InstanceGroupManagerVersion.php | 6 +- ...stanceGroupManagersApplyUpdatesRequest.php | 6 +- .../src/V1/InstanceGroupManagersClient.php | 34 - ...nceGroupManagersDeleteInstancesRequest.php | 2 +- ...nstanceGroupManagersListErrorsResponse.php | 2 +- ...upManagersListManagedInstancesResponse.php | 2 +- ...roupManagersListPerInstanceConfigsResp.php | 4 +- .../V1/InstanceGroupManagersScopedList.php | 2 +- ...roupManagersSetInstanceTemplateRequest.php | 2 +- ...anceGroupManagersSetTargetPoolsRequest.php | 2 +- ...tanceGroupManagersStopInstancesRequest.php | 2 +- ...ceGroupManagersSuspendInstancesRequest.php | 2 +- Compute/src/V1/InstanceGroupsClient.php | 34 - .../src/V1/InstanceGroupsListInstances.php | 10 +- .../V1/InstanceGroupsListInstancesRequest.php | 2 +- Compute/src/V1/InstanceGroupsScopedList.php | 2 +- .../V1/InstanceGroupsSetNamedPortsRequest.php | 2 +- Compute/src/V1/InstanceList.php | 10 +- Compute/src/V1/InstanceListReferrers.php | 10 +- Compute/src/V1/InstanceManagedByIgmError.php | 6 +- ...ManagedByIgmErrorInstanceActionDetails.php | 6 +- ...eManagedByIgmErrorManagedInstanceError.php | 4 +- Compute/src/V1/InstanceMoveRequest.php | 4 +- Compute/src/V1/InstanceProperties.php | 28 +- Compute/src/V1/InstanceReference.php | 2 +- Compute/src/V1/InstanceSettings.php | 8 +- Compute/src/V1/InstanceSettingsMetadata.php | 2 +- .../src/V1/InstanceSettingsServiceClient.php | 34 - Compute/src/V1/InstanceTemplate.php | 22 +- .../src/V1/InstanceTemplateAggregatedList.php | 10 +- Compute/src/V1/InstanceTemplateList.php | 10 +- Compute/src/V1/InstanceTemplatesClient.php | 34 - .../src/V1/InstanceTemplatesScopedList.php | 2 +- Compute/src/V1/InstanceWithNamedPorts.php | 4 +- Compute/src/V1/InstancesClient.php | 34 - ...rewallsResponseEffectiveFirewallPolicy.php | 10 +- .../V1/InstancesReportHostAsFaultyRequest.php | 2 +- ...esReportHostAsFaultyRequestFaultReason.php | 4 +- Compute/src/V1/InstancesScopedList.php | 2 +- Compute/src/V1/InstancesSetLabelsRequest.php | 2 +- .../src/V1/InstancesSetMachineTypeRequest.php | 2 +- .../V1/InstancesSetMinCpuPlatformRequest.php | 2 +- Compute/src/V1/InstancesSetNameRequest.php | 4 +- .../V1/InstancesSetSecurityPolicyRequest.php | 2 +- .../V1/InstancesSetServiceAccountRequest.php | 2 +- Compute/src/V1/InstantSnapshot.php | 36 +- .../src/V1/InstantSnapshotAggregatedList.php | 10 +- Compute/src/V1/InstantSnapshotList.php | 10 +- .../src/V1/InstantSnapshotResourceStatus.php | 2 +- Compute/src/V1/InstantSnapshotsClient.php | 34 - Compute/src/V1/InstantSnapshotsScopedList.php | 2 +- Compute/src/V1/Int64RangeMatch.php | 4 +- Compute/src/V1/Interconnect.php | 52 +- ...terconnectApplicationAwareInterconnect.php | 6 +- ...onAwareInterconnectBandwidthPercentage.php | 4 +- Compute/src/V1/InterconnectAttachment.php | 74 +- .../InterconnectAttachmentAggregatedList.php | 10 +- ...nectAttachmentConfigurationConstraints.php | 2 +- ...onfigurationConstraintsBgpPeerASNRange.php | 4 +- .../src/V1/InterconnectAttachmentGroup.php | 22 +- .../InterconnectAttachmentGroupAttachment.php | 2 +- .../InterconnectAttachmentGroupConfigured.php | 2 +- ...tachmentGroupConfiguredAvailabilitySLA.php | 2 +- ...uredAvailabilitySLAIntendedSlaBlockers.php | 6 +- .../V1/InterconnectAttachmentGroupIntent.php | 2 +- ...tAttachmentGroupLogicalStructureRegion.php | 2 +- ...chmentGroupLogicalStructureRegionMetro.php | 2 +- ...oupLogicalStructureRegionMetroFacility.php | 2 +- ...ogicalStructureRegionMetroFacilityZone.php | 2 +- .../V1/InterconnectAttachmentGroupsClient.php | 34 - ...mentGroupsGetOperationalStatusResponse.php | 4 +- ...terconnectAttachmentGroupsListResponse.php | 12 +- ...nnectAttachmentGroupsOperationalStatus.php | 8 +- ...roupsOperationalStatusAttachmentStatus.php | 8 +- Compute/src/V1/InterconnectAttachmentList.php | 10 +- .../InterconnectAttachmentPartnerMetadata.php | 6 +- .../V1/InterconnectAttachmentPrivateInfo.php | 2 +- .../src/V1/InterconnectAttachmentsClient.php | 34 - .../V1/InterconnectAttachmentsScopedList.php | 2 +- Compute/src/V1/InterconnectCircuitInfo.php | 6 +- Compute/src/V1/InterconnectDiagnostics.php | 6 +- .../V1/InterconnectDiagnosticsARPEntry.php | 4 +- .../InterconnectDiagnosticsLinkLACPStatus.php | 6 +- ...nterconnectDiagnosticsLinkOpticalPower.php | 4 +- .../V1/InterconnectDiagnosticsLinkStatus.php | 14 +- .../InterconnectDiagnosticsMacsecStatus.php | 4 +- Compute/src/V1/InterconnectGroup.php | 20 +- .../src/V1/InterconnectGroupConfigured.php | 2 +- ...nnectGroupConfiguredTopologyCapability.php | 2 +- ...gyCapabilityIntendedCapabilityBlockers.php | 6 +- Compute/src/V1/InterconnectGroupIntent.php | 2 +- .../src/V1/InterconnectGroupInterconnect.php | 2 +- ...terconnectGroupPhysicalStructureMetros.php | 2 +- ...GroupPhysicalStructureMetrosFacilities.php | 2 +- ...PhysicalStructureMetrosFacilitiesZones.php | 2 +- Compute/src/V1/InterconnectGroupsClient.php | 34 - .../V1/InterconnectGroupsCreateMembers.php | 4 +- ...ctGroupsCreateMembersInterconnectInput.php | 20 +- ...InterconnectGroupsCreateMembersRequest.php | 2 +- ...nectGroupsGetOperationalStatusResponse.php | 4 +- .../src/V1/InterconnectGroupsListResponse.php | 12 +- .../InterconnectGroupsOperationalStatus.php | 8 +- ...upsOperationalStatusInterconnectStatus.php | 8 +- Compute/src/V1/InterconnectList.php | 10 +- Compute/src/V1/InterconnectLocation.php | 30 +- Compute/src/V1/InterconnectLocationList.php | 10 +- .../src/V1/InterconnectLocationRegionInfo.php | 6 +- .../src/V1/InterconnectLocationsClient.php | 34 - Compute/src/V1/InterconnectMacsec.php | 2 +- .../InterconnectMacsecConfigPreSharedKey.php | 8 +- .../src/V1/InterconnectMacsecPreSharedKey.php | 4 +- .../src/V1/InterconnectOutageNotification.php | 14 +- Compute/src/V1/InterconnectRemoteLocation.php | 38 +- .../InterconnectRemoteLocationConstraints.php | 6 +- ...teLocationConstraintsSubnetLengthRange.php | 4 +- .../src/V1/InterconnectRemoteLocationList.php | 10 +- ...nectRemoteLocationPermittedConnections.php | 2 +- .../V1/InterconnectRemoteLocationsClient.php | 34 - Compute/src/V1/InterconnectsClient.php | 34 - .../InterconnectsGetDiagnosticsResponse.php | 2 +- .../InterconnectsGetMacsecConfigResponse.php | 4 +- .../src/V1/InvalidateCacheUrlMapRequest.php | 8 +- Compute/src/V1/Items.php | 4 +- Compute/src/V1/License.php | 36 +- Compute/src/V1/LicenseCode.php | 16 +- Compute/src/V1/LicenseCodeLicenseAlias.php | 4 +- Compute/src/V1/LicenseCodesClient.php | 34 - Compute/src/V1/LicenseResourceCommitment.php | 6 +- .../src/V1/LicenseResourceRequirements.php | 4 +- Compute/src/V1/LicensesClient.php | 34 - Compute/src/V1/LicensesListResponse.php | 8 +- .../src/V1/ListAcceleratorTypesRequest.php | 14 +- Compute/src/V1/ListAddressesRequest.php | 14 +- .../ListAssociationsFirewallPolicyRequest.php | 2 +- Compute/src/V1/ListAutoscalersRequest.php | 14 +- ...ilableFeaturesRegionSslPoliciesRequest.php | 14 +- ...istAvailableFeaturesSslPoliciesRequest.php | 12 +- Compute/src/V1/ListBackendBucketsRequest.php | 12 +- Compute/src/V1/ListBackendServicesRequest.php | 12 +- .../src/V1/ListBgpRoutesRoutersRequest.php | 26 +- Compute/src/V1/ListDiskTypesRequest.php | 14 +- Compute/src/V1/ListDisksRequest.php | 14 +- .../src/V1/ListDisksStoragePoolsRequest.php | 16 +- ...ListErrorsInstanceGroupManagersRequest.php | 16 +- ...rorsRegionInstanceGroupManagersRequest.php | 16 +- .../src/V1/ListExternalVpnGatewaysRequest.php | 12 +- .../src/V1/ListFirewallPoliciesRequest.php | 12 +- Compute/src/V1/ListFirewallsRequest.php | 12 +- Compute/src/V1/ListForwardingRulesRequest.php | 14 +- Compute/src/V1/ListGlobalAddressesRequest.php | 12 +- .../V1/ListGlobalForwardingRulesRequest.php | 12 +- ...ListGlobalNetworkEndpointGroupsRequest.php | 12 +- .../src/V1/ListGlobalOperationsRequest.php | 12 +- ...istGlobalOrganizationOperationsRequest.php | 12 +- ...stGlobalPublicDelegatedPrefixesRequest.php | 12 +- Compute/src/V1/ListHealthChecksRequest.php | 12 +- Compute/src/V1/ListImagesRequest.php | 12 +- ...tanceGroupManagerResizeRequestsRequest.php | 16 +- .../V1/ListInstanceGroupManagersRequest.php | 14 +- Compute/src/V1/ListInstanceGroupsRequest.php | 14 +- .../src/V1/ListInstanceTemplatesRequest.php | 12 +- .../V1/ListInstancesInstanceGroupsRequest.php | 18 +- ...stInstancesRegionInstanceGroupsRequest.php | 18 +- Compute/src/V1/ListInstancesRequest.php | 14 +- .../src/V1/ListInstantSnapshotsRequest.php | 14 +- ...istInterconnectAttachmentGroupsRequest.php | 12 +- .../V1/ListInterconnectAttachmentsRequest.php | 14 +- .../src/V1/ListInterconnectGroupsRequest.php | 12 +- .../V1/ListInterconnectLocationsRequest.php | 12 +- ...ListInterconnectRemoteLocationsRequest.php | 12 +- Compute/src/V1/ListInterconnectsRequest.php | 12 +- Compute/src/V1/ListLicensesRequest.php | 12 +- Compute/src/V1/ListMachineImagesRequest.php | 12 +- Compute/src/V1/ListMachineTypesRequest.php | 14 +- ...dInstancesInstanceGroupManagersRequest.php | 16 +- ...ncesRegionInstanceGroupManagersRequest.php | 16 +- .../src/V1/ListNetworkAttachmentsRequest.php | 14 +- .../V1/ListNetworkEndpointGroupsRequest.php | 14 +- ...intsGlobalNetworkEndpointGroupsRequest.php | 14 +- ...kEndpointsNetworkEndpointGroupsRequest.php | 18 +- ...intsRegionNetworkEndpointGroupsRequest.php | 16 +- .../V1/ListNetworkFirewallPoliciesRequest.php | 12 +- Compute/src/V1/ListNetworkProfilesRequest.php | 12 +- Compute/src/V1/ListNetworksRequest.php | 12 +- Compute/src/V1/ListNodeGroupsRequest.php | 14 +- Compute/src/V1/ListNodeTemplatesRequest.php | 14 +- Compute/src/V1/ListNodeTypesRequest.php | 14 +- Compute/src/V1/ListNodesNodeGroupsRequest.php | 16 +- .../src/V1/ListPacketMirroringsRequest.php | 14 +- .../V1/ListPeeringRoutesNetworksRequest.php | 20 +- ...nceConfigsInstanceGroupManagersRequest.php | 16 +- ...figsRegionInstanceGroupManagersRequest.php | 16 +- ...dExpressionSetsSecurityPoliciesRequest.php | 12 +- .../ListPublicAdvertisedPrefixesRequest.php | 12 +- .../V1/ListPublicDelegatedPrefixesRequest.php | 14 +- .../src/V1/ListReferrersInstancesRequest.php | 16 +- .../src/V1/ListRegionAutoscalersRequest.php | 14 +- .../V1/ListRegionBackendServicesRequest.php | 14 +- .../src/V1/ListRegionCommitmentsRequest.php | 14 +- Compute/src/V1/ListRegionDiskTypesRequest.php | 14 +- Compute/src/V1/ListRegionDisksRequest.php | 14 +- .../ListRegionHealthCheckServicesRequest.php | 14 +- .../src/V1/ListRegionHealthChecksRequest.php | 14 +- ...ListRegionInstanceGroupManagersRequest.php | 14 +- .../V1/ListRegionInstanceGroupsRequest.php | 14 +- .../V1/ListRegionInstanceTemplatesRequest.php | 14 +- .../V1/ListRegionInstantSnapshotsRequest.php | 14 +- ...ListRegionNetworkEndpointGroupsRequest.php | 14 +- ...stRegionNetworkFirewallPoliciesRequest.php | 14 +- ...ListRegionNotificationEndpointsRequest.php | 14 +- .../src/V1/ListRegionOperationsRequest.php | 14 +- .../V1/ListRegionSecurityPoliciesRequest.php | 14 +- .../V1/ListRegionSslCertificatesRequest.php | 14 +- .../src/V1/ListRegionSslPoliciesRequest.php | 14 +- .../V1/ListRegionTargetHttpProxiesRequest.php | 14 +- .../ListRegionTargetHttpsProxiesRequest.php | 14 +- .../V1/ListRegionTargetTcpProxiesRequest.php | 14 +- Compute/src/V1/ListRegionUrlMapsRequest.php | 14 +- Compute/src/V1/ListRegionZonesRequest.php | 14 +- Compute/src/V1/ListRegionsRequest.php | 12 +- .../src/V1/ListReservationBlocksRequest.php | 16 +- .../V1/ListReservationSubBlocksRequest.php | 16 +- Compute/src/V1/ListReservationsRequest.php | 14 +- .../src/V1/ListResourcePoliciesRequest.php | 14 +- .../V1/ListRoutePoliciesRoutersRequest.php | 16 +- Compute/src/V1/ListRoutersRequest.php | 14 +- Compute/src/V1/ListRoutesRequest.php | 12 +- .../src/V1/ListSecurityPoliciesRequest.php | 12 +- .../src/V1/ListServiceAttachmentsRequest.php | 14 +- Compute/src/V1/ListSnapshotsRequest.php | 12 +- Compute/src/V1/ListSslCertificatesRequest.php | 12 +- Compute/src/V1/ListSslPoliciesRequest.php | 12 +- .../src/V1/ListStoragePoolTypesRequest.php | 14 +- Compute/src/V1/ListStoragePoolsRequest.php | 14 +- Compute/src/V1/ListSubnetworksRequest.php | 14 +- .../src/V1/ListTargetGrpcProxiesRequest.php | 12 +- .../src/V1/ListTargetHttpProxiesRequest.php | 12 +- .../src/V1/ListTargetHttpsProxiesRequest.php | 12 +- Compute/src/V1/ListTargetInstancesRequest.php | 14 +- Compute/src/V1/ListTargetPoolsRequest.php | 14 +- .../src/V1/ListTargetSslProxiesRequest.php | 12 +- .../src/V1/ListTargetTcpProxiesRequest.php | 12 +- .../src/V1/ListTargetVpnGatewaysRequest.php | 14 +- Compute/src/V1/ListUrlMapsRequest.php | 12 +- .../V1/ListUsableBackendServicesRequest.php | 12 +- ...ListUsableRegionBackendServicesRequest.php | 14 +- .../src/V1/ListUsableSubnetworksRequest.php | 14 +- Compute/src/V1/ListVpnGatewaysRequest.php | 14 +- Compute/src/V1/ListVpnTunnelsRequest.php | 14 +- .../src/V1/ListXpnHostsProjectsRequest.php | 14 +- Compute/src/V1/ListZoneOperationsRequest.php | 14 +- Compute/src/V1/ListZonesRequest.php | 12 +- Compute/src/V1/LocalDisk.php | 6 +- Compute/src/V1/LocalizedMessage.php | 4 +- Compute/src/V1/LocationPolicy.php | 2 +- Compute/src/V1/LocationPolicyLocation.php | 4 +- .../V1/LocationPolicyLocationConstraints.php | 2 +- Compute/src/V1/LogConfig.php | 165 - Compute/src/V1/LogConfigCloudAuditOptions.php | 125 - .../V1/LogConfigCloudAuditOptions/LogName.php | 69 - Compute/src/V1/LogConfigCounterOptions.php | 155 - .../V1/LogConfigCounterOptionsCustomField.php | 121 - Compute/src/V1/LogConfigDataAccessOptions.php | 81 - .../V1/LogConfigDataAccessOptions/LogMode.php | 62 - Compute/src/V1/MachineImage.php | 32 +- Compute/src/V1/MachineImageList.php | 10 +- Compute/src/V1/MachineImagesClient.php | 34 - Compute/src/V1/MachineType.php | 30 +- Compute/src/V1/MachineTypeAggregatedList.php | 10 +- Compute/src/V1/MachineTypeList.php | 10 +- Compute/src/V1/MachineTypesClient.php | 34 - Compute/src/V1/MachineTypesScopedList.php | 2 +- Compute/src/V1/ManagedInstance.php | 20 +- .../src/V1/ManagedInstanceInstanceHealth.php | 4 +- Compute/src/V1/ManagedInstanceLastAttempt.php | 2 +- ...nstancePropertiesFromFlexibilityPolicy.php | 2 +- Compute/src/V1/ManagedInstanceVersion.php | 4 +- Compute/src/V1/Metadata.php | 4 +- Compute/src/V1/MetadataFilter.php | 2 +- Compute/src/V1/MetadataFilterLabelMatch.php | 4 +- Compute/src/V1/MoveAddressRequest.php | 10 +- Compute/src/V1/MoveDiskProjectRequest.php | 6 +- Compute/src/V1/MoveFirewallPolicyRequest.php | 6 +- Compute/src/V1/MoveGlobalAddressRequest.php | 8 +- Compute/src/V1/MoveInstanceProjectRequest.php | 6 +- Compute/src/V1/NamedPort.php | 4 +- Compute/src/V1/NatIpInfo.php | 2 +- Compute/src/V1/NatIpInfoNatIpInfoMapping.php | 6 +- Compute/src/V1/Network.php | 36 +- Compute/src/V1/NetworkAttachment.php | 22 +- .../V1/NetworkAttachmentAggregatedList.php | 10 +- .../V1/NetworkAttachmentConnectedEndpoint.php | 12 +- Compute/src/V1/NetworkAttachmentList.php | 10 +- Compute/src/V1/NetworkAttachmentsClient.php | 34 - .../src/V1/NetworkAttachmentsScopedList.php | 2 +- Compute/src/V1/NetworkEdgeSecurityService.php | 20 +- ...tworkEdgeSecurityServiceAggregatedList.php | 12 +- .../V1/NetworkEdgeSecurityServicesClient.php | 34 - .../NetworkEdgeSecurityServicesScopedList.php | 2 +- Compute/src/V1/NetworkEndpoint.php | 12 +- Compute/src/V1/NetworkEndpointGroup.php | 36 +- .../V1/NetworkEndpointGroupAggregatedList.php | 10 +- .../src/V1/NetworkEndpointGroupAppEngine.php | 6 +- .../V1/NetworkEndpointGroupCloudFunction.php | 4 +- .../src/V1/NetworkEndpointGroupCloudRun.php | 6 +- Compute/src/V1/NetworkEndpointGroupList.php | 10 +- .../src/V1/NetworkEndpointGroupPscData.php | 8 +- .../src/V1/NetworkEndpointGroupsClient.php | 34 - ...workEndpointGroupsListEndpointsRequest.php | 2 +- ...workEndpointGroupsListNetworkEndpoints.php | 8 +- .../V1/NetworkEndpointGroupsScopedList.php | 2 +- .../V1/NetworkEndpointWithHealthStatus.php | 2 +- .../src/V1/NetworkFirewallPoliciesClient.php | 34 - .../NetworkFirewallPolicyAggregatedList.php | 10 +- Compute/src/V1/NetworkInterface.php | 26 +- Compute/src/V1/NetworkList.php | 10 +- Compute/src/V1/NetworkPeering.php | 28 +- .../src/V1/NetworkPeeringConnectionStatus.php | 6 +- ...kPeeringConnectionStatusConsensusState.php | 4 +- ...ngConnectionStatusTrafficConfiguration.php | 10 +- Compute/src/V1/NetworkPerformanceConfig.php | 2 +- Compute/src/V1/NetworkProfile.php | 20 +- Compute/src/V1/NetworkProfileLocation.php | 4 +- .../src/V1/NetworkProfileNetworkFeatures.php | 44 +- Compute/src/V1/NetworkProfilesClient.php | 34 - .../src/V1/NetworkProfilesListResponse.php | 12 +- Compute/src/V1/NetworkRoutingConfig.php | 12 +- Compute/src/V1/NetworksAddPeeringRequest.php | 8 +- Compute/src/V1/NetworksClient.php | 34 - ...rewallsResponseEffectiveFirewallPolicy.php | 10 +- .../src/V1/NetworksRemovePeeringRequest.php | 2 +- .../NetworksRequestRemovePeeringRequest.php | 2 +- .../src/V1/NetworksUpdatePeeringRequest.php | 2 +- Compute/src/V1/NodeGroup.php | 34 +- Compute/src/V1/NodeGroupAggregatedList.php | 10 +- Compute/src/V1/NodeGroupAutoscalingPolicy.php | 6 +- Compute/src/V1/NodeGroupList.php | 10 +- Compute/src/V1/NodeGroupMaintenanceWindow.php | 4 +- Compute/src/V1/NodeGroupNode.php | 20 +- Compute/src/V1/NodeGroupsAddNodesRequest.php | 2 +- Compute/src/V1/NodeGroupsClient.php | 34 - Compute/src/V1/NodeGroupsListNodes.php | 10 +- .../NodeGroupsPerformMaintenanceRequest.php | 2 +- Compute/src/V1/NodeGroupsScopedList.php | 2 +- .../V1/NodeGroupsSetNodeTemplateRequest.php | 2 +- Compute/src/V1/NodeTemplate.php | 26 +- Compute/src/V1/NodeTemplateAggregatedList.php | 10 +- Compute/src/V1/NodeTemplateList.php | 10 +- .../V1/NodeTemplateNodeTypeFlexibility.php | 6 +- Compute/src/V1/NodeTemplatesClient.php | 34 - Compute/src/V1/NodeTemplatesScopedList.php | 2 +- Compute/src/V1/NodeType.php | 26 +- Compute/src/V1/NodeTypeAggregatedList.php | 10 +- Compute/src/V1/NodeTypeList.php | 10 +- Compute/src/V1/NodeTypesClient.php | 34 - Compute/src/V1/NodeTypesScopedList.php | 2 +- Compute/src/V1/NotificationEndpoint.php | 16 +- .../V1/NotificationEndpointGrpcSettings.php | 10 +- Compute/src/V1/NotificationEndpointList.php | 10 +- Compute/src/V1/Operation.php | 52 +- Compute/src/V1/OperationAggregatedList.php | 10 +- Compute/src/V1/OperationList.php | 10 +- Compute/src/V1/OperationsScopedList.php | 2 +- Compute/src/V1/OutlierDetection.php | 22 +- Compute/src/V1/PacketIntervals.php | 12 +- Compute/src/V1/PacketMirroring.php | 26 +- .../src/V1/PacketMirroringAggregatedList.php | 10 +- Compute/src/V1/PacketMirroringFilter.php | 2 +- .../V1/PacketMirroringForwardingRuleInfo.php | 4 +- Compute/src/V1/PacketMirroringList.php | 10 +- ...roringMirroredResourceInfoInstanceInfo.php | 4 +- ...irroringMirroredResourceInfoSubnetInfo.php | 4 +- Compute/src/V1/PacketMirroringNetworkInfo.php | 4 +- Compute/src/V1/PacketMirroringsClient.php | 34 - Compute/src/V1/PacketMirroringsScopedList.php | 2 +- Compute/src/V1/PatchAutoscalerRequest.php | 10 +- Compute/src/V1/PatchBackendBucketRequest.php | 8 +- Compute/src/V1/PatchBackendServiceRequest.php | 8 +- Compute/src/V1/PatchFirewallPolicyRequest.php | 6 +- Compute/src/V1/PatchFirewallRequest.php | 8 +- Compute/src/V1/PatchForwardingRuleRequest.php | 10 +- .../V1/PatchGlobalForwardingRuleRequest.php | 8 +- ...tchGlobalPublicDelegatedPrefixeRequest.php | 8 +- Compute/src/V1/PatchHealthCheckRequest.php | 8 +- Compute/src/V1/PatchImageRequest.php | 8 +- .../V1/PatchInstanceGroupManagerRequest.php | 10 +- .../src/V1/PatchInstanceSettingRequest.php | 10 +- ...atchInterconnectAttachmentGroupRequest.php | 10 +- .../V1/PatchInterconnectAttachmentRequest.php | 10 +- .../src/V1/PatchInterconnectGroupRequest.php | 10 +- Compute/src/V1/PatchInterconnectRequest.php | 8 +- .../src/V1/PatchNetworkAttachmentRequest.php | 10 +- ...PatchNetworkEdgeSecurityServiceRequest.php | 14 +- .../V1/PatchNetworkFirewallPolicyRequest.php | 8 +- Compute/src/V1/PatchNetworkRequest.php | 8 +- Compute/src/V1/PatchNodeGroupRequest.php | 10 +- .../src/V1/PatchPacketMirroringRequest.php | 10 +- ...roringRuleNetworkFirewallPolicyRequest.php | 10 +- ...anceConfigsInstanceGroupManagerRequest.php | 10 +- ...nfigsRegionInstanceGroupManagerRequest.php | 10 +- .../PatchPublicAdvertisedPrefixeRequest.php | 8 +- .../V1/PatchPublicDelegatedPrefixeRequest.php | 10 +- .../src/V1/PatchRegionAutoscalerRequest.php | 10 +- .../V1/PatchRegionBackendServiceRequest.php | 10 +- .../src/V1/PatchRegionHealthCheckRequest.php | 10 +- .../PatchRegionHealthCheckServiceRequest.php | 10 +- ...PatchRegionInstanceGroupManagerRequest.php | 10 +- ...atchRegionNetworkFirewallPolicyRequest.php | 10 +- .../V1/PatchRegionSecurityPolicyRequest.php | 12 +- .../src/V1/PatchRegionSslPolicyRequest.php | 10 +- .../V1/PatchRegionTargetHttpsProxyRequest.php | 10 +- Compute/src/V1/PatchRegionUrlMapRequest.php | 10 +- Compute/src/V1/PatchResourcePolicyRequest.php | 12 +- .../src/V1/PatchRoutePolicyRouterRequest.php | 10 +- Compute/src/V1/PatchRouterRequest.php | 10 +- .../src/V1/PatchRuleFirewallPolicyRequest.php | 8 +- .../PatchRuleNetworkFirewallPolicyRequest.php | 10 +- ...RuleRegionNetworkFirewallPolicyRequest.php | 12 +- .../PatchRuleRegionSecurityPolicyRequest.php | 14 +- .../src/V1/PatchRuleSecurityPolicyRequest.php | 12 +- Compute/src/V1/PatchSecurityPolicyRequest.php | 10 +- .../src/V1/PatchServiceAttachmentRequest.php | 10 +- .../src/V1/PatchSnapshotSettingRequest.php | 8 +- Compute/src/V1/PatchSslPolicyRequest.php | 8 +- Compute/src/V1/PatchSubnetworkRequest.php | 12 +- .../src/V1/PatchTargetGrpcProxyRequest.php | 8 +- .../src/V1/PatchTargetHttpProxyRequest.php | 8 +- .../src/V1/PatchTargetHttpsProxyRequest.php | 8 +- Compute/src/V1/PatchUrlMapRequest.php | 8 +- Compute/src/V1/PathMatcher.php | 14 +- Compute/src/V1/PathRule.php | 8 +- Compute/src/V1/PerInstanceConfig.php | 8 +- .../V1/PerformMaintenanceInstanceRequest.php | 8 +- .../V1/PerformMaintenanceNodeGroupRequest.php | 10 +- ...formMaintenanceReservationBlockRequest.php | 12 +- .../PerformMaintenanceReservationRequest.php | 10 +- ...mMaintenanceReservationSubBlockRequest.php | 10 +- Compute/src/V1/Policy.php | 6 +- .../src/V1/PreservedStatePreservedDisk.php | 6 +- .../V1/PreservedStatePreservedNetworkIp.php | 4 +- ...servedStatePreservedNetworkIpIpAddress.php | 4 +- Compute/src/V1/PreviewRouterRequest.php | 8 +- Compute/src/V1/Project.php | 26 +- Compute/src/V1/ProjectsClient.php | 34 - .../V1/ProjectsDisableXpnResourceRequest.php | 2 +- .../V1/ProjectsEnableXpnResourceRequest.php | 2 +- Compute/src/V1/ProjectsGetXpnResources.php | 4 +- .../src/V1/ProjectsListXpnHostsRequest.php | 2 +- .../V1/ProjectsSetCloudArmorTierRequest.php | 2 +- .../ProjectsSetDefaultNetworkTierRequest.php | 2 +- Compute/src/V1/PublicAdvertisedPrefix.php | 26 +- Compute/src/V1/PublicAdvertisedPrefixList.php | 10 +- ...cAdvertisedPrefixPublicDelegatedPrefix.php | 10 +- .../src/V1/PublicAdvertisedPrefixesClient.php | 34 - Compute/src/V1/PublicDelegatedPrefix.php | 30 +- .../PublicDelegatedPrefixAggregatedList.php | 10 +- Compute/src/V1/PublicDelegatedPrefixList.php | 10 +- ...elegatedPrefixPublicDelegatedSubPrefix.php | 18 +- .../src/V1/PublicDelegatedPrefixesClient.php | 34 - .../V1/PublicDelegatedPrefixesScopedList.php | 2 +- Compute/src/V1/Quota.php | 8 +- Compute/src/V1/QuotaExceededInfo.php | 10 +- Compute/src/V1/QuotaStatusWarning.php | 4 +- Compute/src/V1/README.md | 15 - Compute/src/V1/RawDisk.php | 6 +- ...teInstancesInstanceGroupManagerRequest.php | 10 +- ...ancesRegionInstanceGroupManagerRequest.php | 10 +- Compute/src/V1/Reference.php | 8 +- Compute/src/V1/Region.php | 20 +- Compute/src/V1/RegionAddressesMoveRequest.php | 4 +- Compute/src/V1/RegionAutoscalerList.php | 10 +- Compute/src/V1/RegionAutoscalersClient.php | 34 - .../src/V1/RegionBackendServicesClient.php | 34 - Compute/src/V1/RegionCommitmentsClient.php | 34 - Compute/src/V1/RegionDiskTypeList.php | 10 +- Compute/src/V1/RegionDiskTypesClient.php | 34 - Compute/src/V1/RegionDisksClient.php | 34 - Compute/src/V1/RegionDisksResizeRequest.php | 2 +- ...egionDisksStartAsyncReplicationRequest.php | 2 +- .../V1/RegionHealthCheckServicesClient.php | 34 - Compute/src/V1/RegionHealthChecksClient.php | 34 - Compute/src/V1/RegionInstanceGroupList.php | 10 +- .../src/V1/RegionInstanceGroupManagerList.php | 10 +- ...stanceGroupManagersApplyUpdatesRequest.php | 6 +- .../V1/RegionInstanceGroupManagersClient.php | 34 - ...nceGroupManagersDeleteInstancesRequest.php | 2 +- ...nstanceGroupManagersListErrorsResponse.php | 2 +- ...ceGroupManagersListInstanceConfigsResp.php | 4 +- ...anceGroupManagersListInstancesResponse.php | 2 +- ...anceGroupManagersSetTargetPoolsRequest.php | 2 +- ...nstanceGroupManagersSetTemplateRequest.php | 2 +- ...tanceGroupManagersStopInstancesRequest.php | 2 +- ...ceGroupManagersSuspendInstancesRequest.php | 2 +- Compute/src/V1/RegionInstanceGroupsClient.php | 34 - .../V1/RegionInstanceGroupsListInstances.php | 10 +- ...gionInstanceGroupsListInstancesRequest.php | 4 +- ...gionInstanceGroupsSetNamedPortsRequest.php | 2 +- .../src/V1/RegionInstanceTemplatesClient.php | 34 - Compute/src/V1/RegionInstancesClient.php | 34 - .../src/V1/RegionInstantSnapshotsClient.php | 34 - Compute/src/V1/RegionList.php | 10 +- .../V1/RegionNetworkEndpointGroupsClient.php | 34 - .../RegionNetworkFirewallPoliciesClient.php | 34 - ...rewallsResponseEffectiveFirewallPolicy.php | 8 +- .../V1/RegionNotificationEndpointsClient.php | 34 - Compute/src/V1/RegionOperationsClient.php | 34 - .../src/V1/RegionSecurityPoliciesClient.php | 34 - Compute/src/V1/RegionSetLabelsRequest.php | 2 +- Compute/src/V1/RegionSetPolicyRequest.php | 4 +- .../src/V1/RegionSslCertificatesClient.php | 34 - Compute/src/V1/RegionSslPoliciesClient.php | 34 - .../src/V1/RegionTargetHttpProxiesClient.php | 34 - .../src/V1/RegionTargetHttpsProxiesClient.php | 34 - .../src/V1/RegionTargetTcpProxiesClient.php | 34 - Compute/src/V1/RegionUrlMapsClient.php | 34 - .../src/V1/RegionUrlMapsValidateRequest.php | 2 +- Compute/src/V1/RegionZonesClient.php | 34 - Compute/src/V1/RegionsClient.php | 34 - ...RemoveAssociationFirewallPolicyRequest.php | 6 +- ...ssociationNetworkFirewallPolicyRequest.php | 8 +- ...tionRegionNetworkFirewallPolicyRequest.php | 10 +- .../V1/RemoveHealthCheckTargetPoolRequest.php | 10 +- .../V1/RemoveInstanceTargetPoolRequest.php | 10 +- .../RemoveInstancesInstanceGroupRequest.php | 10 +- ...roringRuleNetworkFirewallPolicyRequest.php | 8 +- .../src/V1/RemovePeeringNetworkRequest.php | 8 +- .../V1/RemoveResourcePoliciesDiskRequest.php | 10 +- .../RemoveResourcePoliciesInstanceRequest.php | 10 +- ...emoveResourcePoliciesRegionDiskRequest.php | 10 +- .../V1/RemoveRuleFirewallPolicyRequest.php | 6 +- ...RemoveRuleNetworkFirewallPolicyRequest.php | 8 +- ...RuleRegionNetworkFirewallPolicyRequest.php | 10 +- .../RemoveRuleRegionSecurityPolicyRequest.php | 8 +- .../V1/RemoveRuleSecurityPolicyRequest.php | 6 +- .../V1/ReportHostAsFaultyInstanceRequest.php | 10 +- Compute/src/V1/RequestMirrorPolicy.php | 2 +- .../V1/RequestRemovePeeringNetworkRequest.php | 8 +- Compute/src/V1/Reservation.php | 44 +- .../ReservationAdvancedDeploymentControl.php | 2 +- Compute/src/V1/ReservationAffinity.php | 4 +- Compute/src/V1/ReservationAggregatedList.php | 10 +- Compute/src/V1/ReservationBlock.php | 30 +- Compute/src/V1/ReservationBlockHealthInfo.php | 6 +- .../V1/ReservationBlockPhysicalTopology.php | 4 +- ...servationBlockPhysicalTopologyInstance.php | 6 +- ...alTopologyInstancePhysicalHostTopology.php | 4 +- Compute/src/V1/ReservationBlocksClient.php | 34 - .../src/V1/ReservationBlocksGetResponse.php | 2 +- .../src/V1/ReservationBlocksListResponse.php | 10 +- Compute/src/V1/ReservationList.php | 10 +- Compute/src/V1/ReservationSubBlock.php | 26 +- .../src/V1/ReservationSubBlockHealthInfo.php | 10 +- .../ReservationSubBlockPhysicalTopology.php | 6 +- Compute/src/V1/ReservationSubBlocksClient.php | 34 - .../V1/ReservationSubBlocksGetResponse.php | 2 +- .../V1/ReservationSubBlocksListResponse.php | 10 +- ...vationsBlocksPerformMaintenanceRequest.php | 2 +- Compute/src/V1/ReservationsClient.php | 34 - .../ReservationsPerformMaintenanceRequest.php | 2 +- Compute/src/V1/ReservationsResizeRequest.php | 2 +- Compute/src/V1/ReservationsScopedList.php | 2 +- Compute/src/V1/ResetInstanceRequest.php | 8 +- Compute/src/V1/ResizeDiskRequest.php | 10 +- .../V1/ResizeInstanceGroupManagerRequest.php | 10 +- Compute/src/V1/ResizeRegionDiskRequest.php | 10 +- ...esizeRegionInstanceGroupManagerRequest.php | 10 +- Compute/src/V1/ResizeReservationRequest.php | 10 +- Compute/src/V1/ResourceCommitment.php | 6 +- Compute/src/V1/ResourceGroupReference.php | 2 +- Compute/src/V1/ResourcePoliciesClient.php | 34 - Compute/src/V1/ResourcePoliciesScopedList.php | 2 +- Compute/src/V1/ResourcePolicy.php | 28 +- .../src/V1/ResourcePolicyAggregatedList.php | 12 +- Compute/src/V1/ResourcePolicyDailyCycle.php | 6 +- .../V1/ResourcePolicyGroupPlacementPolicy.php | 8 +- Compute/src/V1/ResourcePolicyHourlyCycle.php | 6 +- .../ResourcePolicyInstanceSchedulePolicy.php | 10 +- ...cePolicyInstanceSchedulePolicySchedule.php | 2 +- Compute/src/V1/ResourcePolicyList.php | 12 +- .../src/V1/ResourcePolicyResourceStatus.php | 2 +- ...urceStatusInstanceSchedulePolicyStatus.php | 4 +- .../ResourcePolicySnapshotSchedulePolicy.php | 6 +- ...ySnapshotSchedulePolicyRetentionPolicy.php | 4 +- ...cePolicySnapshotSchedulePolicySchedule.php | 6 +- ...apshotSchedulePolicySnapshotProperties.php | 4 +- .../V1/ResourcePolicyWeeklyCycleDayOfWeek.php | 6 +- .../src/V1/ResourcePolicyWorkloadPolicy.php | 6 +- Compute/src/V1/ResourceStatus.php | 10 +- ...esourceStatusEffectiveInstanceMetadata.php | 16 +- .../V1/ResourceStatusPhysicalHostTopology.php | 8 +- Compute/src/V1/ResourceStatusScheduling.php | 2 +- Compute/src/V1/ResumeInstanceRequest.php | 8 +- ...meInstancesInstanceGroupManagerRequest.php | 10 +- ...ancesRegionInstanceGroupManagerRequest.php | 10 +- Compute/src/V1/Route.php | 46 +- Compute/src/V1/RouteAsPath.php | 2 +- Compute/src/V1/RouteList.php | 10 +- Compute/src/V1/RoutePolicy.php | 8 +- Compute/src/V1/RoutePolicyPolicyTerm.php | 4 +- Compute/src/V1/Router.php | 20 +- Compute/src/V1/RouterAdvertisedIpRange.php | 4 +- Compute/src/V1/RouterAggregatedList.php | 10 +- Compute/src/V1/RouterBgp.php | 8 +- Compute/src/V1/RouterBgpPeer.php | 38 +- Compute/src/V1/RouterBgpPeerBfd.php | 8 +- .../V1/RouterBgpPeerCustomLearnedIpRange.php | 2 +- Compute/src/V1/RouterInterface.php | 18 +- Compute/src/V1/RouterList.php | 10 +- Compute/src/V1/RouterMd5AuthenticationKey.php | 4 +- Compute/src/V1/RouterNat.php | 32 +- Compute/src/V1/RouterNatLogConfig.php | 4 +- Compute/src/V1/RouterNatRule.php | 8 +- Compute/src/V1/RouterNatSubnetworkToNat.php | 2 +- Compute/src/V1/RouterNatSubnetworkToNat64.php | 2 +- Compute/src/V1/RouterStatus.php | 2 +- Compute/src/V1/RouterStatusBgpPeerStatus.php | 38 +- Compute/src/V1/RouterStatusNatStatus.php | 6 +- .../V1/RouterStatusNatStatusNatRuleStatus.php | 6 +- Compute/src/V1/RouterStatusResponse.php | 4 +- Compute/src/V1/RoutersClient.php | 34 - .../src/V1/RoutersGetRoutePolicyResponse.php | 2 +- Compute/src/V1/RoutersListBgpRoutes.php | 12 +- Compute/src/V1/RoutersListRoutePolicies.php | 12 +- Compute/src/V1/RoutersPreviewResponse.php | 2 +- Compute/src/V1/RoutersScopedList.php | 2 +- Compute/src/V1/RoutesClient.php | 34 - Compute/src/V1/Rule.php | 295 - Compute/src/V1/Rule/Action.php | 90 - Compute/src/V1/SSLHealthCheck.php | 12 +- Compute/src/V1/SavedAttachedDisk.php | 28 +- Compute/src/V1/SavedDisk.php | 10 +- Compute/src/V1/ScalingScheduleStatus.php | 6 +- Compute/src/V1/Scheduling.php | 26 +- Compute/src/V1/SchedulingNodeAffinity.php | 4 +- .../src/V1/SchedulingOnInstanceStopAction.php | 2 +- Compute/src/V1/ScratchDisks.php | 76 - Compute/src/V1/Screenshot.php | 4 +- .../src/V1/SecurityPoliciesAggregatedList.php | 12 +- Compute/src/V1/SecurityPoliciesClient.php | 34 - ...istPreconfiguredExpressionSetsResponse.php | 2 +- Compute/src/V1/SecurityPoliciesScopedList.php | 2 +- Compute/src/V1/SecurityPoliciesWafConfig.php | 2 +- Compute/src/V1/SecurityPolicy.php | 28 +- ...SecurityPolicyAdaptiveProtectionConfig.php | 2 +- ...rotectionConfigLayer7DdosDefenseConfig.php | 4 +- ...Layer7DdosDefenseConfigThresholdConfig.php | 16 +- ...hresholdConfigTrafficGranularityConfig.php | 6 +- .../SecurityPolicyAdvancedOptionsConfig.php | 6 +- .../V1/SecurityPolicyDdosProtectionConfig.php | 2 +- Compute/src/V1/SecurityPolicyList.php | 8 +- .../SecurityPolicyRecaptchaOptionsConfig.php | 2 +- Compute/src/V1/SecurityPolicyReference.php | 2 +- Compute/src/V1/SecurityPolicyRule.php | 22 +- ...cyRuleHttpHeaderActionHttpHeaderOption.php | 4 +- Compute/src/V1/SecurityPolicyRuleMatcher.php | 8 +- .../SecurityPolicyRuleMatcherExprOptions.php | 2 +- ...uleNetworkMatcherUserDefinedFieldMatch.php | 2 +- ...icyRulePreconfiguredWafConfigExclusion.php | 2 +- ...onfiguredWafConfigExclusionFieldParams.php | 4 +- .../V1/SecurityPolicyRuleRateLimitOptions.php | 16 +- ...RuleRateLimitOptionsEnforceOnKeyConfig.php | 4 +- ...ityPolicyRuleRateLimitOptionsThreshold.php | 4 +- .../V1/SecurityPolicyRuleRedirectOptions.php | 4 +- .../src/V1/SecurityPolicyUserDefinedField.php | 10 +- Compute/src/V1/SecuritySettings.php | 4 +- ...SendDiagnosticInterruptInstanceRequest.php | 6 +- Compute/src/V1/SerialPortOutput.php | 10 +- Compute/src/V1/ServerBinding.php | 2 +- Compute/src/V1/ServiceAccount.php | 2 +- Compute/src/V1/ServiceAttachment.php | 30 +- .../V1/ServiceAttachmentAggregatedList.php | 10 +- .../V1/ServiceAttachmentConnectedEndpoint.php | 10 +- .../ServiceAttachmentConsumerProjectLimit.php | 6 +- Compute/src/V1/ServiceAttachmentList.php | 10 +- Compute/src/V1/ServiceAttachmentsClient.php | 34 - .../src/V1/ServiceAttachmentsScopedList.php | 2 +- ...SetBackendServiceTargetSslProxyRequest.php | 8 +- ...SetBackendServiceTargetTcpProxyRequest.php | 8 +- Compute/src/V1/SetBackupTargetPoolRequest.php | 12 +- ...tCertificateMapTargetHttpsProxyRequest.php | 8 +- ...SetCertificateMapTargetSslProxyRequest.php | 8 +- .../V1/SetCloudArmorTierProjectRequest.php | 6 +- ...ommonInstanceMetadataOperationMetadata.php | 2 +- ...rationMetadataPerLocationOperationInfo.php | 4 +- ...etCommonInstanceMetadataProjectRequest.php | 6 +- .../SetDefaultNetworkTierProjectRequest.php | 6 +- .../SetDeletionProtectionInstanceRequest.php | 10 +- .../V1/SetDiskAutoDeleteInstanceRequest.php | 12 +- ...EdgeSecurityPolicyBackendBucketRequest.php | 8 +- ...dgeSecurityPolicyBackendServiceRequest.php | 8 +- .../V1/SetIamPolicyBackendBucketRequest.php | 6 +- .../V1/SetIamPolicyBackendServiceRequest.php | 6 +- Compute/src/V1/SetIamPolicyDiskRequest.php | 8 +- .../V1/SetIamPolicyFirewallPolicyRequest.php | 4 +- Compute/src/V1/SetIamPolicyImageRequest.php | 6 +- .../src/V1/SetIamPolicyInstanceRequest.php | 8 +- .../SetIamPolicyInstanceTemplateRequest.php | 6 +- .../V1/SetIamPolicyInstantSnapshotRequest.php | 8 +- ...licyInterconnectAttachmentGroupRequest.php | 6 +- .../SetIamPolicyInterconnectGroupRequest.php | 6 +- Compute/src/V1/SetIamPolicyLicenseRequest.php | 6 +- .../V1/SetIamPolicyMachineImageRequest.php | 6 +- .../SetIamPolicyNetworkAttachmentRequest.php | 8 +- ...tIamPolicyNetworkFirewallPolicyRequest.php | 6 +- .../src/V1/SetIamPolicyNodeGroupRequest.php | 8 +- .../V1/SetIamPolicyNodeTemplateRequest.php | 8 +- ...etIamPolicyRegionBackendServiceRequest.php | 8 +- .../src/V1/SetIamPolicyRegionDiskRequest.php | 8 +- ...tIamPolicyRegionInstantSnapshotRequest.php | 8 +- ...licyRegionNetworkFirewallPolicyRequest.php | 8 +- .../src/V1/SetIamPolicyReservationRequest.php | 8 +- .../V1/SetIamPolicyResourcePolicyRequest.php | 8 +- .../SetIamPolicyServiceAttachmentRequest.php | 8 +- .../src/V1/SetIamPolicySnapshotRequest.php | 6 +- .../src/V1/SetIamPolicyStoragePoolRequest.php | 8 +- .../src/V1/SetIamPolicySubnetworkRequest.php | 8 +- ...nceTemplateInstanceGroupManagerRequest.php | 10 +- ...plateRegionInstanceGroupManagerRequest.php | 10 +- Compute/src/V1/SetLabelsAddressRequest.php | 10 +- Compute/src/V1/SetLabelsDiskRequest.php | 10 +- .../V1/SetLabelsExternalVpnGatewayRequest.php | 6 +- .../src/V1/SetLabelsForwardingRuleRequest.php | 10 +- .../src/V1/SetLabelsGlobalAddressRequest.php | 6 +- .../SetLabelsGlobalForwardingRuleRequest.php | 6 +- Compute/src/V1/SetLabelsImageRequest.php | 6 +- Compute/src/V1/SetLabelsInstanceRequest.php | 10 +- .../V1/SetLabelsInstantSnapshotRequest.php | 10 +- ...SetLabelsInterconnectAttachmentRequest.php | 10 +- .../src/V1/SetLabelsInterconnectRequest.php | 6 +- .../src/V1/SetLabelsMachineImageRequest.php | 6 +- Compute/src/V1/SetLabelsRegionDiskRequest.php | 10 +- .../SetLabelsRegionInstantSnapshotRequest.php | 10 +- .../SetLabelsRegionSecurityPolicyRequest.php | 10 +- .../src/V1/SetLabelsSecurityPolicyRequest.php | 6 +- Compute/src/V1/SetLabelsSnapshotRequest.php | 6 +- .../V1/SetLabelsTargetVpnGatewayRequest.php | 10 +- Compute/src/V1/SetLabelsVpnGatewayRequest.php | 10 +- Compute/src/V1/SetLabelsVpnTunnelRequest.php | 10 +- .../V1/SetMachineResourcesInstanceRequest.php | 10 +- .../src/V1/SetMachineTypeInstanceRequest.php | 10 +- Compute/src/V1/SetMetadataInstanceRequest.php | 10 +- .../V1/SetMinCpuPlatformInstanceRequest.php | 10 +- Compute/src/V1/SetNameInstanceRequest.php | 10 +- .../V1/SetNamedPortsInstanceGroupRequest.php | 10 +- ...etNamedPortsRegionInstanceGroupRequest.php | 10 +- .../V1/SetNodeTemplateNodeGroupRequest.php | 10 +- ...PrivateIpGoogleAccessSubnetworkRequest.php | 10 +- .../SetProxyHeaderTargetSslProxyRequest.php | 8 +- .../SetProxyHeaderTargetTcpProxyRequest.php | 8 +- ...SetQuicOverrideTargetHttpsProxyRequest.php | 8 +- .../src/V1/SetSchedulingInstanceRequest.php | 10 +- ...SetSecurityPolicyBackendServiceRequest.php | 8 +- .../V1/SetSecurityPolicyInstanceRequest.php | 10 +- ...urityPolicyRegionBackendServiceRequest.php | 10 +- ...SetSecurityPolicyTargetInstanceRequest.php | 10 +- .../V1/SetSecurityPolicyTargetPoolRequest.php | 10 +- .../V1/SetServiceAccountInstanceRequest.php | 10 +- ...InstanceIntegrityPolicyInstanceRequest.php | 10 +- ...tificatesRegionTargetHttpsProxyRequest.php | 10 +- ...SslCertificatesTargetHttpsProxyRequest.php | 8 +- ...etSslCertificatesTargetSslProxyRequest.php | 8 +- .../SetSslPolicyTargetHttpsProxyRequest.php | 8 +- .../V1/SetSslPolicyTargetSslProxyRequest.php | 8 +- Compute/src/V1/SetTagsInstanceRequest.php | 10 +- .../src/V1/SetTargetForwardingRuleRequest.php | 10 +- .../SetTargetGlobalForwardingRuleRequest.php | 8 +- ...TargetPoolsInstanceGroupManagerRequest.php | 10 +- ...PoolsRegionInstanceGroupManagerRequest.php | 10 +- .../SetUrlMapRegionTargetHttpProxyRequest.php | 10 +- ...SetUrlMapRegionTargetHttpsProxyRequest.php | 10 +- .../V1/SetUrlMapTargetHttpProxyRequest.php | 8 +- .../V1/SetUrlMapTargetHttpsProxyRequest.php | 8 +- .../V1/SetUsageExportBucketProjectRequest.php | 6 +- Compute/src/V1/ShareSettings.php | 2 +- Compute/src/V1/ShareSettingsProjectConfig.php | 2 +- Compute/src/V1/ShieldedInstanceConfig.php | 6 +- Compute/src/V1/ShieldedInstanceIdentity.php | 6 +- .../src/V1/ShieldedInstanceIdentityEntry.php | 4 +- .../V1/ShieldedInstanceIntegrityPolicy.php | 2 +- Compute/src/V1/SignedUrlKey.php | 4 +- ...imulateMaintenanceEventInstanceRequest.php | 10 +- ...mulateMaintenanceEventNodeGroupRequest.php | 10 +- Compute/src/V1/Snapshot.php | 64 +- Compute/src/V1/SnapshotList.php | 10 +- Compute/src/V1/SnapshotSettings.php | 2 +- .../src/V1/SnapshotSettingsServiceClient.php | 34 - ...napshotSettingsStorageLocationSettings.php | 2 +- ...ationSettingsStorageLocationPreference.php | 2 +- Compute/src/V1/SnapshotsClient.php | 34 - Compute/src/V1/SourceDiskEncryptionKey.php | 4 +- Compute/src/V1/SourceInstanceProperties.php | 18 +- Compute/src/V1/SslCertificate.php | 28 +- .../src/V1/SslCertificateAggregatedList.php | 10 +- Compute/src/V1/SslCertificateList.php | 10 +- .../SslCertificateManagedSslCertificate.php | 10 +- ...slCertificateSelfManagedSslCertificate.php | 4 +- Compute/src/V1/SslCertificatesClient.php | 34 - Compute/src/V1/SslCertificatesScopedList.php | 2 +- Compute/src/V1/SslPoliciesAggregatedList.php | 12 +- Compute/src/V1/SslPoliciesClient.php | 34 - Compute/src/V1/SslPoliciesList.php | 10 +- Compute/src/V1/SslPoliciesScopedList.php | 2 +- Compute/src/V1/SslPolicy.php | 20 +- Compute/src/V1/SslPolicyReference.php | 2 +- .../V1/StartAsyncReplicationDiskRequest.php | 10 +- ...StartAsyncReplicationRegionDiskRequest.php | 10 +- Compute/src/V1/StartInstanceRequest.php | 8 +- ...rtInstancesInstanceGroupManagerRequest.php | 10 +- ...ancesRegionInstanceGroupManagerRequest.php | 10 +- .../StartWithEncryptionKeyInstanceRequest.php | 10 +- Compute/src/V1/StatefulPolicy.php | 2 +- ...StatefulPolicyPreservedStateDiskDevice.php | 2 +- .../StatefulPolicyPreservedStateNetworkIp.php | 2 +- Compute/src/V1/Status.php | 4 +- .../V1/StopAsyncReplicationDiskRequest.php | 8 +- .../StopAsyncReplicationRegionDiskRequest.php | 8 +- .../StopGroupAsyncReplicationDiskRequest.php | 8 +- ...GroupAsyncReplicationRegionDiskRequest.php | 8 +- Compute/src/V1/StopInstanceRequest.php | 10 +- ...opInstancesInstanceGroupManagerRequest.php | 10 +- ...ancesRegionInstanceGroupManagerRequest.php | 10 +- Compute/src/V1/StoragePool.php | 36 +- Compute/src/V1/StoragePoolAggregatedList.php | 12 +- Compute/src/V1/StoragePoolDisk.php | 18 +- Compute/src/V1/StoragePoolList.php | 12 +- Compute/src/V1/StoragePoolListDisks.php | 12 +- Compute/src/V1/StoragePoolResourceStatus.php | 20 +- Compute/src/V1/StoragePoolType.php | 32 +- .../src/V1/StoragePoolTypeAggregatedList.php | 10 +- Compute/src/V1/StoragePoolTypeList.php | 10 +- Compute/src/V1/StoragePoolTypesClient.php | 34 - Compute/src/V1/StoragePoolTypesScopedList.php | 2 +- Compute/src/V1/StoragePoolsClient.php | 34 - Compute/src/V1/StoragePoolsScopedList.php | 2 +- Compute/src/V1/Subnetwork.php | 54 +- Compute/src/V1/SubnetworkAggregatedList.php | 10 +- Compute/src/V1/SubnetworkList.php | 10 +- Compute/src/V1/SubnetworkLogConfig.php | 10 +- Compute/src/V1/SubnetworkSecondaryRange.php | 6 +- Compute/src/V1/SubnetworksClient.php | 34 - .../SubnetworksExpandIpCidrRangeRequest.php | 2 +- Compute/src/V1/SubnetworksScopedList.php | 2 +- Compute/src/V1/SubnetworksScopedWarning.php | 4 +- ...etworksSetPrivateIpGoogleAccessRequest.php | 2 +- Compute/src/V1/Subsetting.php | 2 +- Compute/src/V1/SuspendInstanceRequest.php | 10 +- ...ndInstancesInstanceGroupManagerRequest.php | 10 +- ...ancesRegionInstanceGroupManagerRequest.php | 10 +- .../V1/SwitchToCustomModeNetworkRequest.php | 6 +- Compute/src/V1/TCPHealthCheck.php | 12 +- Compute/src/V1/Tags.php | 2 +- Compute/src/V1/TargetGrpcProxiesClient.php | 34 - Compute/src/V1/TargetGrpcProxy.php | 20 +- Compute/src/V1/TargetGrpcProxyList.php | 10 +- Compute/src/V1/TargetHttpProxiesClient.php | 34 - .../src/V1/TargetHttpProxiesScopedList.php | 2 +- Compute/src/V1/TargetHttpProxy.php | 24 +- .../src/V1/TargetHttpProxyAggregatedList.php | 8 +- Compute/src/V1/TargetHttpProxyList.php | 10 +- Compute/src/V1/TargetHttpsProxiesClient.php | 34 - .../src/V1/TargetHttpsProxiesScopedList.php | 2 +- ...etHttpsProxiesSetCertificateMapRequest.php | 2 +- ...rgetHttpsProxiesSetQuicOverrideRequest.php | 2 +- Compute/src/V1/TargetHttpsProxy.php | 36 +- .../src/V1/TargetHttpsProxyAggregatedList.php | 10 +- Compute/src/V1/TargetHttpsProxyList.php | 10 +- Compute/src/V1/TargetInstance.php | 22 +- .../src/V1/TargetInstanceAggregatedList.php | 10 +- Compute/src/V1/TargetInstanceList.php | 10 +- Compute/src/V1/TargetInstancesClient.php | 34 - Compute/src/V1/TargetInstancesScopedList.php | 2 +- Compute/src/V1/TargetPool.php | 22 +- Compute/src/V1/TargetPoolAggregatedList.php | 10 +- Compute/src/V1/TargetPoolInstanceHealth.php | 2 +- Compute/src/V1/TargetPoolList.php | 10 +- Compute/src/V1/TargetPoolsClient.php | 34 - Compute/src/V1/TargetPoolsScopedList.php | 2 +- Compute/src/V1/TargetReference.php | 2 +- Compute/src/V1/TargetSslProxiesClient.php | 34 - ...rgetSslProxiesSetBackendServiceRequest.php | 2 +- ...rgetSslProxiesSetCertificateMapRequest.php | 2 +- .../TargetSslProxiesSetProxyHeaderRequest.php | 2 +- Compute/src/V1/TargetSslProxy.php | 20 +- Compute/src/V1/TargetSslProxyList.php | 10 +- Compute/src/V1/TargetTcpProxiesClient.php | 34 - Compute/src/V1/TargetTcpProxiesScopedList.php | 2 +- ...rgetTcpProxiesSetBackendServiceRequest.php | 2 +- .../TargetTcpProxiesSetProxyHeaderRequest.php | 2 +- Compute/src/V1/TargetTcpProxy.php | 20 +- .../src/V1/TargetTcpProxyAggregatedList.php | 10 +- Compute/src/V1/TargetTcpProxyList.php | 10 +- Compute/src/V1/TargetVpnGateway.php | 20 +- .../src/V1/TargetVpnGatewayAggregatedList.php | 10 +- Compute/src/V1/TargetVpnGatewayList.php | 10 +- Compute/src/V1/TargetVpnGatewaysClient.php | 34 - .../src/V1/TargetVpnGatewaysScopedList.php | 2 +- Compute/src/V1/TestFailure.php | 16 +- ...TestIamPermissionsBackendBucketRequest.php | 6 +- ...estIamPermissionsBackendServiceRequest.php | 6 +- .../src/V1/TestIamPermissionsDiskRequest.php | 8 +- ...amPermissionsExternalVpnGatewayRequest.php | 6 +- ...estIamPermissionsFirewallPolicyRequest.php | 4 +- .../src/V1/TestIamPermissionsImageRequest.php | 6 +- .../V1/TestIamPermissionsInstanceRequest.php | 8 +- ...tIamPermissionsInstanceTemplateRequest.php | 6 +- ...stIamPermissionsInstantSnapshotRequest.php | 8 +- ...ionsInterconnectAttachmentGroupRequest.php | 6 +- ...IamPermissionsInterconnectGroupRequest.php | 6 +- .../TestIamPermissionsLicenseCodeRequest.php | 6 +- .../V1/TestIamPermissionsLicenseRequest.php | 6 +- .../TestIamPermissionsMachineImageRequest.php | 6 +- ...IamPermissionsNetworkAttachmentRequest.php | 8 +- ...PermissionsNetworkEndpointGroupRequest.php | 8 +- ...ermissionsNetworkFirewallPolicyRequest.php | 6 +- .../V1/TestIamPermissionsNodeGroupRequest.php | 8 +- .../TestIamPermissionsNodeTemplateRequest.php | 8 +- ...stIamPermissionsPacketMirroringRequest.php | 8 +- ...PermissionsRegionBackendServiceRequest.php | 8 +- .../TestIamPermissionsRegionDiskRequest.php | 8 +- ...ermissionsRegionInstantSnapshotRequest.php | 8 +- ...ionsRegionNetworkFirewallPolicyRequest.php | 8 +- .../TestIamPermissionsReservationRequest.php | 8 +- ...estIamPermissionsResourcePolicyRequest.php | 8 +- ...IamPermissionsServiceAttachmentRequest.php | 8 +- .../V1/TestIamPermissionsSnapshotRequest.php | 6 +- .../TestIamPermissionsStoragePoolRequest.php | 8 +- .../TestIamPermissionsSubnetworkRequest.php | 8 +- .../TestIamPermissionsVpnGatewayRequest.php | 8 +- Compute/src/V1/Uint128.php | 4 +- Compute/src/V1/UpcomingMaintenance.php | 14 +- .../V1/UpdateAccessConfigInstanceRequest.php | 12 +- Compute/src/V1/UpdateAutoscalerRequest.php | 10 +- Compute/src/V1/UpdateBackendBucketRequest.php | 8 +- .../src/V1/UpdateBackendServiceRequest.php | 8 +- Compute/src/V1/UpdateDiskRequest.php | 14 +- .../V1/UpdateDisplayDeviceInstanceRequest.php | 10 +- Compute/src/V1/UpdateFirewallRequest.php | 8 +- Compute/src/V1/UpdateHealthCheckRequest.php | 8 +- Compute/src/V1/UpdateInstanceRequest.php | 14 +- Compute/src/V1/UpdateLicenseRequest.php | 10 +- .../UpdateNetworkInterfaceInstanceRequest.php | 12 +- .../src/V1/UpdatePeeringNetworkRequest.php | 8 +- ...anceConfigsInstanceGroupManagerRequest.php | 10 +- ...nfigsRegionInstanceGroupManagerRequest.php | 10 +- .../src/V1/UpdateRegionAutoscalerRequest.php | 10 +- .../V1/UpdateRegionBackendServiceRequest.php | 10 +- .../src/V1/UpdateRegionCommitmentRequest.php | 14 +- Compute/src/V1/UpdateRegionDiskRequest.php | 14 +- .../src/V1/UpdateRegionHealthCheckRequest.php | 10 +- Compute/src/V1/UpdateRegionUrlMapRequest.php | 10 +- Compute/src/V1/UpdateReservationRequest.php | 14 +- .../src/V1/UpdateRoutePolicyRouterRequest.php | 10 +- Compute/src/V1/UpdateRouterRequest.php | 10 +- ...eShieldedInstanceConfigInstanceRequest.php | 10 +- Compute/src/V1/UpdateStoragePoolRequest.php | 12 +- Compute/src/V1/UpdateUrlMapRequest.php | 8 +- Compute/src/V1/UrlMap.php | 28 +- Compute/src/V1/UrlMapList.php | 10 +- Compute/src/V1/UrlMapReference.php | 2 +- Compute/src/V1/UrlMapTest.php | 12 +- Compute/src/V1/UrlMapTestHeader.php | 4 +- Compute/src/V1/UrlMapValidationResult.php | 4 +- Compute/src/V1/UrlMapsAggregatedList.php | 10 +- Compute/src/V1/UrlMapsClient.php | 34 - Compute/src/V1/UrlMapsScopedList.php | 2 +- Compute/src/V1/UrlMapsValidateRequest.php | 2 +- Compute/src/V1/UrlMapsValidateResponse.php | 2 +- Compute/src/V1/UrlRewrite.php | 6 +- Compute/src/V1/UsableSubnetwork.php | 18 +- .../src/V1/UsableSubnetworkSecondaryRange.php | 4 +- .../V1/UsableSubnetworksAggregatedList.php | 10 +- Compute/src/V1/UsageExportLocation.php | 4 +- .../src/V1/ValidateRegionUrlMapRequest.php | 8 +- Compute/src/V1/ValidateUrlMapRequest.php | 6 +- Compute/src/V1/VmEndpointNatMappings.php | 2 +- ...ndpointNatMappingsInterfaceNatMappings.php | 8 +- ...ngsInterfaceNatMappingsNatRuleMappings.php | 6 +- Compute/src/V1/VmEndpointNatMappingsList.php | 10 +- Compute/src/V1/VpnGateway.php | 22 +- Compute/src/V1/VpnGatewayAggregatedList.php | 10 +- Compute/src/V1/VpnGatewayList.php | 10 +- ...StatusHighAvailabilityRequirementState.php | 4 +- Compute/src/V1/VpnGatewayStatusTunnel.php | 6 +- .../src/V1/VpnGatewayStatusVpnConnection.php | 6 +- .../src/V1/VpnGatewayVpnGatewayInterface.php | 8 +- Compute/src/V1/VpnGatewaysClient.php | 34 - .../src/V1/VpnGatewaysGetStatusResponse.php | 2 +- Compute/src/V1/VpnGatewaysScopedList.php | 2 +- Compute/src/V1/VpnTunnel.php | 42 +- Compute/src/V1/VpnTunnelAggregatedList.php | 10 +- Compute/src/V1/VpnTunnelList.php | 10 +- Compute/src/V1/VpnTunnelsClient.php | 34 - Compute/src/V1/VpnTunnelsScopedList.php | 2 +- Compute/src/V1/WafExpressionSet.php | 2 +- Compute/src/V1/WafExpressionSetExpression.php | 4 +- Compute/src/V1/WaitGlobalOperationRequest.php | 4 +- Compute/src/V1/WaitRegionOperationRequest.php | 6 +- Compute/src/V1/WaitZoneOperationRequest.php | 6 +- Compute/src/V1/Warning.php | 4 +- Compute/src/V1/Warnings.php | 4 +- Compute/src/V1/WeightedBackendService.php | 6 +- ...WithdrawPublicAdvertisedPrefixeRequest.php | 6 +- .../WithdrawPublicDelegatedPrefixeRequest.php | 8 +- Compute/src/V1/XpnHostList.php | 10 +- Compute/src/V1/XpnResourceId.php | 4 +- Compute/src/V1/Zone.php | 20 +- Compute/src/V1/ZoneList.php | 10 +- Compute/src/V1/ZoneOperationsClient.php | 34 - Compute/src/V1/ZoneSetLabelsRequest.php | 2 +- Compute/src/V1/ZoneSetPolicyRequest.php | 4 +- Compute/src/V1/ZonesClient.php | 34 - .../accelerator_types_descriptor_config.php | 2 +- .../accelerator_types_rest_client_config.php | 2 +- .../resources/addresses_descriptor_config.php | 2 +- .../addresses_rest_client_config.php | 2 +- .../autoscalers_descriptor_config.php | 2 +- .../autoscalers_rest_client_config.php | 2 +- .../backend_buckets_descriptor_config.php | 2 +- .../backend_buckets_rest_client_config.php | 2 +- .../backend_services_descriptor_config.php | 2 +- .../backend_services_rest_client_config.php | 2 +- .../disk_types_descriptor_config.php | 2 +- .../disk_types_rest_client_config.php | 2 +- .../V1/resources/disks_descriptor_config.php | 2 +- .../V1/resources/disks_rest_client_config.php | 2 +- ...xternal_vpn_gateways_descriptor_config.php | 2 +- ...ternal_vpn_gateways_rest_client_config.php | 2 +- .../firewall_policies_descriptor_config.php | 2 +- .../firewall_policies_rest_client_config.php | 2 +- .../resources/firewalls_descriptor_config.php | 2 +- .../firewalls_rest_client_config.php | 2 +- .../forwarding_rules_descriptor_config.php | 2 +- .../forwarding_rules_rest_client_config.php | 2 +- .../global_addresses_descriptor_config.php | 2 +- .../global_addresses_rest_client_config.php | 2 +- ...bal_forwarding_rules_descriptor_config.php | 2 +- ...al_forwarding_rules_rest_client_config.php | 2 +- ...work_endpoint_groups_descriptor_config.php | 2 +- ...ork_endpoint_groups_rest_client_config.php | 2 +- .../global_operations_descriptor_config.php | 2 +- .../global_operations_rest_client_config.php | 2 +- ...anization_operations_descriptor_config.php | 2 +- ...nization_operations_rest_client_config.php | 2 +- ...c_delegated_prefixes_descriptor_config.php | 2 +- ..._delegated_prefixes_rest_client_config.php | 2 +- .../health_checks_descriptor_config.php | 2 +- .../health_checks_rest_client_config.php | 2 +- .../image_family_views_descriptor_config.php | 2 +- .../image_family_views_rest_client_config.php | 2 +- .../V1/resources/images_descriptor_config.php | 2 +- .../resources/images_rest_client_config.php | 2 +- ...ager_resize_requests_descriptor_config.php | 2 +- ...ger_resize_requests_rest_client_config.php | 2 +- ...tance_group_managers_descriptor_config.php | 2 +- ...ance_group_managers_rest_client_config.php | 2 +- .../instance_groups_descriptor_config.php | 2 +- .../instance_groups_rest_client_config.php | 2 +- ...nce_settings_service_descriptor_config.php | 2 +- ...ce_settings_service_rest_client_config.php | 2 +- .../instance_templates_descriptor_config.php | 2 +- .../instance_templates_rest_client_config.php | 2 +- .../resources/instances_descriptor_config.php | 2 +- .../instances_rest_client_config.php | 2 +- .../instant_snapshots_descriptor_config.php | 2 +- .../instant_snapshots_rest_client_config.php | 2 +- ...rconnect_attachments_descriptor_config.php | 2 +- ...connect_attachments_rest_client_config.php | 2 +- ...terconnect_locations_descriptor_config.php | 2 +- ...erconnect_locations_rest_client_config.php | 2 +- ...ect_remote_locations_descriptor_config.php | 2 +- ...ct_remote_locations_rest_client_config.php | 2 +- .../interconnects_descriptor_config.php | 2 +- .../interconnects_rest_client_config.php | 2 +- .../license_codes_descriptor_config.php | 2 +- .../license_codes_rest_client_config.php | 2 +- .../resources/licenses_descriptor_config.php | 2 +- .../resources/licenses_rest_client_config.php | 2 +- .../machine_images_descriptor_config.php | 2 +- .../machine_images_rest_client_config.php | 2 +- .../machine_types_descriptor_config.php | 2 +- .../machine_types_rest_client_config.php | 2 +- .../network_attachments_descriptor_config.php | 2 +- ...network_attachments_rest_client_config.php | 2 +- ...ge_security_services_descriptor_config.php | 2 +- ...e_security_services_rest_client_config.php | 2 +- ...work_endpoint_groups_descriptor_config.php | 2 +- ...ork_endpoint_groups_rest_client_config.php | 2 +- ...rk_firewall_policies_descriptor_config.php | 2 +- ...k_firewall_policies_rest_client_config.php | 2 +- .../network_profiles_descriptor_config.php | 2 +- .../network_profiles_rest_client_config.php | 2 +- .../resources/networks_descriptor_config.php | 2 +- .../resources/networks_rest_client_config.php | 2 +- .../node_groups_descriptor_config.php | 2 +- .../node_groups_rest_client_config.php | 2 +- .../node_templates_descriptor_config.php | 2 +- .../node_templates_rest_client_config.php | 2 +- .../node_types_descriptor_config.php | 2 +- .../node_types_rest_client_config.php | 2 +- .../packet_mirrorings_descriptor_config.php | 2 +- .../packet_mirrorings_rest_client_config.php | 2 +- .../resources/projects_descriptor_config.php | 2 +- .../resources/projects_rest_client_config.php | 2 +- ..._advertised_prefixes_descriptor_config.php | 2 +- ...advertised_prefixes_rest_client_config.php | 2 +- ...c_delegated_prefixes_descriptor_config.php | 2 +- ..._delegated_prefixes_rest_client_config.php | 2 +- .../region_autoscalers_descriptor_config.php | 2 +- .../region_autoscalers_rest_client_config.php | 2 +- ...ion_backend_services_descriptor_config.php | 2 +- ...on_backend_services_rest_client_config.php | 2 +- .../region_commitments_descriptor_config.php | 2 +- .../region_commitments_rest_client_config.php | 2 +- .../region_disk_types_descriptor_config.php | 2 +- .../region_disk_types_rest_client_config.php | 2 +- .../region_disks_descriptor_config.php | 2 +- .../region_disks_rest_client_config.php | 2 +- ...ealth_check_services_descriptor_config.php | 2 +- ...alth_check_services_rest_client_config.php | 2 +- ...region_health_checks_descriptor_config.php | 2 +- ...egion_health_checks_rest_client_config.php | 2 +- ...tance_group_managers_descriptor_config.php | 2 +- ...ance_group_managers_rest_client_config.php | 2 +- ...gion_instance_groups_descriptor_config.php | 2 +- ...ion_instance_groups_rest_client_config.php | 2 +- ...n_instance_templates_descriptor_config.php | 2 +- ..._instance_templates_rest_client_config.php | 2 +- .../region_instances_descriptor_config.php | 2 +- .../region_instances_rest_client_config.php | 2 +- ...on_instant_snapshots_descriptor_config.php | 2 +- ...n_instant_snapshots_rest_client_config.php | 2 +- ...work_endpoint_groups_descriptor_config.php | 2 +- ...ork_endpoint_groups_rest_client_config.php | 2 +- ...rk_firewall_policies_descriptor_config.php | 2 +- ...k_firewall_policies_rest_client_config.php | 2 +- ...tification_endpoints_descriptor_config.php | 2 +- ...ification_endpoints_rest_client_config.php | 2 +- .../region_operations_descriptor_config.php | 2 +- .../region_operations_rest_client_config.php | 2 +- ...on_security_policies_descriptor_config.php | 2 +- ...n_security_policies_rest_client_config.php | 2 +- ...ion_ssl_certificates_descriptor_config.php | 2 +- ...on_ssl_certificates_rest_client_config.php | 2 +- .../region_ssl_policies_descriptor_config.php | 2 +- ...region_ssl_policies_rest_client_config.php | 2 +- ..._target_http_proxies_descriptor_config.php | 2 +- ...target_http_proxies_rest_client_config.php | 2 +- ...target_https_proxies_descriptor_config.php | 2 +- ...arget_https_proxies_rest_client_config.php | 2 +- ...n_target_tcp_proxies_descriptor_config.php | 2 +- ..._target_tcp_proxies_rest_client_config.php | 2 +- .../region_url_maps_descriptor_config.php | 2 +- .../region_url_maps_rest_client_config.php | 2 +- .../region_zones_descriptor_config.php | 2 +- .../region_zones_rest_client_config.php | 2 +- .../resources/regions_descriptor_config.php | 2 +- .../resources/regions_rest_client_config.php | 2 +- .../reservations_descriptor_config.php | 2 +- .../reservations_rest_client_config.php | 2 +- .../resource_policies_descriptor_config.php | 2 +- .../resource_policies_rest_client_config.php | 2 +- .../resources/routers_descriptor_config.php | 2 +- .../resources/routers_rest_client_config.php | 2 +- .../V1/resources/routes_descriptor_config.php | 2 +- .../resources/routes_rest_client_config.php | 2 +- .../security_policies_descriptor_config.php | 2 +- .../security_policies_rest_client_config.php | 2 +- .../service_attachments_descriptor_config.php | 2 +- ...service_attachments_rest_client_config.php | 2 +- ...hot_settings_service_descriptor_config.php | 2 +- ...ot_settings_service_rest_client_config.php | 2 +- .../resources/snapshots_descriptor_config.php | 2 +- .../snapshots_rest_client_config.php | 2 +- .../ssl_certificates_descriptor_config.php | 2 +- .../ssl_certificates_rest_client_config.php | 2 +- .../ssl_policies_descriptor_config.php | 2 +- .../ssl_policies_rest_client_config.php | 2 +- .../storage_pool_types_descriptor_config.php | 2 +- .../storage_pool_types_rest_client_config.php | 2 +- .../storage_pools_descriptor_config.php | 2 +- .../storage_pools_rest_client_config.php | 2 +- .../subnetworks_descriptor_config.php | 2 +- .../subnetworks_rest_client_config.php | 2 +- .../target_grpc_proxies_descriptor_config.php | 2 +- ...target_grpc_proxies_rest_client_config.php | 2 +- .../target_http_proxies_descriptor_config.php | 2 +- ...target_http_proxies_rest_client_config.php | 2 +- ...target_https_proxies_descriptor_config.php | 2 +- ...arget_https_proxies_rest_client_config.php | 2 +- .../target_instances_descriptor_config.php | 2 +- .../target_instances_rest_client_config.php | 2 +- .../target_pools_descriptor_config.php | 2 +- .../target_pools_rest_client_config.php | 2 +- .../target_ssl_proxies_descriptor_config.php | 2 +- .../target_ssl_proxies_rest_client_config.php | 2 +- .../target_tcp_proxies_descriptor_config.php | 2 +- .../target_tcp_proxies_rest_client_config.php | 2 +- .../target_vpn_gateways_descriptor_config.php | 2 +- ...target_vpn_gateways_rest_client_config.php | 2 +- .../resources/url_maps_descriptor_config.php | 2 +- .../resources/url_maps_rest_client_config.php | 2 +- .../vpn_gateways_descriptor_config.php | 2 +- .../vpn_gateways_rest_client_config.php | 2 +- .../vpn_tunnels_descriptor_config.php | 2 +- .../vpn_tunnels_rest_client_config.php | 2 +- .../zone_operations_descriptor_config.php | 2 +- .../zone_operations_rest_client_config.php | 2 +- .../V1/resources/zones_descriptor_config.php | 2 +- .../V1/resources/zones_rest_client_config.php | 2 +- Compute/tests/System/V1/AddressTest.php | 96 - Compute/tests/System/V1/FirewallsTest.php | 75 - Compute/tests/System/V1/PaginationTest.php | 224 - Compute/tests/System/V1/SmokeTest.php | 297 - .../Unit/V1/AcceleratorTypesClientTest.php | 299 - Compute/tests/Unit/V1/AddressesClientTest.php | 809 --- .../tests/Unit/V1/AutoscalersClientTest.php | 785 --- .../Unit/V1/BackendBucketsClientTest.php | 1254 ---- .../Unit/V1/BackendServicesClientTest.php | 1622 ----- .../V1/Client/AcceleratorTypesClientTest.php | 72 +- .../Unit/V1/Client/AddressesClientTest.php | 134 +- .../Unit/V1/Client/AutoscalersClientTest.php | 134 +- .../V1/Client/BackendBucketsClientTest.php | 222 +- .../V1/Client/BackendServicesClientTest.php | 298 +- .../Unit/V1/Client/DiskTypesClientTest.php | 72 +- .../tests/Unit/V1/Client/DisksClientTest.php | 311 +- .../Client/ExternalVpnGatewaysClientTest.php | 108 +- .../V1/Client/FirewallPoliciesClientTest.php | 338 +- .../Unit/V1/Client/FirewallsClientTest.php | 136 +- .../V1/Client/ForwardingRulesClientTest.php | 153 +- .../V1/Client/GlobalAddressesClientTest.php | 136 +- .../GlobalForwardingRulesClientTest.php | 147 +- .../GlobalNetworkEndpointGroupsClientTest.php | 162 +- .../V1/Client/GlobalOperationsClientTest.php | 124 +- ...GlobalOrganizationOperationsClientTest.php | 70 +- ...lobalPublicDelegatedPrefixesClientTest.php | 93 +- .../Unit/V1/Client/HealthChecksClientTest.php | 156 +- .../V1/Client/ImageFamilyViewsClientTest.php | 21 +- .../tests/Unit/V1/Client/ImagesClientTest.php | 227 +- ...ceGroupManagerResizeRequestsClientTest.php | 87 +- .../InstanceGroupManagersClientTest.php | 492 +- .../V1/Client/InstanceGroupsClientTest.php | 165 +- .../InstanceSettingsServiceClientTest.php | 50 +- .../V1/Client/InstanceTemplatesClientTest.php | 171 +- .../Unit/V1/Client/InstancesClientTest.php | 765 ++- .../V1/Client/InstantSnapshotsClientTest.php | 164 +- ...InterconnectAttachmentGroupsClientTest.php | 160 +- .../InterconnectAttachmentsClientTest.php | 134 +- .../Client/InterconnectGroupsClientTest.php | 178 +- .../InterconnectLocationsClientTest.php | 46 +- .../InterconnectRemoteLocationsClientTest.php | 46 +- .../V1/Client/InterconnectsClientTest.php | 174 +- .../Unit/V1/Client/LicenseCodesClientTest.php | 48 +- .../Unit/V1/Client/LicensesClientTest.php | 174 +- .../V1/Client/MachineImagesClientTest.php | 166 +- .../Unit/V1/Client/MachineTypesClientTest.php | 72 +- .../Client/NetworkAttachmentsClientTest.php | 164 +- .../NetworkEdgeSecurityServicesClientTest.php | 92 +- .../NetworkEndpointGroupsClientTest.php | 184 +- .../NetworkFirewallPoliciesClientTest.php | 378 +- .../V1/Client/NetworkProfilesClientTest.php | 54 +- .../Unit/V1/Client/NetworksClientTest.php | 250 +- .../Unit/V1/Client/NodeGroupsClientTest.php | 255 +- .../V1/Client/NodeTemplatesClientTest.php | 149 +- .../Unit/V1/Client/NodeTypesClientTest.php | 72 +- .../V1/Client/PacketMirroringsClientTest.php | 134 +- .../Unit/V1/Client/ProjectsClientTest.php | 259 +- .../PublicAdvertisedPrefixesClientTest.php | 123 +- .../PublicDelegatedPrefixesClientTest.php | 149 +- .../V1/Client/RegionAutoscalersClientTest.php | 110 +- .../RegionBackendServicesClientTest.php | 212 +- .../V1/Client/RegionCommitmentsClientTest.php | 104 +- .../V1/Client/RegionDiskTypesClientTest.php | 48 +- .../Unit/V1/Client/RegionDisksClientTest.php | 275 +- .../RegionHealthCheckServicesClientTest.php | 95 +- .../Client/RegionHealthChecksClientTest.php | 110 +- .../RegionInstanceGroupManagersClientTest.php | 523 +- .../Client/RegionInstanceGroupsClientTest.php | 84 +- .../RegionInstanceTemplatesClientTest.php | 80 +- .../V1/Client/RegionInstancesClientTest.php | 23 +- .../RegionInstantSnapshotsClientTest.php | 140 +- .../RegionNetworkEndpointGroupsClientTest.php | 164 +- ...egionNetworkFirewallPoliciesClientTest.php | 285 +- .../RegionNotificationEndpointsClientTest.php | 80 +- .../V1/Client/RegionOperationsClientTest.php | 78 +- .../RegionSecurityPoliciesClientTest.php | 170 +- .../RegionSslCertificatesClientTest.php | 80 +- .../V1/Client/RegionSslPoliciesClientTest.php | 118 +- .../RegionTargetHttpProxiesClientTest.php | 95 +- .../RegionTargetHttpsProxiesClientTest.php | 133 +- .../RegionTargetTcpProxiesClientTest.php | 80 +- .../V1/Client/RegionUrlMapsClientTest.php | 125 +- .../Unit/V1/Client/RegionZonesClientTest.php | 41 +- .../Unit/V1/Client/RegionsClientTest.php | 58 +- .../V1/Client/ReservationBlocksClientTest.php | 63 +- .../Client/ReservationSubBlocksClientTest.php | 55 +- .../Unit/V1/Client/ReservationsClientTest.php | 194 +- .../V1/Client/ResourcePoliciesClientTest.php | 164 +- .../Unit/V1/Client/RoutersClientTest.php | 288 +- .../tests/Unit/V1/Client/RoutesClientTest.php | 106 +- .../V1/Client/SecurityPoliciesClientTest.php | 242 +- .../Client/ServiceAttachmentsClientTest.php | 164 +- .../SnapshotSettingsServiceClientTest.php | 47 +- .../Unit/V1/Client/SnapshotsClientTest.php | 174 +- .../V1/Client/SslCertificatesClientTest.php | 118 +- .../Unit/V1/Client/SslPoliciesClientTest.php | 162 +- .../V1/Client/StoragePoolTypesClientTest.php | 72 +- .../Unit/V1/Client/StoragePoolsClientTest.php | 175 +- .../Unit/V1/Client/SubnetworksClientTest.php | 227 +- .../V1/Client/TargetGrpcProxiesClientTest.php | 113 +- .../V1/Client/TargetHttpProxiesClientTest.php | 148 +- .../Client/TargetHttpsProxiesClientTest.php | 216 +- .../V1/Client/TargetInstancesClientTest.php | 119 +- .../Unit/V1/Client/TargetPoolsClientTest.php | 206 +- .../V1/Client/TargetSslProxiesClientTest.php | 173 +- .../V1/Client/TargetTcpProxiesClientTest.php | 148 +- .../V1/Client/TargetVpnGatewaysClientTest.php | 119 +- .../Unit/V1/Client/UrlMapsClientTest.php | 186 +- .../Unit/V1/Client/VpnGatewaysClientTest.php | 149 +- .../Unit/V1/Client/VpnTunnelsClientTest.php | 119 +- .../V1/Client/ZoneOperationsClientTest.php | 78 +- .../tests/Unit/V1/Client/ZonesClientTest.php | 58 +- Compute/tests/Unit/V1/DiskTypesClientTest.php | 303 - Compute/tests/Unit/V1/DisksClientTest.php | 2165 ------- .../Unit/V1/ExternalVpnGatewaysClientTest.php | 635 -- .../Unit/V1/FirewallPoliciesClientTest.php | 1733 ------ Compute/tests/Unit/V1/FirewallsClientTest.php | 686 -- .../Unit/V1/ForwardingRulesClientTest.php | 962 --- .../Unit/V1/GlobalAddressesClientTest.php | 704 --- .../V1/GlobalForwardingRulesClientTest.php | 852 --- .../GlobalNetworkEndpointGroupsClientTest.php | 774 --- .../Unit/V1/GlobalOperationsClientTest.php | 484 -- ...GlobalOrganizationOperationsClientTest.php | 289 - ...lobalPublicDelegatedPrefixesClientTest.php | 578 -- .../tests/Unit/V1/HealthChecksClientTest.php | 767 --- .../Unit/V1/ImageFamilyViewsClientTest.php | 127 - Compute/tests/Unit/V1/ImagesClientTest.php | 1146 ---- ...ceGroupManagerResizeRequestsClientTest.php | 607 -- .../V1/InstanceGroupManagersClientTest.php | 2777 --------- .../Unit/V1/InstanceGroupsClientTest.php | 1010 --- .../V1/InstanceSettingsServiceClientTest.php | 252 - .../Unit/V1/InstanceTemplatesClientTest.php | 733 --- Compute/tests/Unit/V1/InstancesClientTest.php | 5502 ----------------- .../Unit/V1/InstantSnapshotsClientTest.php | 905 --- ...InterconnectAttachmentGroupsClientTest.php | 833 --- .../V1/InterconnectAttachmentsClientTest.php | 840 --- .../Unit/V1/InterconnectGroupsClientTest.php | 950 --- .../V1/InterconnectLocationsClientTest.php | 228 - .../InterconnectRemoteLocationsClientTest.php | 232 - .../tests/Unit/V1/InterconnectsClientTest.php | 843 --- .../tests/Unit/V1/LicenseCodesClientTest.php | 207 - Compute/tests/Unit/V1/LicensesClientTest.php | 788 --- .../tests/Unit/V1/MachineImagesClientTest.php | 785 --- .../tests/Unit/V1/MachineTypesClientTest.php | 311 - .../Unit/V1/NetworkAttachmentsClientTest.php | 892 --- .../NetworkEdgeSecurityServicesClientTest.php | 591 -- .../V1/NetworkEndpointGroupsClientTest.php | 960 --- .../V1/NetworkFirewallPoliciesClientTest.php | 2147 ------- .../Unit/V1/NetworkProfilesClientTest.php | 208 - Compute/tests/Unit/V1/NetworksClientTest.php | 1313 ---- .../tests/Unit/V1/NodeGroupsClientTest.php | 1606 ----- .../tests/Unit/V1/NodeTemplatesClientTest.php | 769 --- Compute/tests/Unit/V1/NodeTypesClientTest.php | 307 - .../Unit/V1/PacketMirroringsClientTest.php | 738 --- Compute/tests/Unit/V1/ProjectsClientTest.php | 1517 ----- .../V1/PublicAdvertisedPrefixesClientTest.php | 802 --- .../V1/PublicDelegatedPrefixesClientTest.php | 916 --- .../Unit/V1/RegionAutoscalersClientTest.php | 708 --- .../V1/RegionBackendServicesClientTest.php | 1243 ---- .../Unit/V1/RegionCommitmentsClientTest.php | 563 -- .../Unit/V1/RegionDiskTypesClientTest.php | 226 - .../tests/Unit/V1/RegionDisksClientTest.php | 1968 ------ .../RegionHealthCheckServicesClientTest.php | 589 -- .../Unit/V1/RegionHealthChecksClientTest.php | 718 --- .../RegionInstanceGroupManagersClientTest.php | 2700 -------- .../V1/RegionInstanceGroupsClientTest.php | 447 -- .../V1/RegionInstanceTemplatesClientTest.php | 464 -- .../Unit/V1/RegionInstancesClientTest.php | 184 - .../V1/RegionInstantSnapshotsClientTest.php | 828 --- .../RegionNetworkEndpointGroupsClientTest.php | 806 --- ...egionNetworkFirewallPoliciesClientTest.php | 1776 ------ .../RegionNotificationEndpointsClientTest.php | 462 -- .../Unit/V1/RegionOperationsClientTest.php | 423 -- .../V1/RegionSecurityPoliciesClientTest.php | 1155 ---- .../V1/RegionSslCertificatesClientTest.php | 470 -- .../Unit/V1/RegionSslPoliciesClientTest.php | 654 -- .../V1/RegionTargetHttpProxiesClientTest.php | 594 -- .../V1/RegionTargetHttpsProxiesClientTest.php | 853 --- .../V1/RegionTargetTcpProxiesClientTest.php | 468 -- .../tests/Unit/V1/RegionUrlMapsClientTest.php | 784 --- .../tests/Unit/V1/RegionZonesClientTest.php | 140 - Compute/tests/Unit/V1/RegionsClientTest.php | 214 - .../Unit/V1/ReservationBlocksClientTest.php | 347 -- .../V1/ReservationSubBlocksClientTest.php | 342 - .../tests/Unit/V1/ReservationsClientTest.php | 1148 ---- .../Unit/V1/ResourcePoliciesClientTest.php | 890 --- Compute/tests/Unit/V1/RoutersClientTest.php | 1667 ----- Compute/tests/Unit/V1/RoutesClientTest.php | 474 -- .../Unit/V1/SecurityPoliciesClientTest.php | 1246 ---- .../Unit/V1/ServiceAttachmentsClientTest.php | 898 --- .../V1/SnapshotSettingsServiceClientTest.php | 237 - Compute/tests/Unit/V1/SnapshotsClientTest.php | 817 --- .../Unit/V1/SslCertificatesClientTest.php | 529 -- .../tests/Unit/V1/SslPoliciesClientTest.php | 706 --- .../Unit/V1/StoragePoolTypesClientTest.php | 313 - .../tests/Unit/V1/StoragePoolsClientTest.php | 975 --- .../tests/Unit/V1/SubnetworksClientTest.php | 1244 ---- .../Unit/V1/TargetGrpcProxiesClientTest.php | 568 -- .../Unit/V1/TargetHttpProxiesClientTest.php | 766 --- .../Unit/V1/TargetHttpsProxiesClientTest.php | 1254 ---- .../Unit/V1/TargetInstancesClientTest.php | 671 -- .../tests/Unit/V1/TargetPoolsClientTest.php | 1365 ---- .../Unit/V1/TargetSslProxiesClientTest.php | 1045 ---- .../Unit/V1/TargetTcpProxiesClientTest.php | 765 --- .../Unit/V1/TargetVpnGatewaysClientTest.php | 669 -- Compute/tests/Unit/V1/UrlMapsClientTest.php | 948 --- .../tests/Unit/V1/VpnGatewaysClientTest.php | 810 --- .../tests/Unit/V1/VpnTunnelsClientTest.php | 691 --- .../Unit/V1/ZoneOperationsClientTest.php | 423 -- Compute/tests/Unit/V1/ZonesClientTest.php | 216 - 2718 files changed, 19391 insertions(+), 212968 deletions(-) delete mode 100644 Compute/src/V1/AcceleratorTypesClient.php delete mode 100644 Compute/src/V1/AddressesClient.php delete mode 100644 Compute/src/V1/AllocationSpecificSKUAllocationReservedInstanceProperties/MaintenanceInterval.php delete mode 100644 Compute/src/V1/AuthorizationLoggingOptions.php delete mode 100644 Compute/src/V1/AuthorizationLoggingOptions/PermissionType.php delete mode 100644 Compute/src/V1/AutoscalersClient.php delete mode 100644 Compute/src/V1/BackendBucketsClient.php delete mode 100644 Compute/src/V1/BackendServicesClient.php delete mode 100644 Compute/src/V1/Condition.php delete mode 100644 Compute/src/V1/Condition/Iam.php delete mode 100644 Compute/src/V1/Condition/Op.php delete mode 100644 Compute/src/V1/Condition/Sys.php delete mode 100644 Compute/src/V1/DiskTypesClient.php delete mode 100644 Compute/src/V1/DisksClient.php delete mode 100644 Compute/src/V1/Enums/AccessConfig/NetworkTier.php delete mode 100644 Compute/src/V1/Enums/AccessConfig/Type.php delete mode 100644 Compute/src/V1/Enums/Address/AddressType.php delete mode 100644 Compute/src/V1/Enums/Address/IpVersion.php delete mode 100644 Compute/src/V1/Enums/Address/Ipv6EndpointType.php delete mode 100644 Compute/src/V1/Enums/Address/NetworkTier.php delete mode 100644 Compute/src/V1/Enums/Address/Purpose.php delete mode 100644 Compute/src/V1/Enums/Address/Status.php delete mode 100644 Compute/src/V1/Enums/AdvancedMachineFeatures/PerformanceMonitoringUnit.php delete mode 100644 Compute/src/V1/Enums/AllocationAggregateReservation/VmFamily.php delete mode 100644 Compute/src/V1/Enums/AllocationAggregateReservation/WorkloadType.php delete mode 100644 Compute/src/V1/Enums/AllocationReservationSharingPolicy/ServiceShareType.php delete mode 100644 Compute/src/V1/Enums/AllocationResourceStatusHealthInfo/HealthStatus.php delete mode 100644 Compute/src/V1/Enums/AllocationSpecificSKUAllocationAllocatedInstancePropertiesReservedDisk/PBInterface.php delete mode 100644 Compute/src/V1/Enums/AttachedDisk/Architecture.php delete mode 100644 Compute/src/V1/Enums/AttachedDisk/Mode.php delete mode 100644 Compute/src/V1/Enums/AttachedDisk/PBInterface.php delete mode 100644 Compute/src/V1/Enums/AttachedDisk/SavedState.php delete mode 100644 Compute/src/V1/Enums/AttachedDisk/Type.php delete mode 100644 Compute/src/V1/Enums/AttachedDiskInitializeParams/Architecture.php delete mode 100644 Compute/src/V1/Enums/AttachedDiskInitializeParams/OnUpdateAction.php delete mode 100644 Compute/src/V1/Enums/AuditLogConfig/LogType.php delete mode 100644 Compute/src/V1/Enums/AuthorizationLoggingOptions/PermissionType.php delete mode 100644 Compute/src/V1/Enums/Autoscaler/Status.php delete mode 100644 Compute/src/V1/Enums/AutoscalerStatusDetails/Type.php delete mode 100644 Compute/src/V1/Enums/AutoscalingPolicy/Mode.php delete mode 100644 Compute/src/V1/Enums/AutoscalingPolicyCpuUtilization/PredictiveMethod.php delete mode 100644 Compute/src/V1/Enums/AutoscalingPolicyCustomMetricUtilization/UtilizationTargetType.php delete mode 100644 Compute/src/V1/Enums/Backend/BalancingMode.php delete mode 100644 Compute/src/V1/Enums/Backend/Preference.php delete mode 100644 Compute/src/V1/Enums/BackendBucket/CompressionMode.php delete mode 100644 Compute/src/V1/Enums/BackendBucket/LoadBalancingScheme.php delete mode 100644 Compute/src/V1/Enums/BackendBucketCdnPolicy/CacheMode.php delete mode 100644 Compute/src/V1/Enums/BackendService/CompressionMode.php delete mode 100644 Compute/src/V1/Enums/BackendService/ExternalManagedMigrationState.php delete mode 100644 Compute/src/V1/Enums/BackendService/IpAddressSelectionPolicy.php delete mode 100644 Compute/src/V1/Enums/BackendService/LoadBalancingScheme.php delete mode 100644 Compute/src/V1/Enums/BackendService/LocalityLbPolicy.php delete mode 100644 Compute/src/V1/Enums/BackendService/Protocol.php delete mode 100644 Compute/src/V1/Enums/BackendService/SessionAffinity.php delete mode 100644 Compute/src/V1/Enums/BackendServiceCdnPolicy/CacheMode.php delete mode 100644 Compute/src/V1/Enums/BackendServiceConnectionTrackingPolicy/ConnectionPersistenceOnUnhealthyBackends.php delete mode 100644 Compute/src/V1/Enums/BackendServiceConnectionTrackingPolicy/TrackingMode.php delete mode 100644 Compute/src/V1/Enums/BackendServiceHAPolicy/FastIPMove.php delete mode 100644 Compute/src/V1/Enums/BackendServiceLocalityLoadBalancingPolicyConfigPolicy/Name.php delete mode 100644 Compute/src/V1/Enums/BackendServiceLogConfig/OptionalMode.php delete mode 100644 Compute/src/V1/Enums/BfdPacket/Diagnostic.php delete mode 100644 Compute/src/V1/Enums/BfdPacket/State.php delete mode 100644 Compute/src/V1/Enums/BfdStatus/BfdSessionInitializationMode.php delete mode 100644 Compute/src/V1/Enums/BfdStatus/LocalDiagnostic.php delete mode 100644 Compute/src/V1/Enums/BfdStatus/LocalState.php delete mode 100644 Compute/src/V1/Enums/BgpRoute/Origin.php delete mode 100644 Compute/src/V1/Enums/BgpRouteAsPath/Type.php delete mode 100644 Compute/src/V1/Enums/BulkInsertOperationStatus/Status.php delete mode 100644 Compute/src/V1/Enums/Commitment/Category.php delete mode 100644 Compute/src/V1/Enums/Commitment/Plan.php delete mode 100644 Compute/src/V1/Enums/Commitment/Status.php delete mode 100644 Compute/src/V1/Enums/Commitment/Type.php delete mode 100644 Compute/src/V1/Enums/Condition/Iam.php delete mode 100644 Compute/src/V1/Enums/Condition/Op.php delete mode 100644 Compute/src/V1/Enums/Condition/Sys.php delete mode 100644 Compute/src/V1/Enums/ConfidentialInstanceConfig/ConfidentialInstanceType.php delete mode 100644 Compute/src/V1/Enums/DeprecationStatus/State.php delete mode 100644 Compute/src/V1/Enums/Disk/AccessMode.php delete mode 100644 Compute/src/V1/Enums/Disk/Architecture.php delete mode 100644 Compute/src/V1/Enums/Disk/Status.php delete mode 100644 Compute/src/V1/Enums/DiskInstantiationConfig/InstantiateFrom.php delete mode 100644 Compute/src/V1/Enums/DiskResourceStatusAsyncReplicationStatus/State.php delete mode 100644 Compute/src/V1/Enums/DistributionPolicy/TargetShape.php delete mode 100644 Compute/src/V1/Enums/ExchangedPeeringRoute/Type.php delete mode 100644 Compute/src/V1/Enums/ExternalVpnGateway/RedundancyType.php delete mode 100644 Compute/src/V1/Enums/FileContentBuffer/FileType.php delete mode 100644 Compute/src/V1/Enums/Firewall/Direction.php delete mode 100644 Compute/src/V1/Enums/FirewallLogConfig/Metadata.php delete mode 100644 Compute/src/V1/Enums/FirewallPolicyRule/Direction.php delete mode 100644 Compute/src/V1/Enums/FirewallPolicyRuleMatcher/DestNetworkType.php delete mode 100644 Compute/src/V1/Enums/FirewallPolicyRuleMatcher/SrcNetworkType.php delete mode 100644 Compute/src/V1/Enums/FirewallPolicyRuleSecureTag/State.php delete mode 100644 Compute/src/V1/Enums/ForwardingRule/ExternalManagedBackendBucketMigrationState.php delete mode 100644 Compute/src/V1/Enums/ForwardingRule/IPProtocolEnum.php delete mode 100644 Compute/src/V1/Enums/ForwardingRule/IpVersion.php delete mode 100644 Compute/src/V1/Enums/ForwardingRule/LoadBalancingScheme.php delete mode 100644 Compute/src/V1/Enums/ForwardingRule/NetworkTier.php delete mode 100644 Compute/src/V1/Enums/ForwardingRule/PscConnectionStatus.php delete mode 100644 Compute/src/V1/Enums/GRPCHealthCheck/PortSpecification.php delete mode 100644 Compute/src/V1/Enums/GetReservationBlockRequest/View.php delete mode 100644 Compute/src/V1/Enums/GroupMaintenanceInfo/SchedulingType.php delete mode 100644 Compute/src/V1/Enums/GuestOsFeature/Type.php delete mode 100644 Compute/src/V1/Enums/HTTP2HealthCheck/PortSpecification.php delete mode 100644 Compute/src/V1/Enums/HTTP2HealthCheck/ProxyHeader.php delete mode 100644 Compute/src/V1/Enums/HTTPHealthCheck/PortSpecification.php delete mode 100644 Compute/src/V1/Enums/HTTPHealthCheck/ProxyHeader.php delete mode 100644 Compute/src/V1/Enums/HTTPSHealthCheck/PortSpecification.php delete mode 100644 Compute/src/V1/Enums/HTTPSHealthCheck/ProxyHeader.php delete mode 100644 Compute/src/V1/Enums/HealthCheck/Type.php delete mode 100644 Compute/src/V1/Enums/HealthCheckService/HealthStatusAggregationPolicy.php delete mode 100644 Compute/src/V1/Enums/HealthStatus/HealthState.php delete mode 100644 Compute/src/V1/Enums/HealthStatus/Ipv6HealthState.php delete mode 100644 Compute/src/V1/Enums/HealthStatus/WeightError.php delete mode 100644 Compute/src/V1/Enums/HealthStatusForNetworkEndpoint/HealthState.php delete mode 100644 Compute/src/V1/Enums/HealthStatusForNetworkEndpoint/Ipv6HealthState.php delete mode 100644 Compute/src/V1/Enums/HttpRedirectAction/RedirectResponseCode.php delete mode 100644 Compute/src/V1/Enums/Image/Architecture.php delete mode 100644 Compute/src/V1/Enums/Image/SourceType.php delete mode 100644 Compute/src/V1/Enums/Image/Status.php delete mode 100644 Compute/src/V1/Enums/Instance/KeyRevocationActionType.php delete mode 100644 Compute/src/V1/Enums/Instance/PrivateIpv6GoogleAccess.php delete mode 100644 Compute/src/V1/Enums/Instance/Status.php delete mode 100644 Compute/src/V1/Enums/InstanceGroupManager/ListManagedInstancesResults.php delete mode 100644 Compute/src/V1/Enums/InstanceGroupManagerInstanceLifecyclePolicy/DefaultActionOnFailure.php delete mode 100644 Compute/src/V1/Enums/InstanceGroupManagerInstanceLifecyclePolicy/ForceUpdateOnRepair.php delete mode 100644 Compute/src/V1/Enums/InstanceGroupManagerResizeRequest/State.php delete mode 100644 Compute/src/V1/Enums/InstanceGroupManagerStandbyPolicy/Mode.php delete mode 100644 Compute/src/V1/Enums/InstanceGroupManagerUpdatePolicy/InstanceRedistributionType.php delete mode 100644 Compute/src/V1/Enums/InstanceGroupManagerUpdatePolicy/MinimalAction.php delete mode 100644 Compute/src/V1/Enums/InstanceGroupManagerUpdatePolicy/MostDisruptiveAllowedAction.php delete mode 100644 Compute/src/V1/Enums/InstanceGroupManagerUpdatePolicy/ReplacementMethod.php delete mode 100644 Compute/src/V1/Enums/InstanceGroupManagerUpdatePolicy/Type.php delete mode 100644 Compute/src/V1/Enums/InstanceGroupManagersApplyUpdatesRequest/MinimalAction.php delete mode 100644 Compute/src/V1/Enums/InstanceGroupManagersApplyUpdatesRequest/MostDisruptiveAllowedAction.php delete mode 100644 Compute/src/V1/Enums/InstanceGroupsListInstancesRequest/InstanceState.php delete mode 100644 Compute/src/V1/Enums/InstanceManagedByIgmErrorInstanceActionDetails/Action.php delete mode 100644 Compute/src/V1/Enums/InstanceProperties/KeyRevocationActionType.php delete mode 100644 Compute/src/V1/Enums/InstanceProperties/PrivateIpv6GoogleAccess.php delete mode 100644 Compute/src/V1/Enums/InstanceWithNamedPorts/Status.php delete mode 100644 Compute/src/V1/Enums/InstancesGetEffectiveFirewallsResponseEffectiveFirewallPolicy/Type.php delete mode 100644 Compute/src/V1/Enums/InstancesReportHostAsFaultyRequest/DisruptionSchedule.php delete mode 100644 Compute/src/V1/Enums/InstancesReportHostAsFaultyRequestFaultReason/Behavior.php delete mode 100644 Compute/src/V1/Enums/InstantSnapshot/Architecture.php delete mode 100644 Compute/src/V1/Enums/InstantSnapshot/Status.php delete mode 100644 Compute/src/V1/Enums/Interconnect/AvailableFeatures.php delete mode 100644 Compute/src/V1/Enums/Interconnect/InterconnectType.php delete mode 100644 Compute/src/V1/Enums/Interconnect/LinkType.php delete mode 100644 Compute/src/V1/Enums/Interconnect/OperationalStatus.php delete mode 100644 Compute/src/V1/Enums/Interconnect/RequestedFeatures.php delete mode 100644 Compute/src/V1/Enums/Interconnect/State.php delete mode 100644 Compute/src/V1/Enums/InterconnectApplicationAwareInterconnectBandwidthPercentage/TrafficClass.php delete mode 100644 Compute/src/V1/Enums/InterconnectAttachment/Bandwidth.php delete mode 100644 Compute/src/V1/Enums/InterconnectAttachment/EdgeAvailabilityDomain.php delete mode 100644 Compute/src/V1/Enums/InterconnectAttachment/Encryption.php delete mode 100644 Compute/src/V1/Enums/InterconnectAttachment/OperationalStatus.php delete mode 100644 Compute/src/V1/Enums/InterconnectAttachment/StackType.php delete mode 100644 Compute/src/V1/Enums/InterconnectAttachment/State.php delete mode 100644 Compute/src/V1/Enums/InterconnectAttachment/Type.php delete mode 100644 Compute/src/V1/Enums/InterconnectAttachmentConfigurationConstraints/BgpMd5.php delete mode 100644 Compute/src/V1/Enums/InterconnectAttachmentGroupConfiguredAvailabilitySLA/EffectiveSla.php delete mode 100644 Compute/src/V1/Enums/InterconnectAttachmentGroupConfiguredAvailabilitySLAIntendedSlaBlockers/BlockerType.php delete mode 100644 Compute/src/V1/Enums/InterconnectAttachmentGroupIntent/AvailabilitySla.php delete mode 100644 Compute/src/V1/Enums/InterconnectAttachmentGroupsOperationalStatus/GroupStatus.php delete mode 100644 Compute/src/V1/Enums/InterconnectAttachmentGroupsOperationalStatusAttachmentStatus/IsActive.php delete mode 100644 Compute/src/V1/Enums/InterconnectAttachmentGroupsOperationalStatusAttachmentStatus/Status.php delete mode 100644 Compute/src/V1/Enums/InterconnectDiagnostics/BundleAggregationType.php delete mode 100644 Compute/src/V1/Enums/InterconnectDiagnostics/BundleOperationalStatus.php delete mode 100644 Compute/src/V1/Enums/InterconnectDiagnosticsLinkLACPStatus/State.php delete mode 100644 Compute/src/V1/Enums/InterconnectDiagnosticsLinkOpticalPower/State.php delete mode 100644 Compute/src/V1/Enums/InterconnectDiagnosticsLinkStatus/OperationalStatus.php delete mode 100644 Compute/src/V1/Enums/InterconnectGroupConfiguredTopologyCapability/SupportedSla.php delete mode 100644 Compute/src/V1/Enums/InterconnectGroupConfiguredTopologyCapabilityIntendedCapabilityBlockers/BlockerType.php delete mode 100644 Compute/src/V1/Enums/InterconnectGroupIntent/TopologyCapability.php delete mode 100644 Compute/src/V1/Enums/InterconnectGroupsCreateMembers/IntentMismatchBehavior.php delete mode 100644 Compute/src/V1/Enums/InterconnectGroupsCreateMembersInterconnectInput/InterconnectType.php delete mode 100644 Compute/src/V1/Enums/InterconnectGroupsCreateMembersInterconnectInput/LinkType.php delete mode 100644 Compute/src/V1/Enums/InterconnectGroupsCreateMembersInterconnectInput/RequestedFeatures.php delete mode 100644 Compute/src/V1/Enums/InterconnectGroupsOperationalStatus/GroupStatus.php delete mode 100644 Compute/src/V1/Enums/InterconnectGroupsOperationalStatusInterconnectStatus/IsActive.php delete mode 100644 Compute/src/V1/Enums/InterconnectLocation/AvailableFeatures.php delete mode 100644 Compute/src/V1/Enums/InterconnectLocation/AvailableLinkTypes.php delete mode 100644 Compute/src/V1/Enums/InterconnectLocation/Continent.php delete mode 100644 Compute/src/V1/Enums/InterconnectLocation/Status.php delete mode 100644 Compute/src/V1/Enums/InterconnectLocationRegionInfo/LocationPresence.php delete mode 100644 Compute/src/V1/Enums/InterconnectOutageNotification/IssueType.php delete mode 100644 Compute/src/V1/Enums/InterconnectOutageNotification/Source.php delete mode 100644 Compute/src/V1/Enums/InterconnectOutageNotification/State.php delete mode 100644 Compute/src/V1/Enums/InterconnectRemoteLocation/Continent.php delete mode 100644 Compute/src/V1/Enums/InterconnectRemoteLocation/Lacp.php delete mode 100644 Compute/src/V1/Enums/InterconnectRemoteLocation/Status.php delete mode 100644 Compute/src/V1/Enums/InterconnectRemoteLocationConstraints/PortPairRemoteLocation.php delete mode 100644 Compute/src/V1/Enums/InterconnectRemoteLocationConstraints/PortPairVlan.php delete mode 100644 Compute/src/V1/Enums/LicenseCode/State.php delete mode 100644 Compute/src/V1/Enums/ListBgpRoutesRoutersRequest/AddressFamily.php delete mode 100644 Compute/src/V1/Enums/ListBgpRoutesRoutersRequest/RouteType.php delete mode 100644 Compute/src/V1/Enums/ListPeeringRoutesNetworksRequest/Direction.php delete mode 100644 Compute/src/V1/Enums/LocationPolicy/TargetShape.php delete mode 100644 Compute/src/V1/Enums/LocationPolicyLocation/Preference.php delete mode 100644 Compute/src/V1/Enums/LogConfigCloudAuditOptions/LogName.php delete mode 100644 Compute/src/V1/Enums/LogConfigDataAccessOptions/LogMode.php delete mode 100644 Compute/src/V1/Enums/MachineImage/Status.php delete mode 100644 Compute/src/V1/Enums/MachineType/Architecture.php delete mode 100644 Compute/src/V1/Enums/ManagedInstance/CurrentAction.php delete mode 100644 Compute/src/V1/Enums/ManagedInstance/InstanceStatus.php delete mode 100644 Compute/src/V1/Enums/ManagedInstanceInstanceHealth/DetailedHealthState.php delete mode 100644 Compute/src/V1/Enums/MetadataFilter/FilterMatchCriteria.php delete mode 100644 Compute/src/V1/Enums/NatIpInfoNatIpInfoMapping/Mode.php delete mode 100644 Compute/src/V1/Enums/NatIpInfoNatIpInfoMapping/Usage.php delete mode 100644 Compute/src/V1/Enums/Network/NetworkFirewallPolicyEnforcementOrder.php delete mode 100644 Compute/src/V1/Enums/NetworkAttachment/ConnectionPreference.php delete mode 100644 Compute/src/V1/Enums/NetworkAttachmentConnectedEndpoint/Status.php delete mode 100644 Compute/src/V1/Enums/NetworkEndpointGroup/NetworkEndpointType.php delete mode 100644 Compute/src/V1/Enums/NetworkEndpointGroupPscData/PscConnectionStatus.php delete mode 100644 Compute/src/V1/Enums/NetworkEndpointGroupsListEndpointsRequest/HealthStatus.php delete mode 100644 Compute/src/V1/Enums/NetworkInterface/Ipv6AccessType.php delete mode 100644 Compute/src/V1/Enums/NetworkInterface/NicType.php delete mode 100644 Compute/src/V1/Enums/NetworkInterface/StackType.php delete mode 100644 Compute/src/V1/Enums/NetworkPeering/StackType.php delete mode 100644 Compute/src/V1/Enums/NetworkPeering/State.php delete mode 100644 Compute/src/V1/Enums/NetworkPeering/UpdateStrategy.php delete mode 100644 Compute/src/V1/Enums/NetworkPeeringConnectionStatus/UpdateStrategy.php delete mode 100644 Compute/src/V1/Enums/NetworkPeeringConnectionStatusConsensusState/DeleteStatus.php delete mode 100644 Compute/src/V1/Enums/NetworkPeeringConnectionStatusConsensusState/UpdateStatus.php delete mode 100644 Compute/src/V1/Enums/NetworkPeeringConnectionStatusTrafficConfiguration/StackType.php delete mode 100644 Compute/src/V1/Enums/NetworkPerformanceConfig/TotalEgressBandwidthTier.php delete mode 100644 Compute/src/V1/Enums/NetworkProfileLocation/Scope.php delete mode 100644 Compute/src/V1/Enums/NetworkProfileNetworkFeatures/AddressPurposes.php delete mode 100644 Compute/src/V1/Enums/NetworkProfileNetworkFeatures/AllowAliasIpRanges.php delete mode 100644 Compute/src/V1/Enums/NetworkProfileNetworkFeatures/AllowAutoModeSubnet.php delete mode 100644 Compute/src/V1/Enums/NetworkProfileNetworkFeatures/AllowClassDFirewalls.php delete mode 100644 Compute/src/V1/Enums/NetworkProfileNetworkFeatures/AllowCloudNat.php delete mode 100644 Compute/src/V1/Enums/NetworkProfileNetworkFeatures/AllowCloudRouter.php delete mode 100644 Compute/src/V1/Enums/NetworkProfileNetworkFeatures/AllowDefaultNicAttachment.php delete mode 100644 Compute/src/V1/Enums/NetworkProfileNetworkFeatures/AllowExternalIpAccess.php delete mode 100644 Compute/src/V1/Enums/NetworkProfileNetworkFeatures/AllowInterconnect.php delete mode 100644 Compute/src/V1/Enums/NetworkProfileNetworkFeatures/AllowIpForwarding.php delete mode 100644 Compute/src/V1/Enums/NetworkProfileNetworkFeatures/AllowLoadBalancing.php delete mode 100644 Compute/src/V1/Enums/NetworkProfileNetworkFeatures/AllowMultiNicInSameNetwork.php delete mode 100644 Compute/src/V1/Enums/NetworkProfileNetworkFeatures/AllowNcc.php delete mode 100644 Compute/src/V1/Enums/NetworkProfileNetworkFeatures/AllowNetworkMigration.php delete mode 100644 Compute/src/V1/Enums/NetworkProfileNetworkFeatures/AllowPacketMirroring.php delete mode 100644 Compute/src/V1/Enums/NetworkProfileNetworkFeatures/AllowPrivateGoogleAccess.php delete mode 100644 Compute/src/V1/Enums/NetworkProfileNetworkFeatures/AllowPsc.php delete mode 100644 Compute/src/V1/Enums/NetworkProfileNetworkFeatures/AllowSameNetworkUnicast.php delete mode 100644 Compute/src/V1/Enums/NetworkProfileNetworkFeatures/AllowStaticRoutes.php delete mode 100644 Compute/src/V1/Enums/NetworkProfileNetworkFeatures/AllowSubInterfaces.php delete mode 100644 Compute/src/V1/Enums/NetworkProfileNetworkFeatures/AllowVpcPeering.php delete mode 100644 Compute/src/V1/Enums/NetworkProfileNetworkFeatures/AllowVpn.php delete mode 100644 Compute/src/V1/Enums/NetworkProfileNetworkFeatures/InterfaceTypes.php delete mode 100644 Compute/src/V1/Enums/NetworkProfileNetworkFeatures/SubnetPurposes.php delete mode 100644 Compute/src/V1/Enums/NetworkProfileNetworkFeatures/SubnetStackTypes.php delete mode 100644 Compute/src/V1/Enums/NetworkProfileNetworkFeatures/SubnetworkPurposes.php delete mode 100644 Compute/src/V1/Enums/NetworkProfileNetworkFeatures/SubnetworkStackTypes.php delete mode 100644 Compute/src/V1/Enums/NetworkProfileNetworkFeatures/Unicast.php delete mode 100644 Compute/src/V1/Enums/NetworkRoutingConfig/BgpBestPathSelectionMode.php delete mode 100644 Compute/src/V1/Enums/NetworkRoutingConfig/BgpInterRegionCost.php delete mode 100644 Compute/src/V1/Enums/NetworkRoutingConfig/EffectiveBgpInterRegionCost.php delete mode 100644 Compute/src/V1/Enums/NetworkRoutingConfig/RoutingMode.php delete mode 100644 Compute/src/V1/Enums/NetworksGetEffectiveFirewallsResponseEffectiveFirewallPolicy/Type.php delete mode 100644 Compute/src/V1/Enums/NodeGroup/MaintenanceInterval.php delete mode 100644 Compute/src/V1/Enums/NodeGroup/MaintenancePolicy.php delete mode 100644 Compute/src/V1/Enums/NodeGroup/Status.php delete mode 100644 Compute/src/V1/Enums/NodeGroupAutoscalingPolicy/Mode.php delete mode 100644 Compute/src/V1/Enums/NodeGroupNode/CpuOvercommitType.php delete mode 100644 Compute/src/V1/Enums/NodeGroupNode/Status.php delete mode 100644 Compute/src/V1/Enums/NodeTemplate/CpuOvercommitType.php delete mode 100644 Compute/src/V1/Enums/NodeTemplate/Status.php delete mode 100644 Compute/src/V1/Enums/Operation/Status.php delete mode 100644 Compute/src/V1/Enums/PacketIntervals/Duration.php delete mode 100644 Compute/src/V1/Enums/PacketIntervals/Type.php delete mode 100644 Compute/src/V1/Enums/PacketMirroring/Enable.php delete mode 100644 Compute/src/V1/Enums/PacketMirroringFilter/Direction.php delete mode 100644 Compute/src/V1/Enums/PerInstanceConfig/Status.php delete mode 100644 Compute/src/V1/Enums/PreservedStatePreservedDisk/AutoDelete.php delete mode 100644 Compute/src/V1/Enums/PreservedStatePreservedDisk/Mode.php delete mode 100644 Compute/src/V1/Enums/PreservedStatePreservedNetworkIp/AutoDelete.php delete mode 100644 Compute/src/V1/Enums/Project/CloudArmorTier.php delete mode 100644 Compute/src/V1/Enums/Project/DefaultNetworkTier.php delete mode 100644 Compute/src/V1/Enums/Project/VmDnsSetting.php delete mode 100644 Compute/src/V1/Enums/Project/XpnProjectStatus.php delete mode 100644 Compute/src/V1/Enums/ProjectsSetCloudArmorTierRequest/CloudArmorTier.php delete mode 100644 Compute/src/V1/Enums/ProjectsSetDefaultNetworkTierRequest/NetworkTier.php delete mode 100644 Compute/src/V1/Enums/PublicAdvertisedPrefix/ByoipApiVersion.php delete mode 100644 Compute/src/V1/Enums/PublicAdvertisedPrefix/PdpScope.php delete mode 100644 Compute/src/V1/Enums/PublicAdvertisedPrefix/Status.php delete mode 100644 Compute/src/V1/Enums/PublicDelegatedPrefix/ByoipApiVersion.php delete mode 100644 Compute/src/V1/Enums/PublicDelegatedPrefix/Mode.php delete mode 100644 Compute/src/V1/Enums/PublicDelegatedPrefix/Status.php delete mode 100644 Compute/src/V1/Enums/PublicDelegatedPrefixPublicDelegatedSubPrefix/Mode.php delete mode 100644 Compute/src/V1/Enums/PublicDelegatedPrefixPublicDelegatedSubPrefix/Status.php delete mode 100644 Compute/src/V1/Enums/Quota/Metric.php delete mode 100644 Compute/src/V1/Enums/QuotaExceededInfo/RolloutStatus.php delete mode 100644 Compute/src/V1/Enums/QuotaStatusWarning/Code.php delete mode 100644 Compute/src/V1/Enums/RawDisk/ContainerType.php delete mode 100644 Compute/src/V1/Enums/Region/Status.php delete mode 100644 Compute/src/V1/Enums/RegionInstanceGroupManagersApplyUpdatesRequest/MinimalAction.php delete mode 100644 Compute/src/V1/Enums/RegionInstanceGroupManagersApplyUpdatesRequest/MostDisruptiveAllowedAction.php delete mode 100644 Compute/src/V1/Enums/RegionInstanceGroupsListInstancesRequest/InstanceState.php delete mode 100644 Compute/src/V1/Enums/RegionNetworkFirewallPoliciesGetEffectiveFirewallsResponseEffectiveFirewallPolicy/Type.php delete mode 100644 Compute/src/V1/Enums/Reservation/DeploymentType.php delete mode 100644 Compute/src/V1/Enums/Reservation/SchedulingType.php delete mode 100644 Compute/src/V1/Enums/Reservation/Status.php delete mode 100644 Compute/src/V1/Enums/ReservationAdvancedDeploymentControl/ReservationOperationalMode.php delete mode 100644 Compute/src/V1/Enums/ReservationAffinity/ConsumeReservationType.php delete mode 100644 Compute/src/V1/Enums/ReservationBlock/Status.php delete mode 100644 Compute/src/V1/Enums/ReservationBlockHealthInfo/HealthStatus.php delete mode 100644 Compute/src/V1/Enums/ReservationSubBlock/Status.php delete mode 100644 Compute/src/V1/Enums/ReservationSubBlockHealthInfo/HealthStatus.php delete mode 100644 Compute/src/V1/Enums/ReservationsBlocksPerformMaintenanceRequest/MaintenanceScope.php delete mode 100644 Compute/src/V1/Enums/ReservationsPerformMaintenanceRequest/MaintenanceScope.php delete mode 100644 Compute/src/V1/Enums/ResourceCommitment/Type.php delete mode 100644 Compute/src/V1/Enums/ResourcePolicy/Status.php delete mode 100644 Compute/src/V1/Enums/ResourcePolicyGroupPlacementPolicy/Collocation.php delete mode 100644 Compute/src/V1/Enums/ResourcePolicySnapshotSchedulePolicyRetentionPolicy/OnSourceDiskDelete.php delete mode 100644 Compute/src/V1/Enums/ResourcePolicyWeeklyCycleDayOfWeek/Day.php delete mode 100644 Compute/src/V1/Enums/ResourcePolicyWorkloadPolicy/MaxTopologyDistance.php delete mode 100644 Compute/src/V1/Enums/ResourcePolicyWorkloadPolicy/Type.php delete mode 100644 Compute/src/V1/Enums/Route/NextHopOrigin.php delete mode 100644 Compute/src/V1/Enums/Route/RouteStatus.php delete mode 100644 Compute/src/V1/Enums/Route/RouteType.php delete mode 100644 Compute/src/V1/Enums/RouteAsPath/PathSegmentType.php delete mode 100644 Compute/src/V1/Enums/RoutePolicy/Type.php delete mode 100644 Compute/src/V1/Enums/RouterBgp/AdvertiseMode.php delete mode 100644 Compute/src/V1/Enums/RouterBgp/AdvertisedGroups.php delete mode 100644 Compute/src/V1/Enums/RouterBgpPeer/AdvertiseMode.php delete mode 100644 Compute/src/V1/Enums/RouterBgpPeer/AdvertisedGroups.php delete mode 100644 Compute/src/V1/Enums/RouterBgpPeer/Enable.php delete mode 100644 Compute/src/V1/Enums/RouterBgpPeer/ManagementType.php delete mode 100644 Compute/src/V1/Enums/RouterBgpPeerBfd/SessionInitializationMode.php delete mode 100644 Compute/src/V1/Enums/RouterInterface/IpVersion.php delete mode 100644 Compute/src/V1/Enums/RouterInterface/ManagementType.php delete mode 100644 Compute/src/V1/Enums/RouterNat/AutoNetworkTier.php delete mode 100644 Compute/src/V1/Enums/RouterNat/EndpointTypes.php delete mode 100644 Compute/src/V1/Enums/RouterNat/NatIpAllocateOption.php delete mode 100644 Compute/src/V1/Enums/RouterNat/SourceSubnetworkIpRangesToNat.php delete mode 100644 Compute/src/V1/Enums/RouterNat/SourceSubnetworkIpRangesToNat64.php delete mode 100644 Compute/src/V1/Enums/RouterNat/Type.php delete mode 100644 Compute/src/V1/Enums/RouterNatLogConfig/Filter.php delete mode 100644 Compute/src/V1/Enums/RouterNatSubnetworkToNat/SourceIpRangesToNat.php delete mode 100644 Compute/src/V1/Enums/RouterStatusBgpPeerStatus/Status.php delete mode 100644 Compute/src/V1/Enums/RouterStatusBgpPeerStatus/StatusReason.php delete mode 100644 Compute/src/V1/Enums/Rule/Action.php delete mode 100644 Compute/src/V1/Enums/SSLHealthCheck/PortSpecification.php delete mode 100644 Compute/src/V1/Enums/SSLHealthCheck/ProxyHeader.php delete mode 100644 Compute/src/V1/Enums/SavedAttachedDisk/Mode.php delete mode 100644 Compute/src/V1/Enums/SavedAttachedDisk/PBInterface.php delete mode 100644 Compute/src/V1/Enums/SavedAttachedDisk/StorageBytesStatus.php delete mode 100644 Compute/src/V1/Enums/SavedAttachedDisk/Type.php delete mode 100644 Compute/src/V1/Enums/SavedDisk/Architecture.php delete mode 100644 Compute/src/V1/Enums/SavedDisk/StorageBytesStatus.php delete mode 100644 Compute/src/V1/Enums/ScalingScheduleStatus/State.php delete mode 100644 Compute/src/V1/Enums/Scheduling/InstanceTerminationAction.php delete mode 100644 Compute/src/V1/Enums/Scheduling/OnHostMaintenance.php delete mode 100644 Compute/src/V1/Enums/Scheduling/ProvisioningModel.php delete mode 100644 Compute/src/V1/Enums/SchedulingNodeAffinity/Operator.php delete mode 100644 Compute/src/V1/Enums/SecurityPolicy/Type.php delete mode 100644 Compute/src/V1/Enums/SecurityPolicyAdaptiveProtectionConfigLayer7DdosDefenseConfig/RuleVisibility.php delete mode 100644 Compute/src/V1/Enums/SecurityPolicyAdaptiveProtectionConfigLayer7DdosDefenseConfigThresholdConfigTrafficGranularityConfig/Type.php delete mode 100644 Compute/src/V1/Enums/SecurityPolicyAdvancedOptionsConfig/JsonParsing.php delete mode 100644 Compute/src/V1/Enums/SecurityPolicyAdvancedOptionsConfig/LogLevel.php delete mode 100644 Compute/src/V1/Enums/SecurityPolicyDdosProtectionConfig/DdosProtection.php delete mode 100644 Compute/src/V1/Enums/SecurityPolicyRuleMatcher/VersionedExpr.php delete mode 100644 Compute/src/V1/Enums/SecurityPolicyRulePreconfiguredWafConfigExclusionFieldParams/Op.php delete mode 100644 Compute/src/V1/Enums/SecurityPolicyRuleRateLimitOptions/EnforceOnKey.php delete mode 100644 Compute/src/V1/Enums/SecurityPolicyRuleRateLimitOptionsEnforceOnKeyConfig/EnforceOnKeyType.php delete mode 100644 Compute/src/V1/Enums/SecurityPolicyRuleRedirectOptions/Type.php delete mode 100644 Compute/src/V1/Enums/SecurityPolicyUserDefinedField/Base.php delete mode 100644 Compute/src/V1/Enums/ServerBinding/Type.php delete mode 100644 Compute/src/V1/Enums/ServiceAttachment/ConnectionPreference.php delete mode 100644 Compute/src/V1/Enums/ServiceAttachmentConnectedEndpoint/Status.php delete mode 100644 Compute/src/V1/Enums/SetCommonInstanceMetadataOperationMetadataPerLocationOperationInfo/State.php delete mode 100644 Compute/src/V1/Enums/ShareSettings/ShareType.php delete mode 100644 Compute/src/V1/Enums/Snapshot/Architecture.php delete mode 100644 Compute/src/V1/Enums/Snapshot/SnapshotType.php delete mode 100644 Compute/src/V1/Enums/Snapshot/Status.php delete mode 100644 Compute/src/V1/Enums/Snapshot/StorageBytesStatus.php delete mode 100644 Compute/src/V1/Enums/SnapshotSettingsStorageLocationSettings/Policy.php delete mode 100644 Compute/src/V1/Enums/SourceInstanceProperties/KeyRevocationActionType.php delete mode 100644 Compute/src/V1/Enums/SslCertificate/Type.php delete mode 100644 Compute/src/V1/Enums/SslCertificateManagedSslCertificate/Status.php delete mode 100644 Compute/src/V1/Enums/SslPolicy/MinTlsVersion.php delete mode 100644 Compute/src/V1/Enums/SslPolicy/Profile.php delete mode 100644 Compute/src/V1/Enums/StatefulPolicyPreservedStateDiskDevice/AutoDelete.php delete mode 100644 Compute/src/V1/Enums/StatefulPolicyPreservedStateNetworkIp/AutoDelete.php delete mode 100644 Compute/src/V1/Enums/StoragePool/CapacityProvisioningType.php delete mode 100644 Compute/src/V1/Enums/StoragePool/PerformanceProvisioningType.php delete mode 100644 Compute/src/V1/Enums/StoragePool/State.php delete mode 100644 Compute/src/V1/Enums/StoragePoolDisk/Status.php delete mode 100644 Compute/src/V1/Enums/Subnetwork/Ipv6AccessType.php delete mode 100644 Compute/src/V1/Enums/Subnetwork/Ipv6GceEndpoint.php delete mode 100644 Compute/src/V1/Enums/Subnetwork/PrivateIpv6GoogleAccess.php delete mode 100644 Compute/src/V1/Enums/Subnetwork/Purpose.php delete mode 100644 Compute/src/V1/Enums/Subnetwork/Role.php delete mode 100644 Compute/src/V1/Enums/Subnetwork/StackType.php delete mode 100644 Compute/src/V1/Enums/Subnetwork/State.php delete mode 100644 Compute/src/V1/Enums/SubnetworkLogConfig/AggregationInterval.php delete mode 100644 Compute/src/V1/Enums/SubnetworkLogConfig/Metadata.php delete mode 100644 Compute/src/V1/Enums/Subsetting/Policy.php delete mode 100644 Compute/src/V1/Enums/TCPHealthCheck/PortSpecification.php delete mode 100644 Compute/src/V1/Enums/TCPHealthCheck/ProxyHeader.php delete mode 100644 Compute/src/V1/Enums/TargetHttpsProxiesSetQuicOverrideRequest/QuicOverride.php delete mode 100644 Compute/src/V1/Enums/TargetHttpsProxy/QuicOverride.php delete mode 100644 Compute/src/V1/Enums/TargetHttpsProxy/TlsEarlyData.php delete mode 100644 Compute/src/V1/Enums/TargetInstance/NatPolicy.php delete mode 100644 Compute/src/V1/Enums/TargetPool/SessionAffinity.php delete mode 100644 Compute/src/V1/Enums/TargetSslProxiesSetProxyHeaderRequest/ProxyHeader.php delete mode 100644 Compute/src/V1/Enums/TargetSslProxy/ProxyHeader.php delete mode 100644 Compute/src/V1/Enums/TargetTcpProxiesSetProxyHeaderRequest/ProxyHeader.php delete mode 100644 Compute/src/V1/Enums/TargetTcpProxy/ProxyHeader.php delete mode 100644 Compute/src/V1/Enums/TargetVpnGateway/Status.php delete mode 100644 Compute/src/V1/Enums/UpcomingMaintenance/MaintenanceReasons.php delete mode 100644 Compute/src/V1/Enums/UpcomingMaintenance/MaintenanceStatus.php delete mode 100644 Compute/src/V1/Enums/UpcomingMaintenance/Type.php delete mode 100644 Compute/src/V1/Enums/UpdateInstanceRequest/MinimalAction.php delete mode 100644 Compute/src/V1/Enums/UpdateInstanceRequest/MostDisruptiveAllowedAction.php delete mode 100644 Compute/src/V1/Enums/UrlMapsValidateRequest/LoadBalancingSchemes.php delete mode 100644 Compute/src/V1/Enums/UsableSubnetwork/Ipv6AccessType.php delete mode 100644 Compute/src/V1/Enums/UsableSubnetwork/Purpose.php delete mode 100644 Compute/src/V1/Enums/UsableSubnetwork/Role.php delete mode 100644 Compute/src/V1/Enums/UsableSubnetwork/StackType.php delete mode 100644 Compute/src/V1/Enums/VpnGateway/GatewayIpVersion.php delete mode 100644 Compute/src/V1/Enums/VpnGateway/StackType.php delete mode 100644 Compute/src/V1/Enums/VpnGatewayStatusHighAvailabilityRequirementState/State.php delete mode 100644 Compute/src/V1/Enums/VpnGatewayStatusHighAvailabilityRequirementState/UnsatisfiedReason.php delete mode 100644 Compute/src/V1/Enums/VpnTunnel/Status.php delete mode 100644 Compute/src/V1/Enums/Warning/Code.php delete mode 100644 Compute/src/V1/Enums/Warnings/Code.php delete mode 100644 Compute/src/V1/Enums/XpnResourceId/Type.php delete mode 100644 Compute/src/V1/Enums/Zone/Status.php delete mode 100644 Compute/src/V1/ExternalVpnGatewaysClient.php delete mode 100644 Compute/src/V1/FirewallPoliciesClient.php delete mode 100644 Compute/src/V1/FirewallsClient.php delete mode 100644 Compute/src/V1/ForwardingRule/IPProtocol.php delete mode 100644 Compute/src/V1/ForwardingRulesClient.php delete mode 100644 Compute/src/V1/Gapic/AcceleratorTypesGapicClient.php delete mode 100644 Compute/src/V1/Gapic/AddressesGapicClient.php delete mode 100644 Compute/src/V1/Gapic/AutoscalersGapicClient.php delete mode 100644 Compute/src/V1/Gapic/BackendBucketsGapicClient.php delete mode 100644 Compute/src/V1/Gapic/BackendServicesGapicClient.php delete mode 100644 Compute/src/V1/Gapic/DiskTypesGapicClient.php delete mode 100644 Compute/src/V1/Gapic/DisksGapicClient.php delete mode 100644 Compute/src/V1/Gapic/ExternalVpnGatewaysGapicClient.php delete mode 100644 Compute/src/V1/Gapic/FirewallPoliciesGapicClient.php delete mode 100644 Compute/src/V1/Gapic/FirewallsGapicClient.php delete mode 100644 Compute/src/V1/Gapic/ForwardingRulesGapicClient.php delete mode 100644 Compute/src/V1/Gapic/GlobalAddressesGapicClient.php delete mode 100644 Compute/src/V1/Gapic/GlobalForwardingRulesGapicClient.php delete mode 100644 Compute/src/V1/Gapic/GlobalNetworkEndpointGroupsGapicClient.php delete mode 100644 Compute/src/V1/Gapic/GlobalOperationsGapicClient.php delete mode 100644 Compute/src/V1/Gapic/GlobalOrganizationOperationsGapicClient.php delete mode 100644 Compute/src/V1/Gapic/GlobalPublicDelegatedPrefixesGapicClient.php delete mode 100644 Compute/src/V1/Gapic/HealthChecksGapicClient.php delete mode 100644 Compute/src/V1/Gapic/ImageFamilyViewsGapicClient.php delete mode 100644 Compute/src/V1/Gapic/ImagesGapicClient.php delete mode 100644 Compute/src/V1/Gapic/InstanceGroupManagerResizeRequestsGapicClient.php delete mode 100644 Compute/src/V1/Gapic/InstanceGroupManagersGapicClient.php delete mode 100644 Compute/src/V1/Gapic/InstanceGroupsGapicClient.php delete mode 100644 Compute/src/V1/Gapic/InstanceSettingsServiceGapicClient.php delete mode 100644 Compute/src/V1/Gapic/InstanceTemplatesGapicClient.php delete mode 100644 Compute/src/V1/Gapic/InstancesGapicClient.php delete mode 100644 Compute/src/V1/Gapic/InstantSnapshotsGapicClient.php delete mode 100644 Compute/src/V1/Gapic/InterconnectAttachmentGroupsGapicClient.php delete mode 100644 Compute/src/V1/Gapic/InterconnectAttachmentsGapicClient.php delete mode 100644 Compute/src/V1/Gapic/InterconnectGroupsGapicClient.php delete mode 100644 Compute/src/V1/Gapic/InterconnectLocationsGapicClient.php delete mode 100644 Compute/src/V1/Gapic/InterconnectRemoteLocationsGapicClient.php delete mode 100644 Compute/src/V1/Gapic/InterconnectsGapicClient.php delete mode 100644 Compute/src/V1/Gapic/LicenseCodesGapicClient.php delete mode 100644 Compute/src/V1/Gapic/LicensesGapicClient.php delete mode 100644 Compute/src/V1/Gapic/MachineImagesGapicClient.php delete mode 100644 Compute/src/V1/Gapic/MachineTypesGapicClient.php delete mode 100644 Compute/src/V1/Gapic/NetworkAttachmentsGapicClient.php delete mode 100644 Compute/src/V1/Gapic/NetworkEdgeSecurityServicesGapicClient.php delete mode 100644 Compute/src/V1/Gapic/NetworkEndpointGroupsGapicClient.php delete mode 100644 Compute/src/V1/Gapic/NetworkFirewallPoliciesGapicClient.php delete mode 100644 Compute/src/V1/Gapic/NetworkProfilesGapicClient.php delete mode 100644 Compute/src/V1/Gapic/NetworksGapicClient.php delete mode 100644 Compute/src/V1/Gapic/NodeGroupsGapicClient.php delete mode 100644 Compute/src/V1/Gapic/NodeTemplatesGapicClient.php delete mode 100644 Compute/src/V1/Gapic/NodeTypesGapicClient.php delete mode 100644 Compute/src/V1/Gapic/PacketMirroringsGapicClient.php delete mode 100644 Compute/src/V1/Gapic/ProjectsGapicClient.php delete mode 100644 Compute/src/V1/Gapic/PublicAdvertisedPrefixesGapicClient.php delete mode 100644 Compute/src/V1/Gapic/PublicDelegatedPrefixesGapicClient.php delete mode 100644 Compute/src/V1/Gapic/RegionAutoscalersGapicClient.php delete mode 100644 Compute/src/V1/Gapic/RegionBackendServicesGapicClient.php delete mode 100644 Compute/src/V1/Gapic/RegionCommitmentsGapicClient.php delete mode 100644 Compute/src/V1/Gapic/RegionDiskTypesGapicClient.php delete mode 100644 Compute/src/V1/Gapic/RegionDisksGapicClient.php delete mode 100644 Compute/src/V1/Gapic/RegionHealthCheckServicesGapicClient.php delete mode 100644 Compute/src/V1/Gapic/RegionHealthChecksGapicClient.php delete mode 100644 Compute/src/V1/Gapic/RegionInstanceGroupManagersGapicClient.php delete mode 100644 Compute/src/V1/Gapic/RegionInstanceGroupsGapicClient.php delete mode 100644 Compute/src/V1/Gapic/RegionInstanceTemplatesGapicClient.php delete mode 100644 Compute/src/V1/Gapic/RegionInstancesGapicClient.php delete mode 100644 Compute/src/V1/Gapic/RegionInstantSnapshotsGapicClient.php delete mode 100644 Compute/src/V1/Gapic/RegionNetworkEndpointGroupsGapicClient.php delete mode 100644 Compute/src/V1/Gapic/RegionNetworkFirewallPoliciesGapicClient.php delete mode 100644 Compute/src/V1/Gapic/RegionNotificationEndpointsGapicClient.php delete mode 100644 Compute/src/V1/Gapic/RegionOperationsGapicClient.php delete mode 100644 Compute/src/V1/Gapic/RegionSecurityPoliciesGapicClient.php delete mode 100644 Compute/src/V1/Gapic/RegionSslCertificatesGapicClient.php delete mode 100644 Compute/src/V1/Gapic/RegionSslPoliciesGapicClient.php delete mode 100644 Compute/src/V1/Gapic/RegionTargetHttpProxiesGapicClient.php delete mode 100644 Compute/src/V1/Gapic/RegionTargetHttpsProxiesGapicClient.php delete mode 100644 Compute/src/V1/Gapic/RegionTargetTcpProxiesGapicClient.php delete mode 100644 Compute/src/V1/Gapic/RegionUrlMapsGapicClient.php delete mode 100644 Compute/src/V1/Gapic/RegionZonesGapicClient.php delete mode 100644 Compute/src/V1/Gapic/RegionsGapicClient.php delete mode 100644 Compute/src/V1/Gapic/ReservationBlocksGapicClient.php delete mode 100644 Compute/src/V1/Gapic/ReservationSubBlocksGapicClient.php delete mode 100644 Compute/src/V1/Gapic/ReservationsGapicClient.php delete mode 100644 Compute/src/V1/Gapic/ResourcePoliciesGapicClient.php delete mode 100644 Compute/src/V1/Gapic/RoutersGapicClient.php delete mode 100644 Compute/src/V1/Gapic/RoutesGapicClient.php delete mode 100644 Compute/src/V1/Gapic/SecurityPoliciesGapicClient.php delete mode 100644 Compute/src/V1/Gapic/ServiceAttachmentsGapicClient.php delete mode 100644 Compute/src/V1/Gapic/SnapshotSettingsServiceGapicClient.php delete mode 100644 Compute/src/V1/Gapic/SnapshotsGapicClient.php delete mode 100644 Compute/src/V1/Gapic/SslCertificatesGapicClient.php delete mode 100644 Compute/src/V1/Gapic/SslPoliciesGapicClient.php delete mode 100644 Compute/src/V1/Gapic/StoragePoolTypesGapicClient.php delete mode 100644 Compute/src/V1/Gapic/StoragePoolsGapicClient.php delete mode 100644 Compute/src/V1/Gapic/SubnetworksGapicClient.php delete mode 100644 Compute/src/V1/Gapic/TargetGrpcProxiesGapicClient.php delete mode 100644 Compute/src/V1/Gapic/TargetHttpProxiesGapicClient.php delete mode 100644 Compute/src/V1/Gapic/TargetHttpsProxiesGapicClient.php delete mode 100644 Compute/src/V1/Gapic/TargetInstancesGapicClient.php delete mode 100644 Compute/src/V1/Gapic/TargetPoolsGapicClient.php delete mode 100644 Compute/src/V1/Gapic/TargetSslProxiesGapicClient.php delete mode 100644 Compute/src/V1/Gapic/TargetTcpProxiesGapicClient.php delete mode 100644 Compute/src/V1/Gapic/TargetVpnGatewaysGapicClient.php delete mode 100644 Compute/src/V1/Gapic/UrlMapsGapicClient.php delete mode 100644 Compute/src/V1/Gapic/VpnGatewaysGapicClient.php delete mode 100644 Compute/src/V1/Gapic/VpnTunnelsGapicClient.php delete mode 100644 Compute/src/V1/Gapic/ZoneOperationsGapicClient.php delete mode 100644 Compute/src/V1/Gapic/ZonesGapicClient.php delete mode 100644 Compute/src/V1/GlobalAddressesClient.php delete mode 100644 Compute/src/V1/GlobalForwardingRulesClient.php delete mode 100644 Compute/src/V1/GlobalNetworkEndpointGroupsClient.php delete mode 100644 Compute/src/V1/GlobalOperationsClient.php delete mode 100644 Compute/src/V1/GlobalOrganizationOperationsClient.php delete mode 100644 Compute/src/V1/GlobalPublicDelegatedPrefixesClient.php delete mode 100644 Compute/src/V1/HealthChecksClient.php delete mode 100644 Compute/src/V1/ImageFamilyViewsClient.php delete mode 100644 Compute/src/V1/ImagesClient.php delete mode 100644 Compute/src/V1/InstanceGroupManagerResizeRequestsClient.php delete mode 100644 Compute/src/V1/InstanceGroupManagersClient.php delete mode 100644 Compute/src/V1/InstanceGroupsClient.php delete mode 100644 Compute/src/V1/InstanceSettingsServiceClient.php delete mode 100644 Compute/src/V1/InstanceTemplatesClient.php delete mode 100644 Compute/src/V1/InstancesClient.php delete mode 100644 Compute/src/V1/InstantSnapshotsClient.php delete mode 100644 Compute/src/V1/InterconnectAttachmentGroupsClient.php delete mode 100644 Compute/src/V1/InterconnectAttachmentsClient.php delete mode 100644 Compute/src/V1/InterconnectGroupsClient.php delete mode 100644 Compute/src/V1/InterconnectLocationsClient.php delete mode 100644 Compute/src/V1/InterconnectRemoteLocationsClient.php delete mode 100644 Compute/src/V1/InterconnectsClient.php delete mode 100644 Compute/src/V1/LicenseCodesClient.php delete mode 100644 Compute/src/V1/LicensesClient.php delete mode 100644 Compute/src/V1/LogConfig.php delete mode 100644 Compute/src/V1/LogConfigCloudAuditOptions.php delete mode 100644 Compute/src/V1/LogConfigCloudAuditOptions/LogName.php delete mode 100644 Compute/src/V1/LogConfigCounterOptions.php delete mode 100644 Compute/src/V1/LogConfigCounterOptionsCustomField.php delete mode 100644 Compute/src/V1/LogConfigDataAccessOptions.php delete mode 100644 Compute/src/V1/LogConfigDataAccessOptions/LogMode.php delete mode 100644 Compute/src/V1/MachineImagesClient.php delete mode 100644 Compute/src/V1/MachineTypesClient.php delete mode 100644 Compute/src/V1/NetworkAttachmentsClient.php delete mode 100644 Compute/src/V1/NetworkEdgeSecurityServicesClient.php delete mode 100644 Compute/src/V1/NetworkEndpointGroupsClient.php delete mode 100644 Compute/src/V1/NetworkFirewallPoliciesClient.php delete mode 100644 Compute/src/V1/NetworkProfilesClient.php delete mode 100644 Compute/src/V1/NetworksClient.php delete mode 100644 Compute/src/V1/NodeGroupsClient.php delete mode 100644 Compute/src/V1/NodeTemplatesClient.php delete mode 100644 Compute/src/V1/NodeTypesClient.php delete mode 100644 Compute/src/V1/PacketMirroringsClient.php delete mode 100644 Compute/src/V1/ProjectsClient.php delete mode 100644 Compute/src/V1/PublicAdvertisedPrefixesClient.php delete mode 100644 Compute/src/V1/PublicDelegatedPrefixesClient.php delete mode 100644 Compute/src/V1/README.md delete mode 100644 Compute/src/V1/RegionAutoscalersClient.php delete mode 100644 Compute/src/V1/RegionBackendServicesClient.php delete mode 100644 Compute/src/V1/RegionCommitmentsClient.php delete mode 100644 Compute/src/V1/RegionDiskTypesClient.php delete mode 100644 Compute/src/V1/RegionDisksClient.php delete mode 100644 Compute/src/V1/RegionHealthCheckServicesClient.php delete mode 100644 Compute/src/V1/RegionHealthChecksClient.php delete mode 100644 Compute/src/V1/RegionInstanceGroupManagersClient.php delete mode 100644 Compute/src/V1/RegionInstanceGroupsClient.php delete mode 100644 Compute/src/V1/RegionInstanceTemplatesClient.php delete mode 100644 Compute/src/V1/RegionInstancesClient.php delete mode 100644 Compute/src/V1/RegionInstantSnapshotsClient.php delete mode 100644 Compute/src/V1/RegionNetworkEndpointGroupsClient.php delete mode 100644 Compute/src/V1/RegionNetworkFirewallPoliciesClient.php delete mode 100644 Compute/src/V1/RegionNotificationEndpointsClient.php delete mode 100644 Compute/src/V1/RegionOperationsClient.php delete mode 100644 Compute/src/V1/RegionSecurityPoliciesClient.php delete mode 100644 Compute/src/V1/RegionSslCertificatesClient.php delete mode 100644 Compute/src/V1/RegionSslPoliciesClient.php delete mode 100644 Compute/src/V1/RegionTargetHttpProxiesClient.php delete mode 100644 Compute/src/V1/RegionTargetHttpsProxiesClient.php delete mode 100644 Compute/src/V1/RegionTargetTcpProxiesClient.php delete mode 100644 Compute/src/V1/RegionUrlMapsClient.php delete mode 100644 Compute/src/V1/RegionZonesClient.php delete mode 100644 Compute/src/V1/RegionsClient.php delete mode 100644 Compute/src/V1/ReservationBlocksClient.php delete mode 100644 Compute/src/V1/ReservationSubBlocksClient.php delete mode 100644 Compute/src/V1/ReservationsClient.php delete mode 100644 Compute/src/V1/ResourcePoliciesClient.php delete mode 100644 Compute/src/V1/RoutersClient.php delete mode 100644 Compute/src/V1/RoutesClient.php delete mode 100644 Compute/src/V1/Rule.php delete mode 100644 Compute/src/V1/Rule/Action.php delete mode 100644 Compute/src/V1/ScratchDisks.php delete mode 100644 Compute/src/V1/SecurityPoliciesClient.php delete mode 100644 Compute/src/V1/ServiceAttachmentsClient.php delete mode 100644 Compute/src/V1/SnapshotSettingsServiceClient.php delete mode 100644 Compute/src/V1/SnapshotsClient.php delete mode 100644 Compute/src/V1/SslCertificatesClient.php delete mode 100644 Compute/src/V1/SslPoliciesClient.php delete mode 100644 Compute/src/V1/StoragePoolTypesClient.php delete mode 100644 Compute/src/V1/StoragePoolsClient.php delete mode 100644 Compute/src/V1/SubnetworksClient.php delete mode 100644 Compute/src/V1/TargetGrpcProxiesClient.php delete mode 100644 Compute/src/V1/TargetHttpProxiesClient.php delete mode 100644 Compute/src/V1/TargetHttpsProxiesClient.php delete mode 100644 Compute/src/V1/TargetInstancesClient.php delete mode 100644 Compute/src/V1/TargetPoolsClient.php delete mode 100644 Compute/src/V1/TargetSslProxiesClient.php delete mode 100644 Compute/src/V1/TargetTcpProxiesClient.php delete mode 100644 Compute/src/V1/TargetVpnGatewaysClient.php delete mode 100644 Compute/src/V1/UrlMapsClient.php delete mode 100644 Compute/src/V1/VpnGatewaysClient.php delete mode 100644 Compute/src/V1/VpnTunnelsClient.php delete mode 100644 Compute/src/V1/ZoneOperationsClient.php delete mode 100644 Compute/src/V1/ZonesClient.php delete mode 100644 Compute/tests/System/V1/AddressTest.php delete mode 100644 Compute/tests/System/V1/FirewallsTest.php delete mode 100644 Compute/tests/System/V1/PaginationTest.php delete mode 100644 Compute/tests/System/V1/SmokeTest.php delete mode 100644 Compute/tests/Unit/V1/AcceleratorTypesClientTest.php delete mode 100644 Compute/tests/Unit/V1/AddressesClientTest.php delete mode 100644 Compute/tests/Unit/V1/AutoscalersClientTest.php delete mode 100644 Compute/tests/Unit/V1/BackendBucketsClientTest.php delete mode 100644 Compute/tests/Unit/V1/BackendServicesClientTest.php delete mode 100644 Compute/tests/Unit/V1/DiskTypesClientTest.php delete mode 100644 Compute/tests/Unit/V1/DisksClientTest.php delete mode 100644 Compute/tests/Unit/V1/ExternalVpnGatewaysClientTest.php delete mode 100644 Compute/tests/Unit/V1/FirewallPoliciesClientTest.php delete mode 100644 Compute/tests/Unit/V1/FirewallsClientTest.php delete mode 100644 Compute/tests/Unit/V1/ForwardingRulesClientTest.php delete mode 100644 Compute/tests/Unit/V1/GlobalAddressesClientTest.php delete mode 100644 Compute/tests/Unit/V1/GlobalForwardingRulesClientTest.php delete mode 100644 Compute/tests/Unit/V1/GlobalNetworkEndpointGroupsClientTest.php delete mode 100644 Compute/tests/Unit/V1/GlobalOperationsClientTest.php delete mode 100644 Compute/tests/Unit/V1/GlobalOrganizationOperationsClientTest.php delete mode 100644 Compute/tests/Unit/V1/GlobalPublicDelegatedPrefixesClientTest.php delete mode 100644 Compute/tests/Unit/V1/HealthChecksClientTest.php delete mode 100644 Compute/tests/Unit/V1/ImageFamilyViewsClientTest.php delete mode 100644 Compute/tests/Unit/V1/ImagesClientTest.php delete mode 100644 Compute/tests/Unit/V1/InstanceGroupManagerResizeRequestsClientTest.php delete mode 100644 Compute/tests/Unit/V1/InstanceGroupManagersClientTest.php delete mode 100644 Compute/tests/Unit/V1/InstanceGroupsClientTest.php delete mode 100644 Compute/tests/Unit/V1/InstanceSettingsServiceClientTest.php delete mode 100644 Compute/tests/Unit/V1/InstanceTemplatesClientTest.php delete mode 100644 Compute/tests/Unit/V1/InstancesClientTest.php delete mode 100644 Compute/tests/Unit/V1/InstantSnapshotsClientTest.php delete mode 100644 Compute/tests/Unit/V1/InterconnectAttachmentGroupsClientTest.php delete mode 100644 Compute/tests/Unit/V1/InterconnectAttachmentsClientTest.php delete mode 100644 Compute/tests/Unit/V1/InterconnectGroupsClientTest.php delete mode 100644 Compute/tests/Unit/V1/InterconnectLocationsClientTest.php delete mode 100644 Compute/tests/Unit/V1/InterconnectRemoteLocationsClientTest.php delete mode 100644 Compute/tests/Unit/V1/InterconnectsClientTest.php delete mode 100644 Compute/tests/Unit/V1/LicenseCodesClientTest.php delete mode 100644 Compute/tests/Unit/V1/LicensesClientTest.php delete mode 100644 Compute/tests/Unit/V1/MachineImagesClientTest.php delete mode 100644 Compute/tests/Unit/V1/MachineTypesClientTest.php delete mode 100644 Compute/tests/Unit/V1/NetworkAttachmentsClientTest.php delete mode 100644 Compute/tests/Unit/V1/NetworkEdgeSecurityServicesClientTest.php delete mode 100644 Compute/tests/Unit/V1/NetworkEndpointGroupsClientTest.php delete mode 100644 Compute/tests/Unit/V1/NetworkFirewallPoliciesClientTest.php delete mode 100644 Compute/tests/Unit/V1/NetworkProfilesClientTest.php delete mode 100644 Compute/tests/Unit/V1/NetworksClientTest.php delete mode 100644 Compute/tests/Unit/V1/NodeGroupsClientTest.php delete mode 100644 Compute/tests/Unit/V1/NodeTemplatesClientTest.php delete mode 100644 Compute/tests/Unit/V1/NodeTypesClientTest.php delete mode 100644 Compute/tests/Unit/V1/PacketMirroringsClientTest.php delete mode 100644 Compute/tests/Unit/V1/ProjectsClientTest.php delete mode 100644 Compute/tests/Unit/V1/PublicAdvertisedPrefixesClientTest.php delete mode 100644 Compute/tests/Unit/V1/PublicDelegatedPrefixesClientTest.php delete mode 100644 Compute/tests/Unit/V1/RegionAutoscalersClientTest.php delete mode 100644 Compute/tests/Unit/V1/RegionBackendServicesClientTest.php delete mode 100644 Compute/tests/Unit/V1/RegionCommitmentsClientTest.php delete mode 100644 Compute/tests/Unit/V1/RegionDiskTypesClientTest.php delete mode 100644 Compute/tests/Unit/V1/RegionDisksClientTest.php delete mode 100644 Compute/tests/Unit/V1/RegionHealthCheckServicesClientTest.php delete mode 100644 Compute/tests/Unit/V1/RegionHealthChecksClientTest.php delete mode 100644 Compute/tests/Unit/V1/RegionInstanceGroupManagersClientTest.php delete mode 100644 Compute/tests/Unit/V1/RegionInstanceGroupsClientTest.php delete mode 100644 Compute/tests/Unit/V1/RegionInstanceTemplatesClientTest.php delete mode 100644 Compute/tests/Unit/V1/RegionInstancesClientTest.php delete mode 100644 Compute/tests/Unit/V1/RegionInstantSnapshotsClientTest.php delete mode 100644 Compute/tests/Unit/V1/RegionNetworkEndpointGroupsClientTest.php delete mode 100644 Compute/tests/Unit/V1/RegionNetworkFirewallPoliciesClientTest.php delete mode 100644 Compute/tests/Unit/V1/RegionNotificationEndpointsClientTest.php delete mode 100644 Compute/tests/Unit/V1/RegionOperationsClientTest.php delete mode 100644 Compute/tests/Unit/V1/RegionSecurityPoliciesClientTest.php delete mode 100644 Compute/tests/Unit/V1/RegionSslCertificatesClientTest.php delete mode 100644 Compute/tests/Unit/V1/RegionSslPoliciesClientTest.php delete mode 100644 Compute/tests/Unit/V1/RegionTargetHttpProxiesClientTest.php delete mode 100644 Compute/tests/Unit/V1/RegionTargetHttpsProxiesClientTest.php delete mode 100644 Compute/tests/Unit/V1/RegionTargetTcpProxiesClientTest.php delete mode 100644 Compute/tests/Unit/V1/RegionUrlMapsClientTest.php delete mode 100644 Compute/tests/Unit/V1/RegionZonesClientTest.php delete mode 100644 Compute/tests/Unit/V1/RegionsClientTest.php delete mode 100644 Compute/tests/Unit/V1/ReservationBlocksClientTest.php delete mode 100644 Compute/tests/Unit/V1/ReservationSubBlocksClientTest.php delete mode 100644 Compute/tests/Unit/V1/ReservationsClientTest.php delete mode 100644 Compute/tests/Unit/V1/ResourcePoliciesClientTest.php delete mode 100644 Compute/tests/Unit/V1/RoutersClientTest.php delete mode 100644 Compute/tests/Unit/V1/RoutesClientTest.php delete mode 100644 Compute/tests/Unit/V1/SecurityPoliciesClientTest.php delete mode 100644 Compute/tests/Unit/V1/ServiceAttachmentsClientTest.php delete mode 100644 Compute/tests/Unit/V1/SnapshotSettingsServiceClientTest.php delete mode 100644 Compute/tests/Unit/V1/SnapshotsClientTest.php delete mode 100644 Compute/tests/Unit/V1/SslCertificatesClientTest.php delete mode 100644 Compute/tests/Unit/V1/SslPoliciesClientTest.php delete mode 100644 Compute/tests/Unit/V1/StoragePoolTypesClientTest.php delete mode 100644 Compute/tests/Unit/V1/StoragePoolsClientTest.php delete mode 100644 Compute/tests/Unit/V1/SubnetworksClientTest.php delete mode 100644 Compute/tests/Unit/V1/TargetGrpcProxiesClientTest.php delete mode 100644 Compute/tests/Unit/V1/TargetHttpProxiesClientTest.php delete mode 100644 Compute/tests/Unit/V1/TargetHttpsProxiesClientTest.php delete mode 100644 Compute/tests/Unit/V1/TargetInstancesClientTest.php delete mode 100644 Compute/tests/Unit/V1/TargetPoolsClientTest.php delete mode 100644 Compute/tests/Unit/V1/TargetSslProxiesClientTest.php delete mode 100644 Compute/tests/Unit/V1/TargetTcpProxiesClientTest.php delete mode 100644 Compute/tests/Unit/V1/TargetVpnGatewaysClientTest.php delete mode 100644 Compute/tests/Unit/V1/UrlMapsClientTest.php delete mode 100644 Compute/tests/Unit/V1/VpnGatewaysClientTest.php delete mode 100644 Compute/tests/Unit/V1/VpnTunnelsClientTest.php delete mode 100644 Compute/tests/Unit/V1/ZoneOperationsClientTest.php delete mode 100644 Compute/tests/Unit/V1/ZonesClientTest.php diff --git a/Compute/.OwlBot.yaml b/Compute/.OwlBot.yaml index 0868685e9c2c..687501f1de1f 100644 --- a/Compute/.OwlBot.yaml +++ b/Compute/.OwlBot.yaml @@ -1,4 +1,4 @@ deep-copy-regex: - - source: /google/cloud/compute/v1/.*-php/(.*) - dest: /owl-bot-staging/Compute/V1/$1 + - source: /google/cloud/compute/(v1)/.*-php/(.*) + dest: /owl-bot-staging/Compute/$1/$2 api-name: Compute diff --git a/Compute/owlbot.py b/Compute/owlbot.py index cf1ef4a931db..6f9e63ce3403 100644 --- a/Compute/owlbot.py +++ b/Compute/owlbot.py @@ -1,4 +1,4 @@ -# Copyright 2021 Google LLC +# Copyright 2024 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -16,8 +16,9 @@ import logging from pathlib import Path -import synthtool as s import subprocess + +import synthtool as s from synthtool.languages import php from synthtool import _tracked_paths @@ -29,14 +30,7 @@ # Added so that we can pass copy_excludes in the owlbot_main() call _tracked_paths.add(src) -# Exclude backwards-compatibility files for protos -php.owlbot_main( - src=src, - dest=dest, - copy_excludes=[ - src / "*/proto/src/Google/Cloud/Compute/*/*_*.php" - ] -) +php.owlbot_main(src=src, dest=dest) # remove class_alias code s.replace( @@ -47,23 +41,16 @@ + "\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 $""") - -### [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', + 'exec', + '--yes', + '--package=@prettier/plugin-php@^0.16', + '--', + 'prettier', + '**/Client/*', + '--write', + '--parser=php', + '--single-quote', + '--print-width=120']) diff --git a/Compute/src/V1/AWSV4Signature.php b/Compute/src/V1/AWSV4Signature.php index 5c1e6f91a1c8..cf620347465c 100644 --- a/Compute/src/V1/AWSV4Signature.php +++ b/Compute/src/V1/AWSV4Signature.php @@ -21,25 +21,25 @@ class AWSV4Signature extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string access_key = 468922628; */ - private $access_key = null; + protected $access_key = null; /** * The identifier of an access key used for s3 bucket authentication. * * Generated from protobuf field optional string access_key_id = 292975158; */ - private $access_key_id = null; + protected $access_key_id = null; /** * The optional version identifier for the access key. You can use this to keep track of different iterations of your access key. * * Generated from protobuf field optional string access_key_version = 80261277; */ - private $access_key_version = null; + protected $access_key_version = null; /** * The name of the cloud region of your origin. This is a free-form field with the name of the region your cloud uses to host your origin. For example, "us-east-1" for AWS or "us-ashburn-1" for OCI. * * Generated from protobuf field optional string origin_region = 265305645; */ - private $origin_region = null; + protected $origin_region = null; /** * Constructor. diff --git a/Compute/src/V1/AbandonInstancesInstanceGroupManagerRequest.php b/Compute/src/V1/AbandonInstancesInstanceGroupManagerRequest.php index 0be2c89455a0..e4fb4fadf755 100644 --- a/Compute/src/V1/AbandonInstancesInstanceGroupManagerRequest.php +++ b/Compute/src/V1/AbandonInstancesInstanceGroupManagerRequest.php @@ -20,31 +20,31 @@ class AbandonInstancesInstanceGroupManagerRequest extends \Google\Protobuf\Inter * * Generated from protobuf field string instance_group_manager = 249363395 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group_manager = ''; + protected $instance_group_manager = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.InstanceGroupManagersAbandonInstancesRequest instance_group_managers_abandon_instances_request_resource = 320929016 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group_managers_abandon_instances_request_resource = null; + protected $instance_group_managers_abandon_instances_request_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone where the managed instance group is located. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/AbandonInstancesRegionInstanceGroupManagerRequest.php b/Compute/src/V1/AbandonInstancesRegionInstanceGroupManagerRequest.php index 1d7f24bafcd6..ada15c902ddb 100644 --- a/Compute/src/V1/AbandonInstancesRegionInstanceGroupManagerRequest.php +++ b/Compute/src/V1/AbandonInstancesRegionInstanceGroupManagerRequest.php @@ -20,31 +20,31 @@ class AbandonInstancesRegionInstanceGroupManagerRequest extends \Google\Protobuf * * Generated from protobuf field string instance_group_manager = 249363395 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group_manager = ''; + protected $instance_group_manager = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.RegionInstanceGroupManagersAbandonInstancesRequest region_instance_group_managers_abandon_instances_request_resource = 488499491 [(.google.api.field_behavior) = REQUIRED]; */ - private $region_instance_group_managers_abandon_instances_request_resource = null; + protected $region_instance_group_managers_abandon_instances_request_resource = null; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/AcceleratorConfig.php b/Compute/src/V1/AcceleratorConfig.php index fa252e686f41..f54b2d3d8f09 100644 --- a/Compute/src/V1/AcceleratorConfig.php +++ b/Compute/src/V1/AcceleratorConfig.php @@ -20,13 +20,13 @@ class AcceleratorConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int32 accelerator_count = 504879675; */ - private $accelerator_count = null; + protected $accelerator_count = null; /** * Full or partial URL of the accelerator type resource to attach to this instance. For example: projects/my-project/zones/us-central1-c/acceleratorTypes/nvidia-tesla-p100 If you are creating an instance template, specify only the accelerator name. See GPUs on Compute Engine for a full list of accelerator types. * * Generated from protobuf field optional string accelerator_type = 138031246; */ - private $accelerator_type = null; + protected $accelerator_type = null; /** * Constructor. diff --git a/Compute/src/V1/AcceleratorType.php b/Compute/src/V1/AcceleratorType.php index 7a4ffd07cadc..fc39ab2d1fb0 100644 --- a/Compute/src/V1/AcceleratorType.php +++ b/Compute/src/V1/AcceleratorType.php @@ -20,55 +20,55 @@ class AcceleratorType extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * [Output Only] The deprecation status associated with this accelerator type. * * Generated from protobuf field optional .google.cloud.compute.v1.DeprecationStatus deprecated = 515138995; */ - private $deprecated = null; + protected $deprecated = null; /** * [Output Only] An optional textual description of the resource. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * [Output Only] The unique identifier for the resource. This identifier is defined by the server. * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * [Output Only] The type of the resource. Always compute#acceleratorType for accelerator types. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] Maximum number of accelerator cards allowed per instance. * * Generated from protobuf field optional int32 maximum_cards_per_instance = 263814482; */ - private $maximum_cards_per_instance = null; + protected $maximum_cards_per_instance = null; /** * [Output Only] Name of the resource. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * [Output Only] Server-defined, fully qualified URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] The name of the zone where the accelerator type resides, such as us-central1-a. You must specify this field as part of the HTTP request URL. It is not settable as a field in the request body. * * Generated from protobuf field optional string zone = 3744684; */ - private $zone = null; + protected $zone = null; /** * Constructor. diff --git a/Compute/src/V1/AcceleratorTypeAggregatedList.php b/Compute/src/V1/AcceleratorTypeAggregatedList.php index 3edf0602d7b4..b93dc3d9a1ae 100644 --- a/Compute/src/V1/AcceleratorTypeAggregatedList.php +++ b/Compute/src/V1/AcceleratorTypeAggregatedList.php @@ -19,7 +19,7 @@ class AcceleratorTypeAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of AcceleratorTypesScopedList resources. * @@ -31,19 +31,19 @@ class AcceleratorTypeAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Unreachable resources. * @@ -55,7 +55,7 @@ class AcceleratorTypeAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/AcceleratorTypeList.php b/Compute/src/V1/AcceleratorTypeList.php index 7f8203395b1f..bc85350a2c8a 100644 --- a/Compute/src/V1/AcceleratorTypeList.php +++ b/Compute/src/V1/AcceleratorTypeList.php @@ -20,7 +20,7 @@ class AcceleratorTypeList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of AcceleratorType resources. * @@ -32,25 +32,25 @@ class AcceleratorTypeList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/AcceleratorTypesClient.php b/Compute/src/V1/AcceleratorTypesClient.php deleted file mode 100644 index d3341f42d0a7..000000000000 --- a/Compute/src/V1/AcceleratorTypesClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/Accelerators.php b/Compute/src/V1/Accelerators.php index dfe558d20e18..d7c8d6d37d00 100644 --- a/Compute/src/V1/Accelerators.php +++ b/Compute/src/V1/Accelerators.php @@ -19,13 +19,13 @@ class Accelerators extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int32 guest_accelerator_count = 479079316; */ - private $guest_accelerator_count = null; + protected $guest_accelerator_count = null; /** * The accelerator type resource name, not a full URL, e.g. nvidia-tesla-t4. * * Generated from protobuf field optional string guest_accelerator_type = 293064725; */ - private $guest_accelerator_type = null; + protected $guest_accelerator_type = null; /** * Constructor. diff --git a/Compute/src/V1/AccessConfig.php b/Compute/src/V1/AccessConfig.php index 61522d53fdea..9fe75e709585 100644 --- a/Compute/src/V1/AccessConfig.php +++ b/Compute/src/V1/AccessConfig.php @@ -20,63 +20,63 @@ class AccessConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string external_ipv6 = 532703707; */ - private $external_ipv6 = null; + protected $external_ipv6 = null; /** * Applies to ipv6AccessConfigs only. The prefix length of the external IPv6 range. * * Generated from protobuf field optional int32 external_ipv6_prefix_length = 425672143; */ - private $external_ipv6_prefix_length = null; + protected $external_ipv6_prefix_length = null; /** * [Output Only] Type of the resource. Always compute#accessConfig for access configs. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * The name of this access configuration. In accessConfigs (IPv4), the default and recommended name is External NAT, but you can use any arbitrary string, such as My external IP or Network Access. In ipv6AccessConfigs, the recommend name is External IPv6. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * Applies to accessConfigs (IPv4) only. An external IP address associated with this instance. Specify an unused static external IP address available to the project or leave this field undefined to use an IP from a shared ephemeral IP address pool. If you specify a static external IP address, it must live in the same region as the zone of the instance. * * Generated from protobuf field optional string nat_i_p = 117634556; */ - private $nat_i_p = null; + protected $nat_i_p = null; /** * This signifies the networking tier used for configuring this access configuration and can only take the following values: PREMIUM, STANDARD. If an AccessConfig is specified without a valid external IP address, an ephemeral IP will be created with this networkTier. If an AccessConfig with a valid external IP address is specified, it must match that of the networkTier associated with the Address resource owning that IP. * Check the NetworkTier enum for the list of possible values. * * Generated from protobuf field optional string network_tier = 517397843; */ - private $network_tier = null; + protected $network_tier = null; /** * The DNS domain name for the public PTR record. You can set this field only if the `setPublicPtr` field is enabled in accessConfig. If this field is unspecified in ipv6AccessConfig, a default PTR record will be created for first IP in associated external IPv6 range. * * Generated from protobuf field optional string public_ptr_domain_name = 316599167; */ - private $public_ptr_domain_name = null; + protected $public_ptr_domain_name = null; /** * The resource URL for the security policy associated with this access config. * * Generated from protobuf field optional string security_policy = 171082513; */ - private $security_policy = null; + protected $security_policy = null; /** * Specifies whether a public DNS 'PTR' record should be created to map the external IP address of the instance to a DNS domain name. This field is not used in ipv6AccessConfig. A default PTR record will be created if the VM has external IPv6 range associated. * * Generated from protobuf field optional bool set_public_ptr = 523870229; */ - private $set_public_ptr = null; + protected $set_public_ptr = null; /** * The type of configuration. In accessConfigs (IPv4), the default and only option is ONE_TO_ONE_NAT. In ipv6AccessConfigs, the default and only option is DIRECT_IPV6. * Check the Type enum for the list of possible values. * * Generated from protobuf field optional string type = 3575610; */ - private $type = null; + protected $type = null; /** * Constructor. diff --git a/Compute/src/V1/AddAccessConfigInstanceRequest.php b/Compute/src/V1/AddAccessConfigInstanceRequest.php index 98671d0a9c94..38193ebd2628 100644 --- a/Compute/src/V1/AddAccessConfigInstanceRequest.php +++ b/Compute/src/V1/AddAccessConfigInstanceRequest.php @@ -20,37 +20,37 @@ class AddAccessConfigInstanceRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.compute.v1.AccessConfig access_config_resource = 387825552 [(.google.api.field_behavior) = REQUIRED]; */ - private $access_config_resource = null; + protected $access_config_resource = null; /** * The instance name for this request. * * Generated from protobuf field string instance = 18257045 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance = ''; + protected $instance = ''; /** * The name of the network interface to add to this instance. * * Generated from protobuf field string network_interface = 365387880 [(.google.api.field_behavior) = REQUIRED]; */ - private $network_interface = ''; + protected $network_interface = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/AddAssociationFirewallPolicyRequest.php b/Compute/src/V1/AddAssociationFirewallPolicyRequest.php index 468c74265489..e364b2cb6d90 100644 --- a/Compute/src/V1/AddAssociationFirewallPolicyRequest.php +++ b/Compute/src/V1/AddAssociationFirewallPolicyRequest.php @@ -20,25 +20,25 @@ class AddAssociationFirewallPolicyRequest extends \Google\Protobuf\Internal\Mess * * Generated from protobuf field string firewall_policy = 498173265 [(.google.api.field_behavior) = REQUIRED]; */ - private $firewall_policy = ''; + protected $firewall_policy = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.FirewallPolicyAssociation firewall_policy_association_resource = 259546170 [(.google.api.field_behavior) = REQUIRED]; */ - private $firewall_policy_association_resource = null; + protected $firewall_policy_association_resource = null; /** * Indicates whether or not to replace it if an association of the attachment already exists. This is false by default, in which case an error will be returned if an association already exists. * * Generated from protobuf field optional bool replace_existing_association = 209541240; */ - private $replace_existing_association = null; + protected $replace_existing_association = null; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $firewallPolicy Name of the firewall policy to update. diff --git a/Compute/src/V1/AddAssociationNetworkFirewallPolicyRequest.php b/Compute/src/V1/AddAssociationNetworkFirewallPolicyRequest.php index cfda0a1ccdc9..9d72d53939b8 100644 --- a/Compute/src/V1/AddAssociationNetworkFirewallPolicyRequest.php +++ b/Compute/src/V1/AddAssociationNetworkFirewallPolicyRequest.php @@ -20,31 +20,31 @@ class AddAssociationNetworkFirewallPolicyRequest extends \Google\Protobuf\Intern * * Generated from protobuf field string firewall_policy = 498173265 [(.google.api.field_behavior) = REQUIRED]; */ - private $firewall_policy = ''; + protected $firewall_policy = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.FirewallPolicyAssociation firewall_policy_association_resource = 259546170 [(.google.api.field_behavior) = REQUIRED]; */ - private $firewall_policy_association_resource = null; + protected $firewall_policy_association_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Indicates whether or not to replace it if an association of the attachment already exists. This is false by default, in which case an error will be returned if an association already exists. * * Generated from protobuf field optional bool replace_existing_association = 209541240; */ - private $replace_existing_association = null; + protected $replace_existing_association = null; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/AddAssociationRegionNetworkFirewallPolicyRequest.php b/Compute/src/V1/AddAssociationRegionNetworkFirewallPolicyRequest.php index 30600e38e192..07b9d57253bf 100644 --- a/Compute/src/V1/AddAssociationRegionNetworkFirewallPolicyRequest.php +++ b/Compute/src/V1/AddAssociationRegionNetworkFirewallPolicyRequest.php @@ -20,37 +20,37 @@ class AddAssociationRegionNetworkFirewallPolicyRequest extends \Google\Protobuf\ * * Generated from protobuf field string firewall_policy = 498173265 [(.google.api.field_behavior) = REQUIRED]; */ - private $firewall_policy = ''; + protected $firewall_policy = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.FirewallPolicyAssociation firewall_policy_association_resource = 259546170 [(.google.api.field_behavior) = REQUIRED]; */ - private $firewall_policy_association_resource = null; + protected $firewall_policy_association_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * Indicates whether or not to replace it if an association already exists. This is false by default, in which case an error will be returned if an association already exists. * * Generated from protobuf field optional bool replace_existing_association = 209541240; */ - private $replace_existing_association = null; + protected $replace_existing_association = null; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/AddHealthCheckTargetPoolRequest.php b/Compute/src/V1/AddHealthCheckTargetPoolRequest.php index a564715f9aa9..b44e6f60b3e1 100644 --- a/Compute/src/V1/AddHealthCheckTargetPoolRequest.php +++ b/Compute/src/V1/AddHealthCheckTargetPoolRequest.php @@ -20,31 +20,31 @@ class AddHealthCheckTargetPoolRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name of the target pool to add a health check to. * * Generated from protobuf field string target_pool = 62796298 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_pool = ''; + protected $target_pool = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.TargetPoolsAddHealthCheckRequest target_pools_add_health_check_request_resource = 269573412 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_pools_add_health_check_request_resource = null; + protected $target_pools_add_health_check_request_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/AddInstanceTargetPoolRequest.php b/Compute/src/V1/AddInstanceTargetPoolRequest.php index 3da9430cf68a..e26a6283d4f9 100644 --- a/Compute/src/V1/AddInstanceTargetPoolRequest.php +++ b/Compute/src/V1/AddInstanceTargetPoolRequest.php @@ -20,31 +20,31 @@ class AddInstanceTargetPoolRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name of the TargetPool resource to add instances to. * * Generated from protobuf field string target_pool = 62796298 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_pool = ''; + protected $target_pool = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.TargetPoolsAddInstanceRequest target_pools_add_instance_request_resource = 428796404 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_pools_add_instance_request_resource = null; + protected $target_pools_add_instance_request_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/AddInstancesInstanceGroupRequest.php b/Compute/src/V1/AddInstancesInstanceGroupRequest.php index 06223a3ed77c..82b3270db0ae 100644 --- a/Compute/src/V1/AddInstancesInstanceGroupRequest.php +++ b/Compute/src/V1/AddInstancesInstanceGroupRequest.php @@ -20,31 +20,31 @@ class AddInstancesInstanceGroupRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string instance_group = 81095253 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group = ''; + protected $instance_group = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.InstanceGroupsAddInstancesRequest instance_groups_add_instances_request_resource = 453713246 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_groups_add_instances_request_resource = null; + protected $instance_groups_add_instances_request_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone where the instance group is located. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/AddNodesNodeGroupRequest.php b/Compute/src/V1/AddNodesNodeGroupRequest.php index 2ae34c99e4b8..2b9e93785055 100644 --- a/Compute/src/V1/AddNodesNodeGroupRequest.php +++ b/Compute/src/V1/AddNodesNodeGroupRequest.php @@ -20,31 +20,31 @@ class AddNodesNodeGroupRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string node_group = 469958146 [(.google.api.field_behavior) = REQUIRED]; */ - private $node_group = ''; + protected $node_group = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.NodeGroupsAddNodesRequest node_groups_add_nodes_request_resource = 131263288 [(.google.api.field_behavior) = REQUIRED]; */ - private $node_groups_add_nodes_request_resource = null; + protected $node_groups_add_nodes_request_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/AddPacketMirroringRuleNetworkFirewallPolicyRequest.php b/Compute/src/V1/AddPacketMirroringRuleNetworkFirewallPolicyRequest.php index 967060e7d87b..e89b0c59a0c8 100644 --- a/Compute/src/V1/AddPacketMirroringRuleNetworkFirewallPolicyRequest.php +++ b/Compute/src/V1/AddPacketMirroringRuleNetworkFirewallPolicyRequest.php @@ -20,37 +20,37 @@ class AddPacketMirroringRuleNetworkFirewallPolicyRequest extends \Google\Protobu * * Generated from protobuf field string firewall_policy = 498173265 [(.google.api.field_behavior) = REQUIRED]; */ - private $firewall_policy = ''; + protected $firewall_policy = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.FirewallPolicyRule firewall_policy_rule_resource = 250523523 [(.google.api.field_behavior) = REQUIRED]; */ - private $firewall_policy_rule_resource = null; + protected $firewall_policy_rule_resource = null; /** * When rule.priority is not specified, auto choose a unused priority between minPriority and maxPriority>. This field is exclusive with rule.priority. * * Generated from protobuf field optional int32 max_priority = 329635359; */ - private $max_priority = null; + protected $max_priority = null; /** * When rule.priority is not specified, auto choose a unused priority between minPriority and maxPriority>. This field is exclusive with rule.priority. * * Generated from protobuf field optional int32 min_priority = 267190513; */ - private $min_priority = null; + protected $min_priority = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/AddPeeringNetworkRequest.php b/Compute/src/V1/AddPeeringNetworkRequest.php index 4d07822f2ed1..7801fb7cdbc0 100644 --- a/Compute/src/V1/AddPeeringNetworkRequest.php +++ b/Compute/src/V1/AddPeeringNetworkRequest.php @@ -20,25 +20,25 @@ class AddPeeringNetworkRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string network = 232872494 [(.google.api.field_behavior) = REQUIRED]; */ - private $network = ''; + protected $network = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.NetworksAddPeeringRequest networks_add_peering_request_resource = 388810421 [(.google.api.field_behavior) = REQUIRED]; */ - private $networks_add_peering_request_resource = null; + protected $networks_add_peering_request_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/AddResourcePoliciesDiskRequest.php b/Compute/src/V1/AddResourcePoliciesDiskRequest.php index cd17ca78dbc7..c3e5b1a6ffa6 100644 --- a/Compute/src/V1/AddResourcePoliciesDiskRequest.php +++ b/Compute/src/V1/AddResourcePoliciesDiskRequest.php @@ -20,31 +20,31 @@ class AddResourcePoliciesDiskRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string disk = 3083677 [(.google.api.field_behavior) = REQUIRED]; */ - private $disk = ''; + protected $disk = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.DisksAddResourcePoliciesRequest disks_add_resource_policies_request_resource = 496483363 [(.google.api.field_behavior) = REQUIRED]; */ - private $disks_add_resource_policies_request_resource = null; + protected $disks_add_resource_policies_request_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/AddResourcePoliciesInstanceRequest.php b/Compute/src/V1/AddResourcePoliciesInstanceRequest.php index 443527162b74..db723866ea8d 100644 --- a/Compute/src/V1/AddResourcePoliciesInstanceRequest.php +++ b/Compute/src/V1/AddResourcePoliciesInstanceRequest.php @@ -20,31 +20,31 @@ class AddResourcePoliciesInstanceRequest extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field string instance = 18257045 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance = ''; + protected $instance = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.InstancesAddResourcePoliciesRequest instances_add_resource_policies_request_resource = 489351963 [(.google.api.field_behavior) = REQUIRED]; */ - private $instances_add_resource_policies_request_resource = null; + protected $instances_add_resource_policies_request_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/AddResourcePoliciesRegionDiskRequest.php b/Compute/src/V1/AddResourcePoliciesRegionDiskRequest.php index f6b390fb962c..28d5f293bb19 100644 --- a/Compute/src/V1/AddResourcePoliciesRegionDiskRequest.php +++ b/Compute/src/V1/AddResourcePoliciesRegionDiskRequest.php @@ -20,31 +20,31 @@ class AddResourcePoliciesRegionDiskRequest extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field string disk = 3083677 [(.google.api.field_behavior) = REQUIRED]; */ - private $disk = ''; + protected $disk = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * The name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.RegionDisksAddResourcePoliciesRequest region_disks_add_resource_policies_request_resource = 284196750 [(.google.api.field_behavior) = REQUIRED]; */ - private $region_disks_add_resource_policies_request_resource = null; + protected $region_disks_add_resource_policies_request_resource = null; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/AddRuleFirewallPolicyRequest.php b/Compute/src/V1/AddRuleFirewallPolicyRequest.php index 6ad0ade81c37..011cae00f6f2 100644 --- a/Compute/src/V1/AddRuleFirewallPolicyRequest.php +++ b/Compute/src/V1/AddRuleFirewallPolicyRequest.php @@ -20,19 +20,19 @@ class AddRuleFirewallPolicyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string firewall_policy = 498173265 [(.google.api.field_behavior) = REQUIRED]; */ - private $firewall_policy = ''; + protected $firewall_policy = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.FirewallPolicyRule firewall_policy_rule_resource = 250523523 [(.google.api.field_behavior) = REQUIRED]; */ - private $firewall_policy_rule_resource = null; + protected $firewall_policy_rule_resource = null; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $firewallPolicy Name of the firewall policy to update. diff --git a/Compute/src/V1/AddRuleNetworkFirewallPolicyRequest.php b/Compute/src/V1/AddRuleNetworkFirewallPolicyRequest.php index 82ca565e4b97..39651a211773 100644 --- a/Compute/src/V1/AddRuleNetworkFirewallPolicyRequest.php +++ b/Compute/src/V1/AddRuleNetworkFirewallPolicyRequest.php @@ -20,37 +20,37 @@ class AddRuleNetworkFirewallPolicyRequest extends \Google\Protobuf\Internal\Mess * * Generated from protobuf field string firewall_policy = 498173265 [(.google.api.field_behavior) = REQUIRED]; */ - private $firewall_policy = ''; + protected $firewall_policy = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.FirewallPolicyRule firewall_policy_rule_resource = 250523523 [(.google.api.field_behavior) = REQUIRED]; */ - private $firewall_policy_rule_resource = null; + protected $firewall_policy_rule_resource = null; /** * When rule.priority is not specified, auto choose a unused priority between minPriority and maxPriority>. This field is exclusive with rule.priority. * * Generated from protobuf field optional int32 max_priority = 329635359; */ - private $max_priority = null; + protected $max_priority = null; /** * When rule.priority is not specified, auto choose a unused priority between minPriority and maxPriority>. This field is exclusive with rule.priority. * * Generated from protobuf field optional int32 min_priority = 267190513; */ - private $min_priority = null; + protected $min_priority = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/AddRuleRegionNetworkFirewallPolicyRequest.php b/Compute/src/V1/AddRuleRegionNetworkFirewallPolicyRequest.php index ed498208fa45..3f92a5437662 100644 --- a/Compute/src/V1/AddRuleRegionNetworkFirewallPolicyRequest.php +++ b/Compute/src/V1/AddRuleRegionNetworkFirewallPolicyRequest.php @@ -20,43 +20,43 @@ class AddRuleRegionNetworkFirewallPolicyRequest extends \Google\Protobuf\Interna * * Generated from protobuf field string firewall_policy = 498173265 [(.google.api.field_behavior) = REQUIRED]; */ - private $firewall_policy = ''; + protected $firewall_policy = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.FirewallPolicyRule firewall_policy_rule_resource = 250523523 [(.google.api.field_behavior) = REQUIRED]; */ - private $firewall_policy_rule_resource = null; + protected $firewall_policy_rule_resource = null; /** * When rule.priority is not specified, auto choose a unused priority between minPriority and maxPriority>. This field is exclusive with rule.priority. * * Generated from protobuf field optional int32 max_priority = 329635359; */ - private $max_priority = null; + protected $max_priority = null; /** * When rule.priority is not specified, auto choose a unused priority between minPriority and maxPriority>. This field is exclusive with rule.priority. * * Generated from protobuf field optional int32 min_priority = 267190513; */ - private $min_priority = null; + protected $min_priority = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/AddRuleRegionSecurityPolicyRequest.php b/Compute/src/V1/AddRuleRegionSecurityPolicyRequest.php index 3fddc6d9b07a..909a99e9caa3 100644 --- a/Compute/src/V1/AddRuleRegionSecurityPolicyRequest.php +++ b/Compute/src/V1/AddRuleRegionSecurityPolicyRequest.php @@ -20,31 +20,31 @@ class AddRuleRegionSecurityPolicyRequest extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * Name of the security policy to update. * * Generated from protobuf field string security_policy = 171082513 [(.google.api.field_behavior) = REQUIRED]; */ - private $security_policy = ''; + protected $security_policy = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.SecurityPolicyRule security_policy_rule_resource = 402693443 [(.google.api.field_behavior) = REQUIRED]; */ - private $security_policy_rule_resource = null; + protected $security_policy_rule_resource = null; /** * If true, the request will not be committed. * * Generated from protobuf field optional bool validate_only = 242744629; */ - private $validate_only = null; + protected $validate_only = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/AddRuleSecurityPolicyRequest.php b/Compute/src/V1/AddRuleSecurityPolicyRequest.php index b5871bcd30e4..1d2d4016ea9d 100644 --- a/Compute/src/V1/AddRuleSecurityPolicyRequest.php +++ b/Compute/src/V1/AddRuleSecurityPolicyRequest.php @@ -20,25 +20,25 @@ class AddRuleSecurityPolicyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the security policy to update. * * Generated from protobuf field string security_policy = 171082513 [(.google.api.field_behavior) = REQUIRED]; */ - private $security_policy = ''; + protected $security_policy = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.SecurityPolicyRule security_policy_rule_resource = 402693443 [(.google.api.field_behavior) = REQUIRED]; */ - private $security_policy_rule_resource = null; + protected $security_policy_rule_resource = null; /** * If true, the request will not be committed. * * Generated from protobuf field optional bool validate_only = 242744629; */ - private $validate_only = null; + protected $validate_only = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/AddSignedUrlKeyBackendBucketRequest.php b/Compute/src/V1/AddSignedUrlKeyBackendBucketRequest.php index 792e358dd390..d18c6b9c98bd 100644 --- a/Compute/src/V1/AddSignedUrlKeyBackendBucketRequest.php +++ b/Compute/src/V1/AddSignedUrlKeyBackendBucketRequest.php @@ -20,25 +20,25 @@ class AddSignedUrlKeyBackendBucketRequest extends \Google\Protobuf\Internal\Mess * * Generated from protobuf field string backend_bucket = 91714037 [(.google.api.field_behavior) = REQUIRED]; */ - private $backend_bucket = ''; + protected $backend_bucket = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.SignedUrlKey signed_url_key_resource = 457625985 [(.google.api.field_behavior) = REQUIRED]; */ - private $signed_url_key_resource = null; + protected $signed_url_key_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/AddSignedUrlKeyBackendServiceRequest.php b/Compute/src/V1/AddSignedUrlKeyBackendServiceRequest.php index 76a86d543249..b8b7fd554072 100644 --- a/Compute/src/V1/AddSignedUrlKeyBackendServiceRequest.php +++ b/Compute/src/V1/AddSignedUrlKeyBackendServiceRequest.php @@ -20,25 +20,25 @@ class AddSignedUrlKeyBackendServiceRequest extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field string backend_service = 306946058 [(.google.api.field_behavior) = REQUIRED]; */ - private $backend_service = ''; + protected $backend_service = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.SignedUrlKey signed_url_key_resource = 457625985 [(.google.api.field_behavior) = REQUIRED]; */ - private $signed_url_key_resource = null; + protected $signed_url_key_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/Address.php b/Compute/src/V1/Address.php index c4b5d540fd0f..f50b5bc9b8f8 100644 --- a/Compute/src/V1/Address.php +++ b/Compute/src/V1/Address.php @@ -20,58 +20,58 @@ class Address extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string address = 462920692; */ - private $address = null; + protected $address = null; /** * The type of address to reserve, either INTERNAL or EXTERNAL. If unspecified, defaults to EXTERNAL. * Check the AddressType enum for the list of possible values. * * Generated from protobuf field optional string address_type = 264307877; */ - private $address_type = null; + protected $address_type = null; /** * [Output Only] Creation timestamp in RFC3339 text format. * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * An optional description of this resource. Provide this field when you create the resource. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * [Output Only] The unique identifier for the resource. This identifier is defined by the server. * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * The IP version that will be used by this address. Valid options are IPV4 or IPV6. * Check the IpVersion enum for the list of possible values. * * Generated from protobuf field optional string ip_version = 294959552; */ - private $ip_version = null; + protected $ip_version = null; /** * The endpoint type of this address, which should be VM or NETLB. This is used for deciding which type of endpoint this address can be used after the external IPv6 address reservation. * Check the Ipv6EndpointType enum for the list of possible values. * * Generated from protobuf field optional string ipv6_endpoint_type = 97501004; */ - private $ipv6_endpoint_type = null; + protected $ipv6_endpoint_type = null; /** * [Output Only] Type of the resource. Always compute#address for addresses. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * A fingerprint for the labels being applied to this Address, which is essentially a hash of the labels set used for optimistic locking. The fingerprint is initially generated by Compute Engine and changes after every request to modify or update labels. You must always provide an up-to-date fingerprint hash in order to update or change labels, otherwise the request will fail with error 412 conditionNotMet. To see the latest fingerprint, make a get() request to retrieve an Address. * * Generated from protobuf field optional string label_fingerprint = 178124825; */ - private $label_fingerprint = null; + protected $label_fingerprint = null; /** * Labels for this resource. These can only be added or modified by the setLabels method. Each label key/value pair must comply with RFC1035. Label values may be empty. * @@ -83,58 +83,58 @@ class Address extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * The URL of the network in which to reserve the address. This field can only be used with INTERNAL type with the VPC_PEERING purpose. * * Generated from protobuf field optional string network = 232872494; */ - private $network = null; + protected $network = null; /** * This signifies the networking tier used for configuring this address and can only take the following values: PREMIUM or STANDARD. Internal IP addresses are always Premium Tier; global external IP addresses are always Premium Tier; regional external IP addresses can be either Standard or Premium Tier. If this field is not specified, it is assumed to be PREMIUM. * Check the NetworkTier enum for the list of possible values. * * Generated from protobuf field optional string network_tier = 517397843; */ - private $network_tier = null; + protected $network_tier = null; /** * The prefix length if the resource represents an IP range. * * Generated from protobuf field optional int32 prefix_length = 453565747; */ - private $prefix_length = null; + protected $prefix_length = null; /** * The purpose of this resource, which can be one of the following values: - GCE_ENDPOINT for addresses that are used by VM instances, alias IP ranges, load balancers, and similar resources. - DNS_RESOLVER for a DNS resolver address in a subnetwork for a Cloud DNS inbound forwarder IP addresses (regional internal IP address in a subnet of a VPC network) - VPC_PEERING for global internal IP addresses used for private services access allocated ranges. - NAT_AUTO for the regional external IP addresses used by Cloud NAT when allocating addresses using automatic NAT IP address allocation. - IPSEC_INTERCONNECT for addresses created from a private IP range that are reserved for a VLAN attachment in an *HA VPN over Cloud Interconnect* configuration. These addresses are regional resources. - `SHARED_LOADBALANCER_VIP` for an internal IP address that is assigned to multiple internal forwarding rules. - `PRIVATE_SERVICE_CONNECT` for a private network address that is used to configure Private Service Connect. Only global internal addresses can use this purpose. * Check the Purpose enum for the list of possible values. * * Generated from protobuf field optional string purpose = 316407070; */ - private $purpose = null; + protected $purpose = null; /** * [Output Only] The URL of the region where a regional address resides. For regional addresses, you must specify the region as a path parameter in the HTTP request URL. *This field is not applicable to global addresses.* * * Generated from protobuf field optional string region = 138946292; */ - private $region = null; + protected $region = null; /** * [Output Only] Server-defined URL for the resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] The status of the address, which can be one of RESERVING, RESERVED, or IN_USE. An address that is RESERVING is currently in the process of being reserved. A RESERVED address is currently reserved and available to use. An IN_USE address is currently being used by another resource and is not available. * Check the Status enum for the list of possible values. * * Generated from protobuf field optional string status = 181260274; */ - private $status = null; + protected $status = null; /** * The URL of the subnetwork in which to reserve the address. If an IP address is specified, it must be within the subnetwork's IP range. This field can only be used with INTERNAL type with a GCE_ENDPOINT or DNS_RESOLVER purpose. * * Generated from protobuf field optional string subnetwork = 307827694; */ - private $subnetwork = null; + protected $subnetwork = null; /** * [Output Only] The URLs of the resources that are using this address. * diff --git a/Compute/src/V1/AddressAggregatedList.php b/Compute/src/V1/AddressAggregatedList.php index b33f88c5816b..ffef64f54854 100644 --- a/Compute/src/V1/AddressAggregatedList.php +++ b/Compute/src/V1/AddressAggregatedList.php @@ -19,7 +19,7 @@ class AddressAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of AddressesScopedList resources. * @@ -31,19 +31,19 @@ class AddressAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Unreachable resources. * @@ -55,7 +55,7 @@ class AddressAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/AddressList.php b/Compute/src/V1/AddressList.php index c8ff49d12955..ec6897b6d480 100644 --- a/Compute/src/V1/AddressList.php +++ b/Compute/src/V1/AddressList.php @@ -20,7 +20,7 @@ class AddressList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of Address resources. * @@ -32,25 +32,25 @@ class AddressList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/AddressesClient.php b/Compute/src/V1/AddressesClient.php deleted file mode 100644 index 28a1c466efba..000000000000 --- a/Compute/src/V1/AddressesClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/AdvancedMachineFeatures.php b/Compute/src/V1/AdvancedMachineFeatures.php index f5e5bc75166d..24b9618da89e 100644 --- a/Compute/src/V1/AdvancedMachineFeatures.php +++ b/Compute/src/V1/AdvancedMachineFeatures.php @@ -20,38 +20,38 @@ class AdvancedMachineFeatures extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional bool enable_nested_virtualization = 16639365; */ - private $enable_nested_virtualization = null; + protected $enable_nested_virtualization = null; /** * Whether to enable UEFI networking for instance creation. * * Generated from protobuf field optional bool enable_uefi_networking = 334485668; */ - private $enable_uefi_networking = null; + protected $enable_uefi_networking = null; /** * Type of Performance Monitoring Unit requested on instance. * Check the PerformanceMonitoringUnit enum for the list of possible values. * * Generated from protobuf field optional string performance_monitoring_unit = 533618956; */ - private $performance_monitoring_unit = null; + protected $performance_monitoring_unit = null; /** * The number of threads per physical core. To disable simultaneous multithreading (SMT) set this to 1. If unset, the maximum number of threads supported per core by the underlying processor is assumed. * * Generated from protobuf field optional int32 threads_per_core = 352611671; */ - private $threads_per_core = null; + protected $threads_per_core = null; /** * Turbo frequency mode to use for the instance. Supported modes include: * ALL_CORE_MAX Using empty string or not setting this field will use the platform-specific default turbo mode. * * Generated from protobuf field optional string turbo_mode = 432965412; */ - private $turbo_mode = null; + protected $turbo_mode = null; /** * The number of physical cores to expose to an instance. Multiply by the number of threads per core to compute the total number of virtual CPUs to expose to the instance. If unset, the number of cores is inferred from the instance's nominal CPU count and the underlying platform's SMT width. * * Generated from protobuf field optional int32 visible_core_count = 193198684; */ - private $visible_core_count = null; + protected $visible_core_count = null; /** * Constructor. diff --git a/Compute/src/V1/AggregatedListAcceleratorTypesRequest.php b/Compute/src/V1/AggregatedListAcceleratorTypesRequest.php index c28cb3973597..f13d2263ebf9 100644 --- a/Compute/src/V1/AggregatedListAcceleratorTypesRequest.php +++ b/Compute/src/V1/AggregatedListAcceleratorTypesRequest.php @@ -20,49 +20,49 @@ class AggregatedListAcceleratorTypesRequest extends \Google\Protobuf\Internal\Me * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. * * Generated from protobuf field optional bool include_all_scopes = 391327988; */ - private $include_all_scopes = null; + protected $include_all_scopes = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable api. * * Generated from protobuf field optional int64 service_project_number = 316757497; */ - private $service_project_number = null; + protected $service_project_number = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/AggregatedListAddressesRequest.php b/Compute/src/V1/AggregatedListAddressesRequest.php index d60d195fef59..c101c3ce5704 100644 --- a/Compute/src/V1/AggregatedListAddressesRequest.php +++ b/Compute/src/V1/AggregatedListAddressesRequest.php @@ -20,49 +20,49 @@ class AggregatedListAddressesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. * * Generated from protobuf field optional bool include_all_scopes = 391327988; */ - private $include_all_scopes = null; + protected $include_all_scopes = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable api. * * Generated from protobuf field optional int64 service_project_number = 316757497; */ - private $service_project_number = null; + protected $service_project_number = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/AggregatedListAutoscalersRequest.php b/Compute/src/V1/AggregatedListAutoscalersRequest.php index 9bc542e30ab0..1ec5e79a77f2 100644 --- a/Compute/src/V1/AggregatedListAutoscalersRequest.php +++ b/Compute/src/V1/AggregatedListAutoscalersRequest.php @@ -20,49 +20,49 @@ class AggregatedListAutoscalersRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. * * Generated from protobuf field optional bool include_all_scopes = 391327988; */ - private $include_all_scopes = null; + protected $include_all_scopes = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable api. * * Generated from protobuf field optional int64 service_project_number = 316757497; */ - private $service_project_number = null; + protected $service_project_number = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/AggregatedListBackendServicesRequest.php b/Compute/src/V1/AggregatedListBackendServicesRequest.php index 789c888ea506..1309a9a1d63d 100644 --- a/Compute/src/V1/AggregatedListBackendServicesRequest.php +++ b/Compute/src/V1/AggregatedListBackendServicesRequest.php @@ -20,49 +20,49 @@ class AggregatedListBackendServicesRequest extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. * * Generated from protobuf field optional bool include_all_scopes = 391327988; */ - private $include_all_scopes = null; + protected $include_all_scopes = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Name of the project scoping this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable api. * * Generated from protobuf field optional int64 service_project_number = 316757497; */ - private $service_project_number = null; + protected $service_project_number = null; /** * @param string $project Name of the project scoping this request. diff --git a/Compute/src/V1/AggregatedListDiskTypesRequest.php b/Compute/src/V1/AggregatedListDiskTypesRequest.php index 4e4a9dba12d7..4862fab08c07 100644 --- a/Compute/src/V1/AggregatedListDiskTypesRequest.php +++ b/Compute/src/V1/AggregatedListDiskTypesRequest.php @@ -20,49 +20,49 @@ class AggregatedListDiskTypesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. * * Generated from protobuf field optional bool include_all_scopes = 391327988; */ - private $include_all_scopes = null; + protected $include_all_scopes = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable api. * * Generated from protobuf field optional int64 service_project_number = 316757497; */ - private $service_project_number = null; + protected $service_project_number = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/AggregatedListDisksRequest.php b/Compute/src/V1/AggregatedListDisksRequest.php index 98d5cadcf7f0..a73f0e5d4f7b 100644 --- a/Compute/src/V1/AggregatedListDisksRequest.php +++ b/Compute/src/V1/AggregatedListDisksRequest.php @@ -20,49 +20,49 @@ class AggregatedListDisksRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. * * Generated from protobuf field optional bool include_all_scopes = 391327988; */ - private $include_all_scopes = null; + protected $include_all_scopes = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable api. * * Generated from protobuf field optional int64 service_project_number = 316757497; */ - private $service_project_number = null; + protected $service_project_number = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/AggregatedListForwardingRulesRequest.php b/Compute/src/V1/AggregatedListForwardingRulesRequest.php index 3da49bed0c08..f2784259d846 100644 --- a/Compute/src/V1/AggregatedListForwardingRulesRequest.php +++ b/Compute/src/V1/AggregatedListForwardingRulesRequest.php @@ -20,49 +20,49 @@ class AggregatedListForwardingRulesRequest extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. * * Generated from protobuf field optional bool include_all_scopes = 391327988; */ - private $include_all_scopes = null; + protected $include_all_scopes = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable api. * * Generated from protobuf field optional int64 service_project_number = 316757497; */ - private $service_project_number = null; + protected $service_project_number = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/AggregatedListGlobalOperationsRequest.php b/Compute/src/V1/AggregatedListGlobalOperationsRequest.php index 470186aeb8d6..c93d36c9c9d7 100644 --- a/Compute/src/V1/AggregatedListGlobalOperationsRequest.php +++ b/Compute/src/V1/AggregatedListGlobalOperationsRequest.php @@ -20,49 +20,49 @@ class AggregatedListGlobalOperationsRequest extends \Google\Protobuf\Internal\Me * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. * * Generated from protobuf field optional bool include_all_scopes = 391327988; */ - private $include_all_scopes = null; + protected $include_all_scopes = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable api. * * Generated from protobuf field optional int64 service_project_number = 316757497; */ - private $service_project_number = null; + protected $service_project_number = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/AggregatedListHealthChecksRequest.php b/Compute/src/V1/AggregatedListHealthChecksRequest.php index 8105ccbf4357..ec11ea6e303a 100644 --- a/Compute/src/V1/AggregatedListHealthChecksRequest.php +++ b/Compute/src/V1/AggregatedListHealthChecksRequest.php @@ -20,49 +20,49 @@ class AggregatedListHealthChecksRequest extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. * * Generated from protobuf field optional bool include_all_scopes = 391327988; */ - private $include_all_scopes = null; + protected $include_all_scopes = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Name of the project scoping this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable api. * * Generated from protobuf field optional int64 service_project_number = 316757497; */ - private $service_project_number = null; + protected $service_project_number = null; /** * @param string $project Name of the project scoping this request. diff --git a/Compute/src/V1/AggregatedListInstanceGroupManagersRequest.php b/Compute/src/V1/AggregatedListInstanceGroupManagersRequest.php index 2d6f736c3973..edf47bf1aa28 100644 --- a/Compute/src/V1/AggregatedListInstanceGroupManagersRequest.php +++ b/Compute/src/V1/AggregatedListInstanceGroupManagersRequest.php @@ -20,49 +20,49 @@ class AggregatedListInstanceGroupManagersRequest extends \Google\Protobuf\Intern * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. * * Generated from protobuf field optional bool include_all_scopes = 391327988; */ - private $include_all_scopes = null; + protected $include_all_scopes = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable api. * * Generated from protobuf field optional int64 service_project_number = 316757497; */ - private $service_project_number = null; + protected $service_project_number = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/AggregatedListInstanceGroupsRequest.php b/Compute/src/V1/AggregatedListInstanceGroupsRequest.php index 923af91cc83c..56f8a50d2802 100644 --- a/Compute/src/V1/AggregatedListInstanceGroupsRequest.php +++ b/Compute/src/V1/AggregatedListInstanceGroupsRequest.php @@ -20,49 +20,49 @@ class AggregatedListInstanceGroupsRequest extends \Google\Protobuf\Internal\Mess * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. * * Generated from protobuf field optional bool include_all_scopes = 391327988; */ - private $include_all_scopes = null; + protected $include_all_scopes = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable api. * * Generated from protobuf field optional int64 service_project_number = 316757497; */ - private $service_project_number = null; + protected $service_project_number = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/AggregatedListInstanceTemplatesRequest.php b/Compute/src/V1/AggregatedListInstanceTemplatesRequest.php index b0c35926de9c..3eb9e5938445 100644 --- a/Compute/src/V1/AggregatedListInstanceTemplatesRequest.php +++ b/Compute/src/V1/AggregatedListInstanceTemplatesRequest.php @@ -20,49 +20,49 @@ class AggregatedListInstanceTemplatesRequest extends \Google\Protobuf\Internal\M * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. * * Generated from protobuf field optional bool include_all_scopes = 391327988; */ - private $include_all_scopes = null; + protected $include_all_scopes = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Name of the project scoping this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable api. * * Generated from protobuf field optional int64 service_project_number = 316757497; */ - private $service_project_number = null; + protected $service_project_number = null; /** * @param string $project Name of the project scoping this request. diff --git a/Compute/src/V1/AggregatedListInstancesRequest.php b/Compute/src/V1/AggregatedListInstancesRequest.php index 820be0309dc0..b6bb5cf1b790 100644 --- a/Compute/src/V1/AggregatedListInstancesRequest.php +++ b/Compute/src/V1/AggregatedListInstancesRequest.php @@ -20,49 +20,49 @@ class AggregatedListInstancesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. * * Generated from protobuf field optional bool include_all_scopes = 391327988; */ - private $include_all_scopes = null; + protected $include_all_scopes = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable api. * * Generated from protobuf field optional int64 service_project_number = 316757497; */ - private $service_project_number = null; + protected $service_project_number = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/AggregatedListInstantSnapshotsRequest.php b/Compute/src/V1/AggregatedListInstantSnapshotsRequest.php index 0ae2cdace476..558031241b5f 100644 --- a/Compute/src/V1/AggregatedListInstantSnapshotsRequest.php +++ b/Compute/src/V1/AggregatedListInstantSnapshotsRequest.php @@ -20,49 +20,49 @@ class AggregatedListInstantSnapshotsRequest extends \Google\Protobuf\Internal\Me * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. * * Generated from protobuf field optional bool include_all_scopes = 391327988; */ - private $include_all_scopes = null; + protected $include_all_scopes = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable api. * * Generated from protobuf field optional int64 service_project_number = 316757497; */ - private $service_project_number = null; + protected $service_project_number = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/AggregatedListInterconnectAttachmentsRequest.php b/Compute/src/V1/AggregatedListInterconnectAttachmentsRequest.php index c4e9c62a1d05..be138c42e9ea 100644 --- a/Compute/src/V1/AggregatedListInterconnectAttachmentsRequest.php +++ b/Compute/src/V1/AggregatedListInterconnectAttachmentsRequest.php @@ -20,49 +20,49 @@ class AggregatedListInterconnectAttachmentsRequest extends \Google\Protobuf\Inte * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. * * Generated from protobuf field optional bool include_all_scopes = 391327988; */ - private $include_all_scopes = null; + protected $include_all_scopes = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable api. * * Generated from protobuf field optional int64 service_project_number = 316757497; */ - private $service_project_number = null; + protected $service_project_number = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/AggregatedListMachineTypesRequest.php b/Compute/src/V1/AggregatedListMachineTypesRequest.php index 246ed0e911b8..abb58ff1b5ab 100644 --- a/Compute/src/V1/AggregatedListMachineTypesRequest.php +++ b/Compute/src/V1/AggregatedListMachineTypesRequest.php @@ -20,49 +20,49 @@ class AggregatedListMachineTypesRequest extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. * * Generated from protobuf field optional bool include_all_scopes = 391327988; */ - private $include_all_scopes = null; + protected $include_all_scopes = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable api. * * Generated from protobuf field optional int64 service_project_number = 316757497; */ - private $service_project_number = null; + protected $service_project_number = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/AggregatedListNetworkAttachmentsRequest.php b/Compute/src/V1/AggregatedListNetworkAttachmentsRequest.php index db9e7570b408..82f010eb2e8f 100644 --- a/Compute/src/V1/AggregatedListNetworkAttachmentsRequest.php +++ b/Compute/src/V1/AggregatedListNetworkAttachmentsRequest.php @@ -20,49 +20,49 @@ class AggregatedListNetworkAttachmentsRequest extends \Google\Protobuf\Internal\ * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. * * Generated from protobuf field optional bool include_all_scopes = 391327988; */ - private $include_all_scopes = null; + protected $include_all_scopes = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable api. * * Generated from protobuf field optional int64 service_project_number = 316757497; */ - private $service_project_number = null; + protected $service_project_number = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/AggregatedListNetworkEdgeSecurityServicesRequest.php b/Compute/src/V1/AggregatedListNetworkEdgeSecurityServicesRequest.php index f8dadffeec28..11d3c5597bf4 100644 --- a/Compute/src/V1/AggregatedListNetworkEdgeSecurityServicesRequest.php +++ b/Compute/src/V1/AggregatedListNetworkEdgeSecurityServicesRequest.php @@ -20,49 +20,49 @@ class AggregatedListNetworkEdgeSecurityServicesRequest extends \Google\Protobuf\ * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. * * Generated from protobuf field optional bool include_all_scopes = 391327988; */ - private $include_all_scopes = null; + protected $include_all_scopes = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Name of the project scoping this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable api. * * Generated from protobuf field optional int64 service_project_number = 316757497; */ - private $service_project_number = null; + protected $service_project_number = null; /** * @param string $project Name of the project scoping this request. diff --git a/Compute/src/V1/AggregatedListNetworkEndpointGroupsRequest.php b/Compute/src/V1/AggregatedListNetworkEndpointGroupsRequest.php index ba6a992a9237..dfa580dd58ba 100644 --- a/Compute/src/V1/AggregatedListNetworkEndpointGroupsRequest.php +++ b/Compute/src/V1/AggregatedListNetworkEndpointGroupsRequest.php @@ -20,49 +20,49 @@ class AggregatedListNetworkEndpointGroupsRequest extends \Google\Protobuf\Intern * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. * * Generated from protobuf field optional bool include_all_scopes = 391327988; */ - private $include_all_scopes = null; + protected $include_all_scopes = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable api. * * Generated from protobuf field optional int64 service_project_number = 316757497; */ - private $service_project_number = null; + protected $service_project_number = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/AggregatedListNetworkFirewallPoliciesRequest.php b/Compute/src/V1/AggregatedListNetworkFirewallPoliciesRequest.php index c6c922f8d50e..e88069ddb46e 100644 --- a/Compute/src/V1/AggregatedListNetworkFirewallPoliciesRequest.php +++ b/Compute/src/V1/AggregatedListNetworkFirewallPoliciesRequest.php @@ -20,49 +20,49 @@ class AggregatedListNetworkFirewallPoliciesRequest extends \Google\Protobuf\Inte * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. * * Generated from protobuf field optional bool include_all_scopes = 391327988; */ - private $include_all_scopes = null; + protected $include_all_scopes = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable api. * * Generated from protobuf field optional int64 service_project_number = 316757497; */ - private $service_project_number = null; + protected $service_project_number = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/AggregatedListNodeGroupsRequest.php b/Compute/src/V1/AggregatedListNodeGroupsRequest.php index 447b8554e2ff..83e4a758d879 100644 --- a/Compute/src/V1/AggregatedListNodeGroupsRequest.php +++ b/Compute/src/V1/AggregatedListNodeGroupsRequest.php @@ -20,49 +20,49 @@ class AggregatedListNodeGroupsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. * * Generated from protobuf field optional bool include_all_scopes = 391327988; */ - private $include_all_scopes = null; + protected $include_all_scopes = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable api. * * Generated from protobuf field optional int64 service_project_number = 316757497; */ - private $service_project_number = null; + protected $service_project_number = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/AggregatedListNodeTemplatesRequest.php b/Compute/src/V1/AggregatedListNodeTemplatesRequest.php index 5d8eea1fe5a9..1dc616bb5b1b 100644 --- a/Compute/src/V1/AggregatedListNodeTemplatesRequest.php +++ b/Compute/src/V1/AggregatedListNodeTemplatesRequest.php @@ -20,49 +20,49 @@ class AggregatedListNodeTemplatesRequest extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. * * Generated from protobuf field optional bool include_all_scopes = 391327988; */ - private $include_all_scopes = null; + protected $include_all_scopes = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable api. * * Generated from protobuf field optional int64 service_project_number = 316757497; */ - private $service_project_number = null; + protected $service_project_number = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/AggregatedListNodeTypesRequest.php b/Compute/src/V1/AggregatedListNodeTypesRequest.php index 23ada51af830..7ed07a3ef260 100644 --- a/Compute/src/V1/AggregatedListNodeTypesRequest.php +++ b/Compute/src/V1/AggregatedListNodeTypesRequest.php @@ -20,49 +20,49 @@ class AggregatedListNodeTypesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. * * Generated from protobuf field optional bool include_all_scopes = 391327988; */ - private $include_all_scopes = null; + protected $include_all_scopes = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable api. * * Generated from protobuf field optional int64 service_project_number = 316757497; */ - private $service_project_number = null; + protected $service_project_number = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/AggregatedListPacketMirroringsRequest.php b/Compute/src/V1/AggregatedListPacketMirroringsRequest.php index 23fd0c97e469..d3a3bef11799 100644 --- a/Compute/src/V1/AggregatedListPacketMirroringsRequest.php +++ b/Compute/src/V1/AggregatedListPacketMirroringsRequest.php @@ -20,49 +20,49 @@ class AggregatedListPacketMirroringsRequest extends \Google\Protobuf\Internal\Me * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. * * Generated from protobuf field optional bool include_all_scopes = 391327988; */ - private $include_all_scopes = null; + protected $include_all_scopes = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable api. * * Generated from protobuf field optional int64 service_project_number = 316757497; */ - private $service_project_number = null; + protected $service_project_number = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/AggregatedListPublicDelegatedPrefixesRequest.php b/Compute/src/V1/AggregatedListPublicDelegatedPrefixesRequest.php index c7ebbc7511c7..ab76002e6758 100644 --- a/Compute/src/V1/AggregatedListPublicDelegatedPrefixesRequest.php +++ b/Compute/src/V1/AggregatedListPublicDelegatedPrefixesRequest.php @@ -20,49 +20,49 @@ class AggregatedListPublicDelegatedPrefixesRequest extends \Google\Protobuf\Inte * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. * * Generated from protobuf field optional bool include_all_scopes = 391327988; */ - private $include_all_scopes = null; + protected $include_all_scopes = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Name of the project scoping this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable api. * * Generated from protobuf field optional int64 service_project_number = 316757497; */ - private $service_project_number = null; + protected $service_project_number = null; /** * @param string $project Name of the project scoping this request. diff --git a/Compute/src/V1/AggregatedListRegionCommitmentsRequest.php b/Compute/src/V1/AggregatedListRegionCommitmentsRequest.php index f4a5b9bc93c2..592178644c7c 100644 --- a/Compute/src/V1/AggregatedListRegionCommitmentsRequest.php +++ b/Compute/src/V1/AggregatedListRegionCommitmentsRequest.php @@ -20,49 +20,49 @@ class AggregatedListRegionCommitmentsRequest extends \Google\Protobuf\Internal\M * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. * * Generated from protobuf field optional bool include_all_scopes = 391327988; */ - private $include_all_scopes = null; + protected $include_all_scopes = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable api. * * Generated from protobuf field optional int64 service_project_number = 316757497; */ - private $service_project_number = null; + protected $service_project_number = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/AggregatedListReservationsRequest.php b/Compute/src/V1/AggregatedListReservationsRequest.php index 080d56ef0fdf..19fd8ba660de 100644 --- a/Compute/src/V1/AggregatedListReservationsRequest.php +++ b/Compute/src/V1/AggregatedListReservationsRequest.php @@ -20,49 +20,49 @@ class AggregatedListReservationsRequest extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. * * Generated from protobuf field optional bool include_all_scopes = 391327988; */ - private $include_all_scopes = null; + protected $include_all_scopes = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable api. * * Generated from protobuf field optional int64 service_project_number = 316757497; */ - private $service_project_number = null; + protected $service_project_number = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/AggregatedListResourcePoliciesRequest.php b/Compute/src/V1/AggregatedListResourcePoliciesRequest.php index 02e98258f7f5..942a024991da 100644 --- a/Compute/src/V1/AggregatedListResourcePoliciesRequest.php +++ b/Compute/src/V1/AggregatedListResourcePoliciesRequest.php @@ -20,49 +20,49 @@ class AggregatedListResourcePoliciesRequest extends \Google\Protobuf\Internal\Me * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. * * Generated from protobuf field optional bool include_all_scopes = 391327988; */ - private $include_all_scopes = null; + protected $include_all_scopes = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable api. * * Generated from protobuf field optional int64 service_project_number = 316757497; */ - private $service_project_number = null; + protected $service_project_number = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/AggregatedListRoutersRequest.php b/Compute/src/V1/AggregatedListRoutersRequest.php index c90786ad7773..9f22dc83f559 100644 --- a/Compute/src/V1/AggregatedListRoutersRequest.php +++ b/Compute/src/V1/AggregatedListRoutersRequest.php @@ -20,49 +20,49 @@ class AggregatedListRoutersRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. * * Generated from protobuf field optional bool include_all_scopes = 391327988; */ - private $include_all_scopes = null; + protected $include_all_scopes = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable api. * * Generated from protobuf field optional int64 service_project_number = 316757497; */ - private $service_project_number = null; + protected $service_project_number = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/AggregatedListSecurityPoliciesRequest.php b/Compute/src/V1/AggregatedListSecurityPoliciesRequest.php index 9fad0406e8c4..6d85ad2789f5 100644 --- a/Compute/src/V1/AggregatedListSecurityPoliciesRequest.php +++ b/Compute/src/V1/AggregatedListSecurityPoliciesRequest.php @@ -20,49 +20,49 @@ class AggregatedListSecurityPoliciesRequest extends \Google\Protobuf\Internal\Me * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. * * Generated from protobuf field optional bool include_all_scopes = 391327988; */ - private $include_all_scopes = null; + protected $include_all_scopes = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Name of the project scoping this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable api. * * Generated from protobuf field optional int64 service_project_number = 316757497; */ - private $service_project_number = null; + protected $service_project_number = null; /** * @param string $project Name of the project scoping this request. diff --git a/Compute/src/V1/AggregatedListServiceAttachmentsRequest.php b/Compute/src/V1/AggregatedListServiceAttachmentsRequest.php index f281a6b0ea99..ec2c67d98d21 100644 --- a/Compute/src/V1/AggregatedListServiceAttachmentsRequest.php +++ b/Compute/src/V1/AggregatedListServiceAttachmentsRequest.php @@ -20,49 +20,49 @@ class AggregatedListServiceAttachmentsRequest extends \Google\Protobuf\Internal\ * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. * * Generated from protobuf field optional bool include_all_scopes = 391327988; */ - private $include_all_scopes = null; + protected $include_all_scopes = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Name of the project scoping this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable api. * * Generated from protobuf field optional int64 service_project_number = 316757497; */ - private $service_project_number = null; + protected $service_project_number = null; /** * @param string $project Name of the project scoping this request. diff --git a/Compute/src/V1/AggregatedListSslCertificatesRequest.php b/Compute/src/V1/AggregatedListSslCertificatesRequest.php index 1bf4d5793318..12cab1f4df69 100644 --- a/Compute/src/V1/AggregatedListSslCertificatesRequest.php +++ b/Compute/src/V1/AggregatedListSslCertificatesRequest.php @@ -20,49 +20,49 @@ class AggregatedListSslCertificatesRequest extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. * * Generated from protobuf field optional bool include_all_scopes = 391327988; */ - private $include_all_scopes = null; + protected $include_all_scopes = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Name of the project scoping this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable api. * * Generated from protobuf field optional int64 service_project_number = 316757497; */ - private $service_project_number = null; + protected $service_project_number = null; /** * @param string $project Name of the project scoping this request. diff --git a/Compute/src/V1/AggregatedListSslPoliciesRequest.php b/Compute/src/V1/AggregatedListSslPoliciesRequest.php index afc5f36652c2..6192b9a0e1a8 100644 --- a/Compute/src/V1/AggregatedListSslPoliciesRequest.php +++ b/Compute/src/V1/AggregatedListSslPoliciesRequest.php @@ -20,49 +20,49 @@ class AggregatedListSslPoliciesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. * * Generated from protobuf field optional bool include_all_scopes = 391327988; */ - private $include_all_scopes = null; + protected $include_all_scopes = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Name of the project scoping this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable api. * * Generated from protobuf field optional int64 service_project_number = 316757497; */ - private $service_project_number = null; + protected $service_project_number = null; /** * @param string $project Name of the project scoping this request. diff --git a/Compute/src/V1/AggregatedListStoragePoolTypesRequest.php b/Compute/src/V1/AggregatedListStoragePoolTypesRequest.php index cfb46370197e..864771e4e8b6 100644 --- a/Compute/src/V1/AggregatedListStoragePoolTypesRequest.php +++ b/Compute/src/V1/AggregatedListStoragePoolTypesRequest.php @@ -20,49 +20,49 @@ class AggregatedListStoragePoolTypesRequest extends \Google\Protobuf\Internal\Me * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. * * Generated from protobuf field optional bool include_all_scopes = 391327988; */ - private $include_all_scopes = null; + protected $include_all_scopes = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable api. * * Generated from protobuf field optional int64 service_project_number = 316757497; */ - private $service_project_number = null; + protected $service_project_number = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/AggregatedListStoragePoolsRequest.php b/Compute/src/V1/AggregatedListStoragePoolsRequest.php index 183ea6a70e60..5227898d2e71 100644 --- a/Compute/src/V1/AggregatedListStoragePoolsRequest.php +++ b/Compute/src/V1/AggregatedListStoragePoolsRequest.php @@ -20,49 +20,49 @@ class AggregatedListStoragePoolsRequest extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. * * Generated from protobuf field optional bool include_all_scopes = 391327988; */ - private $include_all_scopes = null; + protected $include_all_scopes = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable api. * * Generated from protobuf field optional int64 service_project_number = 316757497; */ - private $service_project_number = null; + protected $service_project_number = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/AggregatedListSubnetworksRequest.php b/Compute/src/V1/AggregatedListSubnetworksRequest.php index 3dae680cdddf..ab63f9aca6a7 100644 --- a/Compute/src/V1/AggregatedListSubnetworksRequest.php +++ b/Compute/src/V1/AggregatedListSubnetworksRequest.php @@ -20,49 +20,49 @@ class AggregatedListSubnetworksRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. * * Generated from protobuf field optional bool include_all_scopes = 391327988; */ - private $include_all_scopes = null; + protected $include_all_scopes = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable api. * * Generated from protobuf field optional int64 service_project_number = 316757497; */ - private $service_project_number = null; + protected $service_project_number = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/AggregatedListTargetHttpProxiesRequest.php b/Compute/src/V1/AggregatedListTargetHttpProxiesRequest.php index 387dc047dd94..9a1db4308420 100644 --- a/Compute/src/V1/AggregatedListTargetHttpProxiesRequest.php +++ b/Compute/src/V1/AggregatedListTargetHttpProxiesRequest.php @@ -20,49 +20,49 @@ class AggregatedListTargetHttpProxiesRequest extends \Google\Protobuf\Internal\M * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. * * Generated from protobuf field optional bool include_all_scopes = 391327988; */ - private $include_all_scopes = null; + protected $include_all_scopes = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Name of the project scoping this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable api. * * Generated from protobuf field optional int64 service_project_number = 316757497; */ - private $service_project_number = null; + protected $service_project_number = null; /** * @param string $project Name of the project scoping this request. diff --git a/Compute/src/V1/AggregatedListTargetHttpsProxiesRequest.php b/Compute/src/V1/AggregatedListTargetHttpsProxiesRequest.php index 1d56f6cbc915..f9b472196d0a 100644 --- a/Compute/src/V1/AggregatedListTargetHttpsProxiesRequest.php +++ b/Compute/src/V1/AggregatedListTargetHttpsProxiesRequest.php @@ -20,49 +20,49 @@ class AggregatedListTargetHttpsProxiesRequest extends \Google\Protobuf\Internal\ * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. * * Generated from protobuf field optional bool include_all_scopes = 391327988; */ - private $include_all_scopes = null; + protected $include_all_scopes = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Name of the project scoping this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable api. * * Generated from protobuf field optional int64 service_project_number = 316757497; */ - private $service_project_number = null; + protected $service_project_number = null; /** * @param string $project Name of the project scoping this request. diff --git a/Compute/src/V1/AggregatedListTargetInstancesRequest.php b/Compute/src/V1/AggregatedListTargetInstancesRequest.php index a81ce676fa02..5c4a2153b133 100644 --- a/Compute/src/V1/AggregatedListTargetInstancesRequest.php +++ b/Compute/src/V1/AggregatedListTargetInstancesRequest.php @@ -20,49 +20,49 @@ class AggregatedListTargetInstancesRequest extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. * * Generated from protobuf field optional bool include_all_scopes = 391327988; */ - private $include_all_scopes = null; + protected $include_all_scopes = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable api. * * Generated from protobuf field optional int64 service_project_number = 316757497; */ - private $service_project_number = null; + protected $service_project_number = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/AggregatedListTargetPoolsRequest.php b/Compute/src/V1/AggregatedListTargetPoolsRequest.php index 3f1174011d77..5e23007ccba1 100644 --- a/Compute/src/V1/AggregatedListTargetPoolsRequest.php +++ b/Compute/src/V1/AggregatedListTargetPoolsRequest.php @@ -20,49 +20,49 @@ class AggregatedListTargetPoolsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. * * Generated from protobuf field optional bool include_all_scopes = 391327988; */ - private $include_all_scopes = null; + protected $include_all_scopes = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable api. * * Generated from protobuf field optional int64 service_project_number = 316757497; */ - private $service_project_number = null; + protected $service_project_number = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/AggregatedListTargetTcpProxiesRequest.php b/Compute/src/V1/AggregatedListTargetTcpProxiesRequest.php index e8c1e20ee522..235d2859ade0 100644 --- a/Compute/src/V1/AggregatedListTargetTcpProxiesRequest.php +++ b/Compute/src/V1/AggregatedListTargetTcpProxiesRequest.php @@ -20,49 +20,49 @@ class AggregatedListTargetTcpProxiesRequest extends \Google\Protobuf\Internal\Me * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. * * Generated from protobuf field optional bool include_all_scopes = 391327988; */ - private $include_all_scopes = null; + protected $include_all_scopes = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Name of the project scoping this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable api. * * Generated from protobuf field optional int64 service_project_number = 316757497; */ - private $service_project_number = null; + protected $service_project_number = null; /** * @param string $project Name of the project scoping this request. diff --git a/Compute/src/V1/AggregatedListTargetVpnGatewaysRequest.php b/Compute/src/V1/AggregatedListTargetVpnGatewaysRequest.php index d14cec5ded39..80bf05d3ecc5 100644 --- a/Compute/src/V1/AggregatedListTargetVpnGatewaysRequest.php +++ b/Compute/src/V1/AggregatedListTargetVpnGatewaysRequest.php @@ -20,49 +20,49 @@ class AggregatedListTargetVpnGatewaysRequest extends \Google\Protobuf\Internal\M * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. * * Generated from protobuf field optional bool include_all_scopes = 391327988; */ - private $include_all_scopes = null; + protected $include_all_scopes = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable api. * * Generated from protobuf field optional int64 service_project_number = 316757497; */ - private $service_project_number = null; + protected $service_project_number = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/AggregatedListUrlMapsRequest.php b/Compute/src/V1/AggregatedListUrlMapsRequest.php index 95d2349de6a9..636fc4676ba6 100644 --- a/Compute/src/V1/AggregatedListUrlMapsRequest.php +++ b/Compute/src/V1/AggregatedListUrlMapsRequest.php @@ -20,49 +20,49 @@ class AggregatedListUrlMapsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. * * Generated from protobuf field optional bool include_all_scopes = 391327988; */ - private $include_all_scopes = null; + protected $include_all_scopes = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Name of the project scoping this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable api. * * Generated from protobuf field optional int64 service_project_number = 316757497; */ - private $service_project_number = null; + protected $service_project_number = null; /** * @param string $project Name of the project scoping this request. diff --git a/Compute/src/V1/AggregatedListVpnGatewaysRequest.php b/Compute/src/V1/AggregatedListVpnGatewaysRequest.php index db0200a8ac0b..4feb678576eb 100644 --- a/Compute/src/V1/AggregatedListVpnGatewaysRequest.php +++ b/Compute/src/V1/AggregatedListVpnGatewaysRequest.php @@ -20,49 +20,49 @@ class AggregatedListVpnGatewaysRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. * * Generated from protobuf field optional bool include_all_scopes = 391327988; */ - private $include_all_scopes = null; + protected $include_all_scopes = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable api. * * Generated from protobuf field optional int64 service_project_number = 316757497; */ - private $service_project_number = null; + protected $service_project_number = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/AggregatedListVpnTunnelsRequest.php b/Compute/src/V1/AggregatedListVpnTunnelsRequest.php index 798c056d3797..b5b22510dca1 100644 --- a/Compute/src/V1/AggregatedListVpnTunnelsRequest.php +++ b/Compute/src/V1/AggregatedListVpnTunnelsRequest.php @@ -20,49 +20,49 @@ class AggregatedListVpnTunnelsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. * * Generated from protobuf field optional bool include_all_scopes = 391327988; */ - private $include_all_scopes = null; + protected $include_all_scopes = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable api. * * Generated from protobuf field optional int64 service_project_number = 316757497; */ - private $service_project_number = null; + protected $service_project_number = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/AliasIpRange.php b/Compute/src/V1/AliasIpRange.php index 9b922712dd7e..0793eb5ad565 100644 --- a/Compute/src/V1/AliasIpRange.php +++ b/Compute/src/V1/AliasIpRange.php @@ -20,13 +20,13 @@ class AliasIpRange extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string ip_cidr_range = 98117322; */ - private $ip_cidr_range = null; + protected $ip_cidr_range = null; /** * The name of a subnetwork secondary IP range from which to allocate an IP alias range. If not specified, the primary range of the subnetwork is used. * * Generated from protobuf field optional string subnetwork_range_name = 387995966; */ - private $subnetwork_range_name = null; + protected $subnetwork_range_name = null; /** * Constructor. diff --git a/Compute/src/V1/AllocationAggregateReservation.php b/Compute/src/V1/AllocationAggregateReservation.php index 57220b5be234..13d7605c79a3 100644 --- a/Compute/src/V1/AllocationAggregateReservation.php +++ b/Compute/src/V1/AllocationAggregateReservation.php @@ -33,14 +33,14 @@ class AllocationAggregateReservation extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string vm_family = 125017580; */ - private $vm_family = null; + protected $vm_family = null; /** * The workload type of the instances that will target this reservation. * Check the WorkloadType enum for the list of possible values. * * Generated from protobuf field optional string workload_type = 273432322; */ - private $workload_type = null; + protected $workload_type = null; /** * Constructor. diff --git a/Compute/src/V1/AllocationAggregateReservationReservedResourceInfo.php b/Compute/src/V1/AllocationAggregateReservationReservedResourceInfo.php index ae42d3d94de7..9d3753a1dd00 100644 --- a/Compute/src/V1/AllocationAggregateReservationReservedResourceInfo.php +++ b/Compute/src/V1/AllocationAggregateReservationReservedResourceInfo.php @@ -19,7 +19,7 @@ class AllocationAggregateReservationReservedResourceInfo extends \Google\Protobu * * Generated from protobuf field optional .google.cloud.compute.v1.AllocationAggregateReservationReservedResourceInfoAccelerator accelerator = 424338027; */ - private $accelerator = null; + protected $accelerator = null; /** * Constructor. diff --git a/Compute/src/V1/AllocationAggregateReservationReservedResourceInfoAccelerator.php b/Compute/src/V1/AllocationAggregateReservationReservedResourceInfoAccelerator.php index b06ceae6915c..bc88f54d671a 100644 --- a/Compute/src/V1/AllocationAggregateReservationReservedResourceInfoAccelerator.php +++ b/Compute/src/V1/AllocationAggregateReservationReservedResourceInfoAccelerator.php @@ -19,13 +19,13 @@ class AllocationAggregateReservationReservedResourceInfoAccelerator extends \Goo * * Generated from protobuf field optional int32 accelerator_count = 504879675; */ - private $accelerator_count = null; + protected $accelerator_count = null; /** * Full or partial URL to accelerator type. e.g. "projects/{PROJECT}/zones/{ZONE}/acceleratorTypes/ct4l" * * Generated from protobuf field optional string accelerator_type = 138031246; */ - private $accelerator_type = null; + protected $accelerator_type = null; /** * Constructor. diff --git a/Compute/src/V1/AllocationReservationSharingPolicy.php b/Compute/src/V1/AllocationReservationSharingPolicy.php index b3ea3ff15641..6fff44fa570b 100644 --- a/Compute/src/V1/AllocationReservationSharingPolicy.php +++ b/Compute/src/V1/AllocationReservationSharingPolicy.php @@ -20,7 +20,7 @@ class AllocationReservationSharingPolicy extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field optional string service_share_type = 514508644; */ - private $service_share_type = null; + protected $service_share_type = null; /** * Constructor. diff --git a/Compute/src/V1/AllocationResourceStatus.php b/Compute/src/V1/AllocationResourceStatus.php index 668fd32721ec..d5cb0b48ca1a 100644 --- a/Compute/src/V1/AllocationResourceStatus.php +++ b/Compute/src/V1/AllocationResourceStatus.php @@ -20,25 +20,25 @@ class AllocationResourceStatus extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.AllocationResourceStatusHealthInfo health_info = 235287729; */ - private $health_info = null; + protected $health_info = null; /** * The number of reservation blocks associated with this reservation. * * Generated from protobuf field optional int32 reservation_block_count = 161835754; */ - private $reservation_block_count = null; + protected $reservation_block_count = null; /** * Maintenance information for this reservation * * Generated from protobuf field optional .google.cloud.compute.v1.GroupMaintenanceInfo reservation_maintenance = 340607776; */ - private $reservation_maintenance = null; + protected $reservation_maintenance = null; /** * Allocation Properties of this reservation. * * Generated from protobuf field optional .google.cloud.compute.v1.AllocationResourceStatusSpecificSKUAllocation specific_sku_allocation = 196231151; */ - private $specific_sku_allocation = null; + protected $specific_sku_allocation = null; /** * Constructor. diff --git a/Compute/src/V1/AllocationResourceStatusHealthInfo.php b/Compute/src/V1/AllocationResourceStatusHealthInfo.php index a6731ce91019..b45ad885c75d 100644 --- a/Compute/src/V1/AllocationResourceStatusHealthInfo.php +++ b/Compute/src/V1/AllocationResourceStatusHealthInfo.php @@ -20,20 +20,20 @@ class AllocationResourceStatusHealthInfo extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field optional int32 degraded_block_count = 514082636; */ - private $degraded_block_count = null; + protected $degraded_block_count = null; /** * The health status of the reservation. * Check the HealthStatus enum for the list of possible values. * * Generated from protobuf field optional string health_status = 380545845; */ - private $health_status = null; + protected $health_status = null; /** * The number of reservation blocks that are healthy. * * Generated from protobuf field optional int32 healthy_block_count = 223625019; */ - private $healthy_block_count = null; + protected $healthy_block_count = null; /** * Constructor. diff --git a/Compute/src/V1/AllocationResourceStatusSpecificSKUAllocation.php b/Compute/src/V1/AllocationResourceStatusSpecificSKUAllocation.php index 3d33688ab495..8fc93f33c7c3 100644 --- a/Compute/src/V1/AllocationResourceStatusSpecificSKUAllocation.php +++ b/Compute/src/V1/AllocationResourceStatusSpecificSKUAllocation.php @@ -20,7 +20,7 @@ class AllocationResourceStatusSpecificSKUAllocation extends \Google\Protobuf\Int * * Generated from protobuf field optional string source_instance_template_id = 111196154; */ - private $source_instance_template_id = null; + protected $source_instance_template_id = null; /** * Per service utilization breakdown. The Key is the Google Cloud managed service name. * diff --git a/Compute/src/V1/AllocationSpecificSKUAllocationAllocatedInstancePropertiesReservedDisk.php b/Compute/src/V1/AllocationSpecificSKUAllocationAllocatedInstancePropertiesReservedDisk.php index 882a9dda1c34..d33bf0b12190 100644 --- a/Compute/src/V1/AllocationSpecificSKUAllocationAllocatedInstancePropertiesReservedDisk.php +++ b/Compute/src/V1/AllocationSpecificSKUAllocationAllocatedInstancePropertiesReservedDisk.php @@ -19,14 +19,14 @@ class AllocationSpecificSKUAllocationAllocatedInstancePropertiesReservedDisk ext * * Generated from protobuf field optional int64 disk_size_gb = 316263735; */ - private $disk_size_gb = null; + protected $disk_size_gb = null; /** * Specifies the disk interface to use for attaching this disk, which is either SCSI or NVME. The default is SCSI. For performance characteristics of SCSI over NVMe, see Local SSD performance. * Check the Interface enum for the list of possible values. * * Generated from protobuf field optional string interface = 502623545; */ - private $interface = null; + protected $interface = null; /** * Constructor. diff --git a/Compute/src/V1/AllocationSpecificSKUAllocationReservedInstanceProperties.php b/Compute/src/V1/AllocationSpecificSKUAllocationReservedInstanceProperties.php index f4598cd09f41..85279346b0df 100644 --- a/Compute/src/V1/AllocationSpecificSKUAllocationReservedInstanceProperties.php +++ b/Compute/src/V1/AllocationSpecificSKUAllocationReservedInstanceProperties.php @@ -32,19 +32,19 @@ class AllocationSpecificSKUAllocationReservedInstanceProperties extends \Google\ * * Generated from protobuf field optional string location_hint = 350519505; */ - private $location_hint = null; + protected $location_hint = null; /** * Specifies type of machine (name only) which has fixed number of vCPUs and fixed amount of memory. This also includes specifying custom machine type following custom-NUMBER_OF_CPUS-AMOUNT_OF_MEMORY pattern. * * Generated from protobuf field optional string machine_type = 227711026; */ - private $machine_type = null; + protected $machine_type = null; /** * Minimum cpu platform the reservation. * * Generated from protobuf field optional string min_cpu_platform = 242912759; */ - private $min_cpu_platform = null; + protected $min_cpu_platform = null; /** * Constructor. diff --git a/Compute/src/V1/AllocationSpecificSKUAllocationReservedInstanceProperties/MaintenanceInterval.php b/Compute/src/V1/AllocationSpecificSKUAllocationReservedInstanceProperties/MaintenanceInterval.php deleted file mode 100644 index 5b30c4e05e8c..000000000000 --- a/Compute/src/V1/AllocationSpecificSKUAllocationReservedInstanceProperties/MaintenanceInterval.php +++ /dev/null @@ -1,61 +0,0 @@ -google.cloud.compute.v1.AllocationSpecificSKUAllocationReservedInstanceProperties.MaintenanceInterval - */ -class MaintenanceInterval -{ - /** - * A value indicating that the enum field is not set. - * - * Generated from protobuf enum UNDEFINED_MAINTENANCE_INTERVAL = 0; - */ - const UNDEFINED_MAINTENANCE_INTERVAL = 0; - /** - * Generated from protobuf enum AS_NEEDED = 232289378; - */ - const AS_NEEDED = 232289378; - /** - * Generated from protobuf enum PERIODIC = 142804635; - */ - const PERIODIC = 142804635; - - private static $valueToName = [ - self::UNDEFINED_MAINTENANCE_INTERVAL => 'UNDEFINED_MAINTENANCE_INTERVAL', - self::AS_NEEDED => 'AS_NEEDED', - self::PERIODIC => 'PERIODIC', - ]; - - 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/Compute/src/V1/AllocationSpecificSKUReservation.php b/Compute/src/V1/AllocationSpecificSKUReservation.php index 2aa63edd9128..32da10c3c3f5 100644 --- a/Compute/src/V1/AllocationSpecificSKUReservation.php +++ b/Compute/src/V1/AllocationSpecificSKUReservation.php @@ -20,31 +20,31 @@ class AllocationSpecificSKUReservation extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int64 assured_count = 281197645; */ - private $assured_count = null; + protected $assured_count = null; /** * Specifies the number of resources that are allocated. * * Generated from protobuf field optional int64 count = 94851343; */ - private $count = null; + protected $count = null; /** * [Output Only] Indicates how many instances are in use. * * Generated from protobuf field optional int64 in_use_count = 493458877; */ - private $in_use_count = null; + protected $in_use_count = null; /** * The instance properties for the reservation. * * Generated from protobuf field optional .google.cloud.compute.v1.AllocationSpecificSKUAllocationReservedInstanceProperties instance_properties = 215355165; */ - private $instance_properties = null; + protected $instance_properties = null; /** * Specifies the instance template to create the reservation. If you use this field, you must exclude the instanceProperties field. This field is optional, and it can be a full or partial URL. For example, the following are all valid URLs to an instance template: - https://www.googleapis.com/compute/v1/projects/project /global/instanceTemplates/instanceTemplate - projects/project/global/instanceTemplates/instanceTemplate - global/instanceTemplates/instanceTemplate * * Generated from protobuf field optional string source_instance_template = 332423616; */ - private $source_instance_template = null; + protected $source_instance_template = null; /** * Constructor. diff --git a/Compute/src/V1/Allowed.php b/Compute/src/V1/Allowed.php index 980dfc25c08c..9e6e9fe0f44c 100644 --- a/Compute/src/V1/Allowed.php +++ b/Compute/src/V1/Allowed.php @@ -19,7 +19,7 @@ class Allowed extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string I_p_protocol = 488094525; */ - private $I_p_protocol = null; + protected $I_p_protocol = null; /** * An optional list of ports to which this rule applies. This field is only applicable for the UDP or TCP protocol. Each entry must be either an integer or a range. If not specified, this rule applies to connections through any port. Example inputs include: ["22"], ["80","443"], and ["12345-12349"]. * diff --git a/Compute/src/V1/AnnouncePublicAdvertisedPrefixeRequest.php b/Compute/src/V1/AnnouncePublicAdvertisedPrefixeRequest.php index 31e62272e39b..b0090235f546 100644 --- a/Compute/src/V1/AnnouncePublicAdvertisedPrefixeRequest.php +++ b/Compute/src/V1/AnnouncePublicAdvertisedPrefixeRequest.php @@ -20,19 +20,19 @@ class AnnouncePublicAdvertisedPrefixeRequest extends \Google\Protobuf\Internal\M * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * The name of the public advertised prefix. It should comply with RFC1035. * * Generated from protobuf field string public_advertised_prefix = 101874590 [(.google.api.field_behavior) = REQUIRED]; */ - private $public_advertised_prefix = ''; + protected $public_advertised_prefix = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/AnnouncePublicDelegatedPrefixeRequest.php b/Compute/src/V1/AnnouncePublicDelegatedPrefixeRequest.php index 7872af39b6da..de067036128c 100644 --- a/Compute/src/V1/AnnouncePublicDelegatedPrefixeRequest.php +++ b/Compute/src/V1/AnnouncePublicDelegatedPrefixeRequest.php @@ -20,25 +20,25 @@ class AnnouncePublicDelegatedPrefixeRequest extends \Google\Protobuf\Internal\Me * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * The name of the public delegated prefix. It should comply with RFC1035. * * Generated from protobuf field string public_delegated_prefix = 204238440 [(.google.api.field_behavior) = REQUIRED]; */ - private $public_delegated_prefix = ''; + protected $public_delegated_prefix = ''; /** * The name of the region where the public delegated prefix is located. It should comply with RFC1035. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ApplyUpdatesToInstancesInstanceGroupManagerRequest.php b/Compute/src/V1/ApplyUpdatesToInstancesInstanceGroupManagerRequest.php index 5869f2eb9d5d..56cec6c850bf 100644 --- a/Compute/src/V1/ApplyUpdatesToInstancesInstanceGroupManagerRequest.php +++ b/Compute/src/V1/ApplyUpdatesToInstancesInstanceGroupManagerRequest.php @@ -20,25 +20,25 @@ class ApplyUpdatesToInstancesInstanceGroupManagerRequest extends \Google\Protobu * * Generated from protobuf field string instance_group_manager = 249363395 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group_manager = ''; + protected $instance_group_manager = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.InstanceGroupManagersApplyUpdatesRequest instance_group_managers_apply_updates_request_resource = 259242835 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group_managers_apply_updates_request_resource = null; + protected $instance_group_managers_apply_updates_request_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * The name of the zone where the managed instance group is located. Should conform to RFC1035. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ApplyUpdatesToInstancesRegionInstanceGroupManagerRequest.php b/Compute/src/V1/ApplyUpdatesToInstancesRegionInstanceGroupManagerRequest.php index 8271aea8965e..fec2d45bc312 100644 --- a/Compute/src/V1/ApplyUpdatesToInstancesRegionInstanceGroupManagerRequest.php +++ b/Compute/src/V1/ApplyUpdatesToInstancesRegionInstanceGroupManagerRequest.php @@ -20,25 +20,25 @@ class ApplyUpdatesToInstancesRegionInstanceGroupManagerRequest extends \Google\P * * Generated from protobuf field string instance_group_manager = 249363395 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group_manager = ''; + protected $instance_group_manager = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request, should conform to RFC1035. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.RegionInstanceGroupManagersApplyUpdatesRequest region_instance_group_managers_apply_updates_request_resource = 76248318 [(.google.api.field_behavior) = REQUIRED]; */ - private $region_instance_group_managers_apply_updates_request_resource = null; + protected $region_instance_group_managers_apply_updates_request_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/AttachDiskInstanceRequest.php b/Compute/src/V1/AttachDiskInstanceRequest.php index dd4c24042467..3fe86109c07e 100644 --- a/Compute/src/V1/AttachDiskInstanceRequest.php +++ b/Compute/src/V1/AttachDiskInstanceRequest.php @@ -20,37 +20,37 @@ class AttachDiskInstanceRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.compute.v1.AttachedDisk attached_disk_resource = 90605845 [(.google.api.field_behavior) = REQUIRED]; */ - private $attached_disk_resource = null; + protected $attached_disk_resource = null; /** * Whether to force attach the regional disk even if it's currently attached to another instance. If you try to force attach a zonal disk to an instance, you will receive an error. * * Generated from protobuf field optional bool force_attach = 142758425; */ - private $force_attach = null; + protected $force_attach = null; /** * The instance name for this request. * * Generated from protobuf field string instance = 18257045 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance = ''; + protected $instance = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/AttachNetworkEndpointsGlobalNetworkEndpointGroupRequest.php b/Compute/src/V1/AttachNetworkEndpointsGlobalNetworkEndpointGroupRequest.php index 402ca796bfd3..cac3a8502abd 100644 --- a/Compute/src/V1/AttachNetworkEndpointsGlobalNetworkEndpointGroupRequest.php +++ b/Compute/src/V1/AttachNetworkEndpointsGlobalNetworkEndpointGroupRequest.php @@ -20,25 +20,25 @@ class AttachNetworkEndpointsGlobalNetworkEndpointGroupRequest extends \Google\Pr * * Generated from protobuf field .google.cloud.compute.v1.GlobalNetworkEndpointGroupsAttachEndpointsRequest global_network_endpoint_groups_attach_endpoints_request_resource = 30691563 [(.google.api.field_behavior) = REQUIRED]; */ - private $global_network_endpoint_groups_attach_endpoints_request_resource = null; + protected $global_network_endpoint_groups_attach_endpoints_request_resource = null; /** * The name of the network endpoint group where you are attaching network endpoints to. It should comply with RFC1035. * * Generated from protobuf field string network_endpoint_group = 433907078 [(.google.api.field_behavior) = REQUIRED]; */ - private $network_endpoint_group = ''; + protected $network_endpoint_group = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/AttachNetworkEndpointsNetworkEndpointGroupRequest.php b/Compute/src/V1/AttachNetworkEndpointsNetworkEndpointGroupRequest.php index 995efae681f5..12546b00b515 100644 --- a/Compute/src/V1/AttachNetworkEndpointsNetworkEndpointGroupRequest.php +++ b/Compute/src/V1/AttachNetworkEndpointsNetworkEndpointGroupRequest.php @@ -20,31 +20,31 @@ class AttachNetworkEndpointsNetworkEndpointGroupRequest extends \Google\Protobuf * * Generated from protobuf field string network_endpoint_group = 433907078 [(.google.api.field_behavior) = REQUIRED]; */ - private $network_endpoint_group = ''; + protected $network_endpoint_group = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.NetworkEndpointGroupsAttachEndpointsRequest network_endpoint_groups_attach_endpoints_request_resource = 531079 [(.google.api.field_behavior) = REQUIRED]; */ - private $network_endpoint_groups_attach_endpoints_request_resource = null; + protected $network_endpoint_groups_attach_endpoints_request_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone where the network endpoint group is located. It should comply with RFC1035. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/AttachNetworkEndpointsRegionNetworkEndpointGroupRequest.php b/Compute/src/V1/AttachNetworkEndpointsRegionNetworkEndpointGroupRequest.php index edaa55aa3324..116c6deb2d4c 100644 --- a/Compute/src/V1/AttachNetworkEndpointsRegionNetworkEndpointGroupRequest.php +++ b/Compute/src/V1/AttachNetworkEndpointsRegionNetworkEndpointGroupRequest.php @@ -20,31 +20,31 @@ class AttachNetworkEndpointsRegionNetworkEndpointGroupRequest extends \Google\Pr * * Generated from protobuf field string network_endpoint_group = 433907078 [(.google.api.field_behavior) = REQUIRED]; */ - private $network_endpoint_group = ''; + protected $network_endpoint_group = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * The name of the region where you want to create the network endpoint group. It should comply with RFC1035. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.RegionNetworkEndpointGroupsAttachEndpointsRequest region_network_endpoint_groups_attach_endpoints_request_resource = 334986492 [(.google.api.field_behavior) = REQUIRED]; */ - private $region_network_endpoint_groups_attach_endpoints_request_resource = null; + protected $region_network_endpoint_groups_attach_endpoints_request_resource = null; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/AttachedDisk.php b/Compute/src/V1/AttachedDisk.php index 3c4aa1303feb..f4d4b85cdd42 100644 --- a/Compute/src/V1/AttachedDisk.php +++ b/Compute/src/V1/AttachedDisk.php @@ -21,43 +21,43 @@ class AttachedDisk extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string architecture = 302803283; */ - private $architecture = null; + protected $architecture = null; /** * Specifies whether the disk will be auto-deleted when the instance is deleted (but not when the disk is detached from the instance). * * Generated from protobuf field optional bool auto_delete = 464761403; */ - private $auto_delete = null; + protected $auto_delete = null; /** * Indicates that this is a boot disk. The virtual machine will use the first partition of the disk for its root filesystem. * * Generated from protobuf field optional bool boot = 3029746; */ - private $boot = null; + protected $boot = null; /** * Specifies a unique device name of your choice that is reflected into the /dev/disk/by-id/google-* tree of a Linux operating system running within the instance. This name can be used to reference the device for mounting, resizing, and so on, from within the instance. If not specified, the server chooses a default device name to apply to this disk, in the form persistent-disk-x, where x is a number assigned by Google Compute Engine. This field is only applicable for persistent disks. * * Generated from protobuf field optional string device_name = 67541716; */ - private $device_name = null; + protected $device_name = null; /** * Encrypts or decrypts a disk using a customer-supplied encryption key. If you are creating a new disk, this field encrypts the new disk using an encryption key that you provide. If you are attaching an existing disk that is already encrypted, this field decrypts the disk using the customer-supplied encryption key. If you encrypt a disk using a customer-supplied key, you must provide the same key again when you attempt to use this resource at a later time. For example, you must provide the key when you create a snapshot or an image from the disk or when you attach the disk to a virtual machine instance. If you do not provide an encryption key, then the disk will be encrypted using an automatically generated key and you do not need to provide a key to use the disk later. Note: Instance templates do not store customer-supplied encryption keys, so you cannot use your own keys to encrypt disks in a managed instance group. You cannot create VMs that have disks with customer-supplied keys using the bulk insert method. * * Generated from protobuf field optional .google.cloud.compute.v1.CustomerEncryptionKey disk_encryption_key = 271660677; */ - private $disk_encryption_key = null; + protected $disk_encryption_key = null; /** * The size of the disk in GB. * * Generated from protobuf field optional int64 disk_size_gb = 316263735; */ - private $disk_size_gb = null; + protected $disk_size_gb = null; /** * [Input Only] Whether to force attach the regional disk even if it's currently attached to another instance. If you try to force attach a zonal disk to an instance, you will receive an error. * * Generated from protobuf field optional bool force_attach = 142758425; */ - private $force_attach = null; + protected $force_attach = null; /** * A list of features to enable on the guest operating system. Applicable only for bootable images. Read Enabling guest operating system features to see a list of available options. * @@ -69,26 +69,26 @@ class AttachedDisk extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int32 index = 100346066; */ - private $index = null; + protected $index = null; /** * [Input Only] Specifies the parameters for a new disk that will be created alongside the new instance. Use initialization parameters to create boot disks or local SSDs attached to the new instance. This property is mutually exclusive with the source property; you can only define one or the other, but not both. * * Generated from protobuf field optional .google.cloud.compute.v1.AttachedDiskInitializeParams initialize_params = 17697045; */ - private $initialize_params = null; + protected $initialize_params = null; /** * Specifies the disk interface to use for attaching this disk, which is either SCSI or NVME. For most machine types, the default is SCSI. Local SSDs can use either NVME or SCSI. In certain configurations, persistent disks can use NVMe. For more information, see About persistent disks. * Check the Interface enum for the list of possible values. * * Generated from protobuf field optional string interface = 502623545; */ - private $interface = null; + protected $interface = null; /** * [Output Only] Type of the resource. Always compute#attachedDisk for attached disks. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] Any valid publicly visible licenses. * @@ -101,33 +101,33 @@ class AttachedDisk extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string mode = 3357091; */ - private $mode = null; + protected $mode = null; /** * For LocalSSD disks on VM Instances in STOPPED or SUSPENDED state, this field is set to PRESERVED if the LocalSSD data has been saved to a persistent location by customer request. (see the discard_local_ssd option on Stop/Suspend). Read-only in the api. * Check the SavedState enum for the list of possible values. * * Generated from protobuf field optional string saved_state = 411587801; */ - private $saved_state = null; + protected $saved_state = null; /** * [Output Only] shielded vm initial state stored on disk * * Generated from protobuf field optional .google.cloud.compute.v1.InitialStateConfig shielded_instance_initial_state = 192356867; */ - private $shielded_instance_initial_state = null; + protected $shielded_instance_initial_state = null; /** * Specifies a valid partial or full URL to an existing Persistent Disk resource. When creating a new instance boot disk, one of initializeParams.sourceImage or initializeParams.sourceSnapshot or disks.source is required. If desired, you can also attach existing non-root persistent disks using this property. This field is only applicable for persistent disks. Note that for InstanceTemplate, specify the disk name for zonal disk, and the URL for regional disk. * * Generated from protobuf field optional string source = 177235995; */ - private $source = null; + protected $source = null; /** * Specifies the type of the disk, either SCRATCH or PERSISTENT. If not specified, the default is PERSISTENT. * Check the Type enum for the list of possible values. * * Generated from protobuf field optional string type = 3575610; */ - private $type = null; + protected $type = null; /** * Constructor. diff --git a/Compute/src/V1/AttachedDiskInitializeParams.php b/Compute/src/V1/AttachedDiskInitializeParams.php index bbc4aaec535f..9396837320f8 100644 --- a/Compute/src/V1/AttachedDiskInitializeParams.php +++ b/Compute/src/V1/AttachedDiskInitializeParams.php @@ -21,37 +21,37 @@ class AttachedDiskInitializeParams extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string architecture = 302803283; */ - private $architecture = null; + protected $architecture = null; /** * An optional description. Provide this property when creating the disk. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * Specifies the disk name. If not specified, the default is to use the name of the instance. If a disk with the same name already exists in the given region, the existing disk is attached to the new instance and the new disk is not created. * * Generated from protobuf field optional string disk_name = 92807149; */ - private $disk_name = null; + protected $disk_name = null; /** * Specifies the size of the disk in base-2 GB. The size must be at least 10 GB. If you specify a sourceImage, which is required for boot disks, the default size is the size of the sourceImage. If you do not specify a sourceImage, the default disk size is 500 GB. * * Generated from protobuf field optional int64 disk_size_gb = 316263735; */ - private $disk_size_gb = null; + protected $disk_size_gb = null; /** * Specifies the disk type to use to create the instance. If not specified, the default is pd-standard, specified using the full URL. For example: https://www.googleapis.com/compute/v1/projects/project/zones/zone /diskTypes/pd-standard For a full list of acceptable values, see Persistent disk types. If you specify this field when creating a VM, you can provide either the full or partial URL. For example, the following values are valid: - https://www.googleapis.com/compute/v1/projects/project/zones/zone /diskTypes/diskType - projects/project/zones/zone/diskTypes/diskType - zones/zone/diskTypes/diskType If you specify this field when creating or updating an instance template or all-instances configuration, specify the type of the disk, not the URL. For example: pd-standard. * * Generated from protobuf field optional string disk_type = 93009052; */ - private $disk_type = null; + protected $disk_type = null; /** * Whether this disk is using confidential compute mode. * * Generated from protobuf field optional bool enable_confidential_compute = 102135228; */ - private $enable_confidential_compute = null; + protected $enable_confidential_compute = null; /** * Labels to apply to this disk. These can be later modified by the disks.setLabels method. This field is only applicable for persistent disks. * @@ -70,19 +70,19 @@ class AttachedDiskInitializeParams extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string on_update_action = 202451980; */ - private $on_update_action = null; + protected $on_update_action = null; /** * Indicates how many IOPS to provision for the disk. This sets the number of I/O operations per second that the disk can handle. Values must be between 10,000 and 120,000. For more details, see the Extreme persistent disk documentation. * * Generated from protobuf field optional int64 provisioned_iops = 186769108; */ - private $provisioned_iops = null; + protected $provisioned_iops = null; /** * Indicates how much throughput to provision for the disk. This sets the number of throughput mb per second that the disk can handle. Values must greater than or equal to 1. * * Generated from protobuf field optional int64 provisioned_throughput = 526524181; */ - private $provisioned_throughput = null; + protected $provisioned_throughput = null; /** * Required for each regional disk associated with the instance. Specify the URLs of the zones where the disk should be replicated to. You must provide exactly two replica zones, and one zone must be the same as the instance zone. * @@ -106,31 +106,31 @@ class AttachedDiskInitializeParams extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string source_image = 50443319; */ - private $source_image = null; + protected $source_image = null; /** * The customer-supplied encryption key of the source image. Required if the source image is protected by a customer-supplied encryption key. InstanceTemplate and InstancePropertiesPatch do not store customer-supplied encryption keys, so you cannot create disks for instances in a managed instance group if the source images are encrypted with your own keys. * * Generated from protobuf field optional .google.cloud.compute.v1.CustomerEncryptionKey source_image_encryption_key = 381503659; */ - private $source_image_encryption_key = null; + protected $source_image_encryption_key = null; /** * The source snapshot to create this disk. When creating a new instance boot disk, one of initializeParams.sourceSnapshot or initializeParams.sourceImage or disks.source is required. To create a disk with a snapshot that you created, specify the snapshot name in the following format: global/snapshots/my-backup If the source snapshot is deleted later, this field will not be set. Note: You cannot create VMs in bulk using a snapshot as the source. Use an image instead when you create VMs using the bulk insert method. * * Generated from protobuf field optional string source_snapshot = 126061928; */ - private $source_snapshot = null; + protected $source_snapshot = null; /** * The customer-supplied encryption key of the source snapshot. * * Generated from protobuf field optional .google.cloud.compute.v1.CustomerEncryptionKey source_snapshot_encryption_key = 303679322; */ - private $source_snapshot_encryption_key = null; + protected $source_snapshot_encryption_key = null; /** * The storage pool in which the new disk is created. You can provide this as a partial or full URL to the resource. For example, the following are valid values: - https://www.googleapis.com/compute/v1/projects/project/zones/zone /storagePools/storagePool - projects/project/zones/zone/storagePools/storagePool - zones/zone/storagePools/storagePool * * Generated from protobuf field optional string storage_pool = 360473440; */ - private $storage_pool = null; + protected $storage_pool = null; /** * Constructor. diff --git a/Compute/src/V1/AuditConfig.php b/Compute/src/V1/AuditConfig.php index 16871baa2945..ba2325a3abfc 100644 --- a/Compute/src/V1/AuditConfig.php +++ b/Compute/src/V1/AuditConfig.php @@ -30,7 +30,7 @@ class AuditConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string service = 373540533; */ - private $service = null; + protected $service = null; /** * Constructor. diff --git a/Compute/src/V1/AuditLogConfig.php b/Compute/src/V1/AuditLogConfig.php index afed92390ee5..9ed971092a38 100644 --- a/Compute/src/V1/AuditLogConfig.php +++ b/Compute/src/V1/AuditLogConfig.php @@ -24,14 +24,14 @@ class AuditLogConfig extends \Google\Protobuf\Internal\Message /** * Generated from protobuf field optional bool ignore_child_exemptions = 70141850; */ - private $ignore_child_exemptions = null; + protected $ignore_child_exemptions = null; /** * The log type that this config enables. * Check the LogType enum for the list of possible values. * * Generated from protobuf field optional string log_type = 403115861; */ - private $log_type = null; + protected $log_type = null; /** * Constructor. diff --git a/Compute/src/V1/AuthorizationLoggingOptions.php b/Compute/src/V1/AuthorizationLoggingOptions.php deleted file mode 100644 index e1e62d044da5..000000000000 --- a/Compute/src/V1/AuthorizationLoggingOptions.php +++ /dev/null @@ -1,81 +0,0 @@ -google.cloud.compute.v1.AuthorizationLoggingOptions - */ -class AuthorizationLoggingOptions extends \Google\Protobuf\Internal\Message -{ - /** - * This is deprecated and has no effect. Do not use. - * Check the PermissionType enum for the list of possible values. - * - * Generated from protobuf field optional string permission_type = 525978538; - */ - private $permission_type = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $permission_type - * This is deprecated and has no effect. Do not use. - * Check the PermissionType enum for the list of possible values. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Compute\V1\Compute::initOnce(); - parent::__construct($data); - } - - /** - * This is deprecated and has no effect. Do not use. - * Check the PermissionType enum for the list of possible values. - * - * Generated from protobuf field optional string permission_type = 525978538; - * @return string - */ - public function getPermissionType() - { - return isset($this->permission_type) ? $this->permission_type : ''; - } - - public function hasPermissionType() - { - return isset($this->permission_type); - } - - public function clearPermissionType() - { - unset($this->permission_type); - } - - /** - * This is deprecated and has no effect. Do not use. - * Check the PermissionType enum for the list of possible values. - * - * Generated from protobuf field optional string permission_type = 525978538; - * @param string $var - * @return $this - */ - public function setPermissionType($var) - { - GPBUtil::checkString($var, True); - $this->permission_type = $var; - - return $this; - } - -} - diff --git a/Compute/src/V1/AuthorizationLoggingOptions/PermissionType.php b/Compute/src/V1/AuthorizationLoggingOptions/PermissionType.php deleted file mode 100644 index 82a138517e7b..000000000000 --- a/Compute/src/V1/AuthorizationLoggingOptions/PermissionType.php +++ /dev/null @@ -1,83 +0,0 @@ -google.cloud.compute.v1.AuthorizationLoggingOptions.PermissionType - */ -class PermissionType -{ - /** - * A value indicating that the enum field is not set. - * - * Generated from protobuf enum UNDEFINED_PERMISSION_TYPE = 0; - */ - const UNDEFINED_PERMISSION_TYPE = 0; - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf enum ADMIN_READ = 128951462; - */ - const ADMIN_READ = 128951462; - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf enum ADMIN_WRITE = 244412079; - */ - const ADMIN_WRITE = 244412079; - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf enum DATA_READ = 305224971; - */ - const DATA_READ = 305224971; - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf enum DATA_WRITE = 340181738; - */ - const DATA_WRITE = 340181738; - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf enum PERMISSION_TYPE_UNSPECIFIED = 440313346; - */ - const PERMISSION_TYPE_UNSPECIFIED = 440313346; - - private static $valueToName = [ - self::UNDEFINED_PERMISSION_TYPE => 'UNDEFINED_PERMISSION_TYPE', - self::ADMIN_READ => 'ADMIN_READ', - self::ADMIN_WRITE => 'ADMIN_WRITE', - self::DATA_READ => 'DATA_READ', - self::DATA_WRITE => 'DATA_WRITE', - self::PERMISSION_TYPE_UNSPECIFIED => 'PERMISSION_TYPE_UNSPECIFIED', - ]; - - 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/Compute/src/V1/Autoscaler.php b/Compute/src/V1/Autoscaler.php index 3671aed382c2..15536b19fcc7 100644 --- a/Compute/src/V1/Autoscaler.php +++ b/Compute/src/V1/Autoscaler.php @@ -9,7 +9,7 @@ use Google\Protobuf\Internal\GPBUtil; /** - * Represents an Autoscaler resource. Google Compute Engine has two Autoscaler resources: * [Zonal](/compute/docs/reference/rest/v1/autoscalers) * [Regional](https://cloud.google.com/compute/docs/reference/rest/v1/regionAutoscalers) Use autoscalers to automatically add or delete instances from a managed instance group according to your defined autoscaling policy. For more information, read Autoscaling Groups of Instances. For zonal managed instance groups resource, use the autoscaler resource. For regional managed instance groups, use the regionAutoscalers resource. + * Represents an Autoscaler resource. Google Compute Engine has two Autoscaler resources: * [Zonal](/compute/docs/reference/rest/v1/autoscalers) * [Regional](/compute/docs/reference/rest/v1/regionAutoscalers) Use autoscalers to automatically add or delete instances from a managed instance group according to your defined autoscaling policy. For more information, read Autoscaling Groups of Instances. For zonal managed instance groups resource, use the autoscaler resource. For regional managed instance groups, use the regionAutoscalers resource. * * Generated from protobuf message google.cloud.compute.v1.Autoscaler */ @@ -20,49 +20,49 @@ class Autoscaler extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.AutoscalingPolicy autoscaling_policy = 221950041; */ - private $autoscaling_policy = null; + protected $autoscaling_policy = null; /** * [Output Only] Creation timestamp in RFC3339 text format. * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * An optional description of this resource. Provide this property when you create the resource. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * [Output Only] The unique identifier for the resource. This identifier is defined by the server. * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * [Output Only] Type of the resource. Always compute#autoscaler for autoscalers. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * [Output Only] Target recommended MIG size (number of instances) computed by autoscaler. Autoscaler calculates the recommended MIG size even when the autoscaling policy mode is different from ON. This field is empty when autoscaler is not connected to an existing managed instance group or autoscaler did not generate its prediction. * * Generated from protobuf field optional int32 recommended_size = 257915749; */ - private $recommended_size = null; + protected $recommended_size = null; /** * [Output Only] URL of the region where the instance group resides (for autoscalers living in regional scope). * * Generated from protobuf field optional string region = 138946292; */ - private $region = null; + protected $region = null; /** * [Output Only] Status information of existing scaling schedules. * @@ -74,14 +74,14 @@ class Autoscaler extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] The status of the autoscaler configuration. Current set of possible values: - PENDING: Autoscaler backend hasn't read new/updated configuration. - DELETING: Configuration is being deleted. - ACTIVE: Configuration is acknowledged to be effective. Some warnings might be present in the statusDetails field. - ERROR: Configuration has errors. Actionable for users. Details are present in the statusDetails field. New values might be added in the future. * Check the Status enum for the list of possible values. * * Generated from protobuf field optional string status = 181260274; */ - private $status = null; + protected $status = null; /** * [Output Only] Human-readable details about the current state of the autoscaler. Read the documentation for Commonly returned status messages for examples of status messages you might encounter. * @@ -93,13 +93,13 @@ class Autoscaler extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string target = 192835985; */ - private $target = null; + protected $target = null; /** * [Output Only] URL of the zone where the instance group resides (for autoscalers living in zonal scope). * * Generated from protobuf field optional string zone = 3744684; */ - private $zone = null; + protected $zone = null; /** * Constructor. diff --git a/Compute/src/V1/AutoscalerAggregatedList.php b/Compute/src/V1/AutoscalerAggregatedList.php index d5c8f4fd1de0..7645a49e2e77 100644 --- a/Compute/src/V1/AutoscalerAggregatedList.php +++ b/Compute/src/V1/AutoscalerAggregatedList.php @@ -19,7 +19,7 @@ class AutoscalerAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of AutoscalersScopedList resources. * @@ -31,19 +31,19 @@ class AutoscalerAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Unreachable resources. end_interface: MixerListResponseWithEtagBuilder * @@ -55,7 +55,7 @@ class AutoscalerAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/AutoscalerList.php b/Compute/src/V1/AutoscalerList.php index f907b3f5b37e..282203b7cc84 100644 --- a/Compute/src/V1/AutoscalerList.php +++ b/Compute/src/V1/AutoscalerList.php @@ -20,7 +20,7 @@ class AutoscalerList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of Autoscaler resources. * @@ -32,25 +32,25 @@ class AutoscalerList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/AutoscalerStatusDetails.php b/Compute/src/V1/AutoscalerStatusDetails.php index 7ff8a0cc1a80..665cadb7c0db 100644 --- a/Compute/src/V1/AutoscalerStatusDetails.php +++ b/Compute/src/V1/AutoscalerStatusDetails.php @@ -19,14 +19,14 @@ class AutoscalerStatusDetails extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string message = 418054151; */ - private $message = null; + protected $message = null; /** * The type of error, warning, or notice returned. Current set of possible values: - ALL_INSTANCES_UNHEALTHY (WARNING): All instances in the instance group are unhealthy (not in RUNNING state). - BACKEND_SERVICE_DOES_NOT_EXIST (ERROR): There is no backend service attached to the instance group. - CAPPED_AT_MAX_NUM_REPLICAS (WARNING): Autoscaler recommends a size greater than maxNumReplicas. - CUSTOM_METRIC_DATA_POINTS_TOO_SPARSE (WARNING): The custom metric samples are not exported often enough to be a credible base for autoscaling. - CUSTOM_METRIC_INVALID (ERROR): The custom metric that was specified does not exist or does not have the necessary labels. - MIN_EQUALS_MAX (WARNING): The minNumReplicas is equal to maxNumReplicas. This means the autoscaler cannot add or remove instances from the instance group. - MISSING_CUSTOM_METRIC_DATA_POINTS (WARNING): The autoscaler did not receive any data from the custom metric configured for autoscaling. - MISSING_LOAD_BALANCING_DATA_POINTS (WARNING): The autoscaler is configured to scale based on a load balancing signal but the instance group has not received any requests from the load balancer. - MODE_OFF (WARNING): Autoscaling is turned off. The number of instances in the group won't change automatically. The autoscaling configuration is preserved. - MODE_ONLY_UP (WARNING): Autoscaling is in the "Autoscale only out" mode. The autoscaler can add instances but not remove any. - MORE_THAN_ONE_BACKEND_SERVICE (ERROR): The instance group cannot be autoscaled because it has more than one backend service attached to it. - NOT_ENOUGH_QUOTA_AVAILABLE (ERROR): There is insufficient quota for the necessary resources, such as CPU or number of instances. - REGION_RESOURCE_STOCKOUT (ERROR): Shown only for regional autoscalers: there is a resource stockout in the chosen region. - SCALING_TARGET_DOES_NOT_EXIST (ERROR): The target to be scaled does not exist. - UNSUPPORTED_MAX_RATE_LOAD_BALANCING_CONFIGURATION (ERROR): Autoscaling does not work with an HTTP/S load balancer that has been configured for maxRate. - ZONE_RESOURCE_STOCKOUT (ERROR): For zonal autoscalers: there is a resource stockout in the chosen zone. For regional autoscalers: in at least one of the zones you're using there is a resource stockout. New values might be added in the future. Some of the values might not be available in all API versions. * Check the Type enum for the list of possible values. * * Generated from protobuf field optional string type = 3575610; */ - private $type = null; + protected $type = null; /** * Constructor. diff --git a/Compute/src/V1/AutoscalersClient.php b/Compute/src/V1/AutoscalersClient.php deleted file mode 100644 index ccbcc015d33a..000000000000 --- a/Compute/src/V1/AutoscalersClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/AutoscalingPolicy.php b/Compute/src/V1/AutoscalingPolicy.php index 871370baa880..602da2478593 100644 --- a/Compute/src/V1/AutoscalingPolicy.php +++ b/Compute/src/V1/AutoscalingPolicy.php @@ -16,17 +16,17 @@ class AutoscalingPolicy extends \Google\Protobuf\Internal\Message { /** - * The number of seconds that your application takes to initialize on a VM instance. This is referred to as the [initialization period](https://cloud.google.com/compute/docs/autoscaler#cool_down_period). Specifying an accurate initialization period improves autoscaler decisions. For example, when scaling out, the autoscaler ignores data from VMs that are still initializing because those VMs might not yet represent normal usage of your application. The default initialization period is 60 seconds. Initialization periods might vary because of numerous factors. We recommend that you test how long your application takes to initialize. To do this, create a VM and time your application's startup process. + * The number of seconds that your application takes to initialize on a VM instance. This is referred to as the [initialization period](/compute/docs/autoscaler#cool_down_period). Specifying an accurate initialization period improves autoscaler decisions. For example, when scaling out, the autoscaler ignores data from VMs that are still initializing because those VMs might not yet represent normal usage of your application. The default initialization period is 60 seconds. Initialization periods might vary because of numerous factors. We recommend that you test how long your application takes to initialize. To do this, create a VM and time your application's startup process. * * Generated from protobuf field optional int32 cool_down_period_sec = 107692954; */ - private $cool_down_period_sec = null; + protected $cool_down_period_sec = null; /** * Defines the CPU utilization policy that allows the autoscaler to scale based on the average CPU utilization of a managed instance group. * * Generated from protobuf field optional .google.cloud.compute.v1.AutoscalingPolicyCpuUtilization cpu_utilization = 381211147; */ - private $cpu_utilization = null; + protected $cpu_utilization = null; /** * Configuration parameters of autoscaling based on a custom metric. * @@ -38,30 +38,30 @@ class AutoscalingPolicy extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.AutoscalingPolicyLoadBalancingUtilization load_balancing_utilization = 429746403; */ - private $load_balancing_utilization = null; + protected $load_balancing_utilization = null; /** * The maximum number of instances that the autoscaler can scale out to. This is required when creating or updating an autoscaler. The maximum number of replicas must not be lower than minimal number of replicas. * * Generated from protobuf field optional int32 max_num_replicas = 62327375; */ - private $max_num_replicas = null; + protected $max_num_replicas = null; /** * The minimum number of replicas that the autoscaler can scale in to. This cannot be less than 0. If not provided, autoscaler chooses a default value depending on maximum number of instances allowed. * * Generated from protobuf field optional int32 min_num_replicas = 535329825; */ - private $min_num_replicas = null; + protected $min_num_replicas = null; /** * Defines the operating mode for this policy. The following modes are available: - OFF: Disables the autoscaler but maintains its configuration. - ONLY_SCALE_OUT: Restricts the autoscaler to add VM instances only. - ON: Enables all autoscaler activities according to its policy. For more information, see "Turning off or restricting an autoscaler" * Check the Mode enum for the list of possible values. * * Generated from protobuf field optional string mode = 3357091; */ - private $mode = null; + protected $mode = null; /** * Generated from protobuf field optional .google.cloud.compute.v1.AutoscalingPolicyScaleInControl scale_in_control = 527670872; */ - private $scale_in_control = null; + protected $scale_in_control = null; /** * Scaling schedules defined for an autoscaler. Multiple schedules can be set on an autoscaler, and they can overlap. During overlapping periods the greatest min_required_replicas of all scaling schedules is applied. Up to 128 scaling schedules are allowed. * @@ -76,7 +76,7 @@ class AutoscalingPolicy extends \Google\Protobuf\Internal\Message * Optional. Data for populating the Message object. * * @type int $cool_down_period_sec - * The number of seconds that your application takes to initialize on a VM instance. This is referred to as the [initialization period](https://cloud.google.com/compute/docs/autoscaler#cool_down_period). Specifying an accurate initialization period improves autoscaler decisions. For example, when scaling out, the autoscaler ignores data from VMs that are still initializing because those VMs might not yet represent normal usage of your application. The default initialization period is 60 seconds. Initialization periods might vary because of numerous factors. We recommend that you test how long your application takes to initialize. To do this, create a VM and time your application's startup process. + * The number of seconds that your application takes to initialize on a VM instance. This is referred to as the [initialization period](/compute/docs/autoscaler#cool_down_period). Specifying an accurate initialization period improves autoscaler decisions. For example, when scaling out, the autoscaler ignores data from VMs that are still initializing because those VMs might not yet represent normal usage of your application. The default initialization period is 60 seconds. Initialization periods might vary because of numerous factors. We recommend that you test how long your application takes to initialize. To do this, create a VM and time your application's startup process. * @type \Google\Cloud\Compute\V1\AutoscalingPolicyCpuUtilization $cpu_utilization * Defines the CPU utilization policy that allows the autoscaler to scale based on the average CPU utilization of a managed instance group. * @type array<\Google\Cloud\Compute\V1\AutoscalingPolicyCustomMetricUtilization>|\Google\Protobuf\Internal\RepeatedField $custom_metric_utilizations @@ -101,7 +101,7 @@ public function __construct($data = NULL) { } /** - * The number of seconds that your application takes to initialize on a VM instance. This is referred to as the [initialization period](https://cloud.google.com/compute/docs/autoscaler#cool_down_period). Specifying an accurate initialization period improves autoscaler decisions. For example, when scaling out, the autoscaler ignores data from VMs that are still initializing because those VMs might not yet represent normal usage of your application. The default initialization period is 60 seconds. Initialization periods might vary because of numerous factors. We recommend that you test how long your application takes to initialize. To do this, create a VM and time your application's startup process. + * The number of seconds that your application takes to initialize on a VM instance. This is referred to as the [initialization period](/compute/docs/autoscaler#cool_down_period). Specifying an accurate initialization period improves autoscaler decisions. For example, when scaling out, the autoscaler ignores data from VMs that are still initializing because those VMs might not yet represent normal usage of your application. The default initialization period is 60 seconds. Initialization periods might vary because of numerous factors. We recommend that you test how long your application takes to initialize. To do this, create a VM and time your application's startup process. * * Generated from protobuf field optional int32 cool_down_period_sec = 107692954; * @return int @@ -122,7 +122,7 @@ public function clearCoolDownPeriodSec() } /** - * The number of seconds that your application takes to initialize on a VM instance. This is referred to as the [initialization period](https://cloud.google.com/compute/docs/autoscaler#cool_down_period). Specifying an accurate initialization period improves autoscaler decisions. For example, when scaling out, the autoscaler ignores data from VMs that are still initializing because those VMs might not yet represent normal usage of your application. The default initialization period is 60 seconds. Initialization periods might vary because of numerous factors. We recommend that you test how long your application takes to initialize. To do this, create a VM and time your application's startup process. + * The number of seconds that your application takes to initialize on a VM instance. This is referred to as the [initialization period](/compute/docs/autoscaler#cool_down_period). Specifying an accurate initialization period improves autoscaler decisions. For example, when scaling out, the autoscaler ignores data from VMs that are still initializing because those VMs might not yet represent normal usage of your application. The default initialization period is 60 seconds. Initialization periods might vary because of numerous factors. We recommend that you test how long your application takes to initialize. To do this, create a VM and time your application's startup process. * * Generated from protobuf field optional int32 cool_down_period_sec = 107692954; * @param int $var diff --git a/Compute/src/V1/AutoscalingPolicyCpuUtilization.php b/Compute/src/V1/AutoscalingPolicyCpuUtilization.php index efd531848f13..7cfd66c0e455 100644 --- a/Compute/src/V1/AutoscalingPolicyCpuUtilization.php +++ b/Compute/src/V1/AutoscalingPolicyCpuUtilization.php @@ -21,13 +21,13 @@ class AutoscalingPolicyCpuUtilization extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string predictive_method = 390220737; */ - private $predictive_method = null; + protected $predictive_method = null; /** * The target CPU utilization that the autoscaler maintains. Must be a float value in the range (0, 1]. If not specified, the default is 0.6. If the CPU level is below the target utilization, the autoscaler scales in the number of instances until it reaches the minimum number of instances you specified or until the average CPU of your instances reaches the target utilization. If the average CPU is above the target utilization, the autoscaler scales out until it reaches the maximum number of instances you specified or until the average utilization reaches the target utilization. * * Generated from protobuf field optional double utilization_target = 215905870; */ - private $utilization_target = null; + protected $utilization_target = null; /** * Constructor. diff --git a/Compute/src/V1/AutoscalingPolicyCustomMetricUtilization.php b/Compute/src/V1/AutoscalingPolicyCustomMetricUtilization.php index dab994155090..c9784d1dbe87 100644 --- a/Compute/src/V1/AutoscalingPolicyCustomMetricUtilization.php +++ b/Compute/src/V1/AutoscalingPolicyCustomMetricUtilization.php @@ -20,32 +20,32 @@ class AutoscalingPolicyCustomMetricUtilization extends \Google\Protobuf\Internal * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The identifier (type) of the Stackdriver Monitoring metric. The metric cannot have negative values. The metric must have a value type of INT64 or DOUBLE. * * Generated from protobuf field optional string metric = 533067184; */ - private $metric = null; + protected $metric = null; /** * If scaling is based on a per-group metric value that represents the total amount of work to be done or resource usage, set this value to an amount assigned for a single instance of the scaled group. Autoscaler keeps the number of instances proportional to the value of this metric. The metric itself does not change value due to group resizing. A good metric to use with the target is for example pubsub.googleapis.com/subscription/num_undelivered_messages or a custom metric exporting the total number of requests coming to your instances. A bad example would be a metric exporting an average or median latency, since this value can't include a chunk assignable to a single instance, it could be better used with utilization_target instead. * * Generated from protobuf field optional double single_instance_assignment = 504768064; */ - private $single_instance_assignment = null; + protected $single_instance_assignment = null; /** * The target value of the metric that autoscaler maintains. This must be a positive value. A utilization metric scales number of virtual machines handling requests to increase or decrease proportionally to the metric. For example, a good metric to use as a utilization_target is https://www.googleapis.com/compute/v1/instance/network/received_bytes_count. The autoscaler works to keep this value constant for each of the instances. * * Generated from protobuf field optional double utilization_target = 215905870; */ - private $utilization_target = null; + protected $utilization_target = null; /** * Defines how target utilization value is expressed for a Stackdriver Monitoring metric. Either GAUGE, DELTA_PER_SECOND, or DELTA_PER_MINUTE. * Check the UtilizationTargetType enum for the list of possible values. * * Generated from protobuf field optional string utilization_target_type = 340169355; */ - private $utilization_target_type = null; + protected $utilization_target_type = null; /** * Constructor. diff --git a/Compute/src/V1/AutoscalingPolicyLoadBalancingUtilization.php b/Compute/src/V1/AutoscalingPolicyLoadBalancingUtilization.php index c28600dbbba4..392eaf66b682 100644 --- a/Compute/src/V1/AutoscalingPolicyLoadBalancingUtilization.php +++ b/Compute/src/V1/AutoscalingPolicyLoadBalancingUtilization.php @@ -20,7 +20,7 @@ class AutoscalingPolicyLoadBalancingUtilization extends \Google\Protobuf\Interna * * Generated from protobuf field optional double utilization_target = 215905870; */ - private $utilization_target = null; + protected $utilization_target = null; /** * Constructor. diff --git a/Compute/src/V1/AutoscalingPolicyScaleInControl.php b/Compute/src/V1/AutoscalingPolicyScaleInControl.php index e3a5de70c750..7eaad9298951 100644 --- a/Compute/src/V1/AutoscalingPolicyScaleInControl.php +++ b/Compute/src/V1/AutoscalingPolicyScaleInControl.php @@ -20,13 +20,13 @@ class AutoscalingPolicyScaleInControl extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.FixedOrPercent max_scaled_in_replicas = 180710123; */ - private $max_scaled_in_replicas = null; + protected $max_scaled_in_replicas = null; /** * How far back autoscaling looks when computing recommendations to include directives regarding slower scale in, as described above. * * Generated from protobuf field optional int32 time_window_sec = 36405300; */ - private $time_window_sec = null; + protected $time_window_sec = null; /** * Constructor. diff --git a/Compute/src/V1/AutoscalingPolicyScalingSchedule.php b/Compute/src/V1/AutoscalingPolicyScalingSchedule.php index 7149ceca713e..048b63f5ab8c 100644 --- a/Compute/src/V1/AutoscalingPolicyScalingSchedule.php +++ b/Compute/src/V1/AutoscalingPolicyScalingSchedule.php @@ -20,37 +20,37 @@ class AutoscalingPolicyScalingSchedule extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * A boolean value that specifies whether a scaling schedule can influence autoscaler recommendations. If set to true, then a scaling schedule has no effect. This field is optional, and its value is false by default. * * Generated from protobuf field optional bool disabled = 270940796; */ - private $disabled = null; + protected $disabled = null; /** * The duration of time intervals, in seconds, for which this scaling schedule is to run. The minimum allowed value is 300. This field is required. * * Generated from protobuf field optional int32 duration_sec = 212356902; */ - private $duration_sec = null; + protected $duration_sec = null; /** * The minimum number of VM instances that the autoscaler will recommend in time intervals starting according to schedule. This field is required. * * Generated from protobuf field optional int32 min_required_replicas = 365514414; */ - private $min_required_replicas = null; + protected $min_required_replicas = null; /** * The start timestamps of time intervals when this scaling schedule is to provide a scaling signal. This field uses the extended cron format (with an optional year field). The expression can describe a single timestamp if the optional year is set, in which case the scaling schedule runs once. The schedule is interpreted with respect to time_zone. This field is required. Note: These timestamps only describe when autoscaler starts providing the scaling signal. The VMs need additional time to become serving. * * Generated from protobuf field optional string schedule = 375820951; */ - private $schedule = null; + protected $schedule = null; /** * The time zone to use when interpreting the schedule. The value of this field must be a time zone name from the tz database: https://en.wikipedia.org/wiki/Tz_database. This field is assigned a default value of "UTC" if left empty. * * Generated from protobuf field optional string time_zone = 36848094; */ - private $time_zone = null; + protected $time_zone = null; /** * Constructor. diff --git a/Compute/src/V1/Backend.php b/Compute/src/V1/Backend.php index 659c20c4f370..0b22d2519651 100644 --- a/Compute/src/V1/Backend.php +++ b/Compute/src/V1/Backend.php @@ -21,13 +21,13 @@ class Backend extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string balancing_mode = 430286217; */ - private $balancing_mode = null; + protected $balancing_mode = null; /** * A multiplier applied to the backend's target capacity of its balancing mode. The default value is 1, which means the group serves up to 100% of its configured capacity (depending on balancingMode). A setting of 0 means the group is completely drained, offering 0% of its available capacity. The valid ranges are 0.0 and [0.1,1.0]. You cannot configure a setting larger than 0 and smaller than 0.1. You cannot configure a setting of 0 when there is only one backend attached to the backend service. Not available with backends that don't support using a balancingMode. This includes backends such as global internet NEGs, regional serverless NEGs, and PSC NEGs. * * Generated from protobuf field optional float capacity_scaler = 315958157; */ - private $capacity_scaler = null; + protected $capacity_scaler = null; /** * List of custom metrics that are used for CUSTOM_METRICS BalancingMode. * @@ -39,68 +39,68 @@ class Backend extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * This field designates whether this is a failover backend. More than one failover backend can be configured for a given BackendService. * * Generated from protobuf field optional bool failover = 138892530; */ - private $failover = null; + protected $failover = null; /** * The fully-qualified URL of an instance group or network endpoint group (NEG) resource. To determine what types of backends a load balancer supports, see the [Backend services overview](https://cloud.google.com/load-balancing/docs/backend-service#backends). You must use the *fully-qualified* URL (starting with https://www.googleapis.com/) to specify the instance group or NEG. Partial URLs are not supported. If haPolicy is specified, backends must refer to NEG resources of type GCE_VM_IP. * * Generated from protobuf field optional string group = 98629247; */ - private $group = null; + protected $group = null; /** * Defines a target maximum number of simultaneous connections. For usage guidelines, see Connection balancing mode and Utilization balancing mode. Not available if the backend's balancingMode is RATE. * * Generated from protobuf field optional int32 max_connections = 110652154; */ - private $max_connections = null; + protected $max_connections = null; /** * Defines a target maximum number of simultaneous connections. For usage guidelines, see Connection balancing mode and Utilization balancing mode. Not available if the backend's balancingMode is RATE. * * Generated from protobuf field optional int32 max_connections_per_endpoint = 216904604; */ - private $max_connections_per_endpoint = null; + protected $max_connections_per_endpoint = null; /** * Defines a target maximum number of simultaneous connections. For usage guidelines, see Connection balancing mode and Utilization balancing mode. Not available if the backend's balancingMode is RATE. * * Generated from protobuf field optional int32 max_connections_per_instance = 104671900; */ - private $max_connections_per_instance = null; + protected $max_connections_per_instance = null; /** * Defines a maximum number of HTTP requests per second (RPS). For usage guidelines, see Rate balancing mode and Utilization balancing mode. Not available if the backend's balancingMode is CONNECTION. * * Generated from protobuf field optional int32 max_rate = 408035035; */ - private $max_rate = null; + protected $max_rate = null; /** * Defines a maximum target for requests per second (RPS). For usage guidelines, see Rate balancing mode and Utilization balancing mode. Not available if the backend's balancingMode is CONNECTION. * * Generated from protobuf field optional float max_rate_per_endpoint = 129832283; */ - private $max_rate_per_endpoint = null; + protected $max_rate_per_endpoint = null; /** * Defines a maximum target for requests per second (RPS). For usage guidelines, see Rate balancing mode and Utilization balancing mode. Not available if the backend's balancingMode is CONNECTION. * * Generated from protobuf field optional float max_rate_per_instance = 17599579; */ - private $max_rate_per_instance = null; + protected $max_rate_per_instance = null; /** * Optional parameter to define a target capacity for the UTILIZATION balancing mode. The valid range is [0.0, 1.0]. For usage guidelines, see Utilization balancing mode. * * Generated from protobuf field optional float max_utilization = 148192199; */ - private $max_utilization = null; + protected $max_utilization = null; /** * This field indicates whether this backend should be fully utilized before sending traffic to backends with default preference. The possible values are: - PREFERRED: Backends with this preference level will be filled up to their capacity limits first, based on RTT. - DEFAULT: If preferred backends don't have enough capacity, backends in this layer would be used and traffic would be assigned based on the load balancing algorithm you use. This is the default * Check the Preference enum for the list of possible values. * * Generated from protobuf field optional string preference = 150781147; */ - private $preference = null; + protected $preference = null; /** * Constructor. diff --git a/Compute/src/V1/BackendBucket.php b/Compute/src/V1/BackendBucket.php index 816a152374a1..8b9bb0dce94f 100644 --- a/Compute/src/V1/BackendBucket.php +++ b/Compute/src/V1/BackendBucket.php @@ -20,26 +20,26 @@ class BackendBucket extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string bucket_name = 283610048; */ - private $bucket_name = null; + protected $bucket_name = null; /** * Cloud CDN configuration for this BackendBucket. * * Generated from protobuf field optional .google.cloud.compute.v1.BackendBucketCdnPolicy cdn_policy = 213976452; */ - private $cdn_policy = null; + protected $cdn_policy = null; /** * Compress text responses using Brotli or gzip compression, based on the client's Accept-Encoding header. * Check the CompressionMode enum for the list of possible values. * * Generated from protobuf field optional string compression_mode = 95520988; */ - private $compression_mode = null; + protected $compression_mode = null; /** * [Output Only] Creation timestamp in RFC3339 text format. * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * Headers that the Application Load Balancer should add to proxied responses. * @@ -51,56 +51,56 @@ class BackendBucket extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * [Output Only] The resource URL for the edge security policy associated with this backend bucket. * * Generated from protobuf field optional string edge_security_policy = 41036943; */ - private $edge_security_policy = null; + protected $edge_security_policy = null; /** * If true, enable Cloud CDN for this BackendBucket. * * Generated from protobuf field optional bool enable_cdn = 282942321; */ - private $enable_cdn = null; + protected $enable_cdn = null; /** * [Output Only] Unique identifier for the resource; defined by the server. * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * Type of the resource. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * The value can only be INTERNAL_MANAGED for cross-region internal layer 7 load balancer. If loadBalancingScheme is not specified, the backend bucket can be used by classic global external load balancers, or global application external load balancers, or both. * Check the LoadBalancingScheme enum for the list of possible values. * * Generated from protobuf field optional string load_balancing_scheme = 363890244; */ - private $load_balancing_scheme = null; + protected $load_balancing_scheme = null; /** * Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * Input only. [Input Only] Additional params passed with the request, but not persisted as part of resource payload. * * Generated from protobuf field optional .google.cloud.compute.v1.BackendBucketParams params = 78313862; */ - private $params = null; + protected $params = null; /** * [Output Only] Server-defined URL for the resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] List of resources referencing that backend bucket. * diff --git a/Compute/src/V1/BackendBucketCdnPolicy.php b/Compute/src/V1/BackendBucketCdnPolicy.php index 1255c7a66283..ecb2b462ab0f 100644 --- a/Compute/src/V1/BackendBucketCdnPolicy.php +++ b/Compute/src/V1/BackendBucketCdnPolicy.php @@ -26,38 +26,38 @@ class BackendBucketCdnPolicy extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.BackendBucketCdnPolicyCacheKeyPolicy cache_key_policy = 159263727; */ - private $cache_key_policy = null; + protected $cache_key_policy = null; /** * Specifies the cache setting for all responses from this backend. The possible values are: USE_ORIGIN_HEADERS Requires the origin to set valid caching headers to cache content. Responses without these headers will not be cached at Google's edge, and will require a full trip to the origin on every request, potentially impacting performance and increasing load on the origin server. FORCE_CACHE_ALL Cache all content, ignoring any "private", "no-store" or "no-cache" directives in Cache-Control response headers. Warning: this may result in Cloud CDN caching private, per-user (user identifiable) content. CACHE_ALL_STATIC Automatically cache static content, including common image formats, media (video and audio), and web assets (JavaScript and CSS). Requests and responses that are marked as uncacheable, as well as dynamic content (including HTML), will not be cached. If no value is provided for cdnPolicy.cacheMode, it defaults to CACHE_ALL_STATIC. * Check the CacheMode enum for the list of possible values. * * Generated from protobuf field optional string cache_mode = 28877888; */ - private $cache_mode = null; + protected $cache_mode = null; /** * Specifies a separate client (e.g. browser client) maximum TTL. This is used to clamp the max-age (or Expires) value sent to the client. With FORCE_CACHE_ALL, the lesser of client_ttl and default_ttl is used for the response max-age directive, along with a "public" directive. For cacheable content in CACHE_ALL_STATIC mode, client_ttl clamps the max-age from the origin (if specified), or else sets the response max-age directive to the lesser of the client_ttl and default_ttl, and also ensures a "public" cache-control directive is present. If a client TTL is not specified, a default value (1 hour) will be used. The maximum allowed value is 31,622,400s (1 year). * * Generated from protobuf field optional int32 client_ttl = 29034360; */ - private $client_ttl = null; + protected $client_ttl = null; /** * Specifies the default TTL for cached content served by this origin for responses that do not have an existing valid TTL (max-age or s-maxage). Setting a TTL of "0" means "always revalidate". The value of defaultTTL cannot be set to a value greater than that of maxTTL, but can be equal. When the cacheMode is set to FORCE_CACHE_ALL, the defaultTTL will overwrite the TTL set in all responses. The maximum allowed value is 31,622,400s (1 year), noting that infrequently accessed objects may be evicted from the cache before the defined TTL. * * Generated from protobuf field optional int32 default_ttl = 100253422; */ - private $default_ttl = null; + protected $default_ttl = null; /** * Specifies the maximum allowed TTL for cached content served by this origin. Cache directives that attempt to set a max-age or s-maxage higher than this, or an Expires header more than maxTTL seconds in the future will be capped at the value of maxTTL, as if it were the value of an s-maxage Cache-Control directive. Headers sent to the client will not be modified. Setting a TTL of "0" means "always revalidate". The maximum allowed value is 31,622,400s (1 year), noting that infrequently accessed objects may be evicted from the cache before the defined TTL. * * Generated from protobuf field optional int32 max_ttl = 307578001; */ - private $max_ttl = null; + protected $max_ttl = null; /** * Negative caching allows per-status code TTLs to be set, in order to apply fine-grained caching for common errors or redirects. This can reduce the load on your origin and improve end-user experience by reducing response latency. When the cache mode is set to CACHE_ALL_STATIC or USE_ORIGIN_HEADERS, negative caching applies to responses with the specified response code that lack any Cache-Control, Expires, or Pragma: no-cache directives. When the cache mode is set to FORCE_CACHE_ALL, negative caching applies to all responses with the specified response code, and override any caching headers. By default, Cloud CDN will apply the following default TTLs to these status codes: HTTP 300 (Multiple Choice), 301, 308 (Permanent Redirects): 10m HTTP 404 (Not Found), 410 (Gone), 451 (Unavailable For Legal Reasons): 120s HTTP 405 (Method Not Found), 421 (Misdirected Request), 501 (Not Implemented): 60s. These defaults can be overridden in negative_caching_policy. * * Generated from protobuf field optional bool negative_caching = 336110005; */ - private $negative_caching = null; + protected $negative_caching = null; /** * Sets a cache TTL for the specified HTTP status code. negative_caching must be enabled to configure negative_caching_policy. Omitting the policy and leaving negative_caching enabled will use Cloud CDN's default cache TTLs. Note that when specifying an explicit negative_caching_policy, you should take care to specify a cache TTL for all response codes that you wish to cache. Cloud CDN will not apply any default negative caching when a policy exists. * @@ -69,19 +69,19 @@ class BackendBucketCdnPolicy extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional bool request_coalescing = 532808276; */ - private $request_coalescing = null; + protected $request_coalescing = null; /** * Serve existing content from the cache (if available) when revalidating content with the origin, or when an error is encountered when refreshing the cache. This setting defines the default "max-stale" duration for any cached responses that do not specify a max-stale directive. Stale responses that exceed the TTL configured here will not be served. The default limit (max-stale) is 86400s (1 day), which will allow stale content to be served up to this limit beyond the max-age (or s-maxage) of a cached response. The maximum allowed value is 604800 (1 week). Set this to zero (0) to disable serve-while-stale. * * Generated from protobuf field optional int32 serve_while_stale = 236682203; */ - private $serve_while_stale = null; + protected $serve_while_stale = null; /** * Maximum number of seconds the response to a signed URL request will be considered fresh. After this time period, the response will be revalidated before being served. Defaults to 1hr (3600s). When serving responses to signed URL requests, Cloud CDN will internally behave as though all responses from this backend had a "Cache-Control: public, max-age=[TTL]" header, regardless of any existing Cache-Control header. The actual headers served in responses will not be altered. * * Generated from protobuf field optional int64 signed_url_cache_max_age_sec = 269374534; */ - private $signed_url_cache_max_age_sec = null; + protected $signed_url_cache_max_age_sec = null; /** * [Output Only] Names of the keys for signing request URLs. * diff --git a/Compute/src/V1/BackendBucketCdnPolicyBypassCacheOnRequestHeader.php b/Compute/src/V1/BackendBucketCdnPolicyBypassCacheOnRequestHeader.php index 4c79eb478f8b..381725e21bb9 100644 --- a/Compute/src/V1/BackendBucketCdnPolicyBypassCacheOnRequestHeader.php +++ b/Compute/src/V1/BackendBucketCdnPolicyBypassCacheOnRequestHeader.php @@ -20,7 +20,7 @@ class BackendBucketCdnPolicyBypassCacheOnRequestHeader extends \Google\Protobuf\ * * Generated from protobuf field optional string header_name = 110223613; */ - private $header_name = null; + protected $header_name = null; /** * Constructor. diff --git a/Compute/src/V1/BackendBucketCdnPolicyNegativeCachingPolicy.php b/Compute/src/V1/BackendBucketCdnPolicyNegativeCachingPolicy.php index 6e0ba6307024..afefc245d1eb 100644 --- a/Compute/src/V1/BackendBucketCdnPolicyNegativeCachingPolicy.php +++ b/Compute/src/V1/BackendBucketCdnPolicyNegativeCachingPolicy.php @@ -20,13 +20,13 @@ class BackendBucketCdnPolicyNegativeCachingPolicy extends \Google\Protobuf\Inter * * Generated from protobuf field optional int32 code = 3059181; */ - private $code = null; + protected $code = null; /** * The TTL (in seconds) for which to cache responses with the corresponding status code. The maximum allowed value is 1800s (30 minutes), noting that infrequently accessed objects may be evicted from the cache before the defined TTL. * * Generated from protobuf field optional int32 ttl = 115180; */ - private $ttl = null; + protected $ttl = null; /** * Constructor. diff --git a/Compute/src/V1/BackendBucketList.php b/Compute/src/V1/BackendBucketList.php index a56de1003782..7314a3ea61ef 100644 --- a/Compute/src/V1/BackendBucketList.php +++ b/Compute/src/V1/BackendBucketList.php @@ -20,7 +20,7 @@ class BackendBucketList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of BackendBucket resources. * @@ -32,25 +32,25 @@ class BackendBucketList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/BackendBucketUsedBy.php b/Compute/src/V1/BackendBucketUsedBy.php index 6f365f302095..f1c68dfba688 100644 --- a/Compute/src/V1/BackendBucketUsedBy.php +++ b/Compute/src/V1/BackendBucketUsedBy.php @@ -19,7 +19,7 @@ class BackendBucketUsedBy extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string reference = 148586315; */ - private $reference = null; + protected $reference = null; /** * Constructor. diff --git a/Compute/src/V1/BackendBucketsClient.php b/Compute/src/V1/BackendBucketsClient.php deleted file mode 100644 index 098deff54757..000000000000 --- a/Compute/src/V1/BackendBucketsClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional bool dry_run = 323854839; */ - private $dry_run = null; + protected $dry_run = null; /** * Optional parameter to define a target utilization for the Custom Metrics balancing mode. The valid range is [0.0, 1.0]. * * Generated from protobuf field optional float max_utilization = 148192199; */ - private $max_utilization = null; + protected $max_utilization = null; /** * Name of a custom utilization signal. The name must be 1-64 characters long and match the regular expression [a-z]([-_.a-z0-9]*[a-z0-9])? which means that the first character must be a lowercase letter, and all following characters must be a dash, period, underscore, lowercase letter, or digit, except the last character, which cannot be a dash, period, or underscore. For usage guidelines, see Custom Metrics balancing mode. This field can only be used for a global or regional backend service with the loadBalancingScheme set to EXTERNAL_MANAGED, INTERNAL_MANAGED INTERNAL_SELF_MANAGED. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * Constructor. diff --git a/Compute/src/V1/BackendService.php b/Compute/src/V1/BackendService.php index f3742b05c6aa..17bfef0463a4 100644 --- a/Compute/src/V1/BackendService.php +++ b/Compute/src/V1/BackendService.php @@ -20,7 +20,7 @@ class BackendService extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int32 affinity_cookie_ttl_sec = 369996954; */ - private $affinity_cookie_ttl_sec = null; + protected $affinity_cookie_ttl_sec = null; /** * The list of backends that serve this BackendService. * @@ -32,42 +32,42 @@ class BackendService extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.BackendServiceCdnPolicy cdn_policy = 213976452; */ - private $cdn_policy = null; + protected $cdn_policy = null; /** * Generated from protobuf field optional .google.cloud.compute.v1.CircuitBreakers circuit_breakers = 421340061; */ - private $circuit_breakers = null; + protected $circuit_breakers = null; /** * Compress text responses using Brotli or gzip compression, based on the client's Accept-Encoding header. * Check the CompressionMode enum for the list of possible values. * * Generated from protobuf field optional string compression_mode = 95520988; */ - private $compression_mode = null; + protected $compression_mode = null; /** * connectionDraining cannot be specified with haPolicy. * * Generated from protobuf field optional .google.cloud.compute.v1.ConnectionDraining connection_draining = 461096747; */ - private $connection_draining = null; + protected $connection_draining = null; /** * Connection Tracking configuration for this BackendService. Connection tracking policy settings are only available for external passthrough Network Load Balancers and internal passthrough Network Load Balancers. connectionTrackingPolicy cannot be specified with haPolicy. * * Generated from protobuf field optional .google.cloud.compute.v1.BackendServiceConnectionTrackingPolicy connection_tracking_policy = 143994969; */ - private $connection_tracking_policy = null; + protected $connection_tracking_policy = null; /** * Consistent Hash-based load balancing can be used to provide soft session affinity based on HTTP headers, cookies or other properties. This load balancing policy is applicable only for HTTP connections. The affinity to a particular destination host will be lost when one or more hosts are added/removed from the destination service. This field specifies parameters that control consistent hashing. This field is only applicable when localityLbPolicy is set to MAGLEV or RING_HASH. This field is applicable to either: - A regional backend service with the service_protocol set to HTTP, HTTPS, HTTP2 or H2C, and load_balancing_scheme set to INTERNAL_MANAGED. - A global backend service with the load_balancing_scheme set to INTERNAL_SELF_MANAGED. * * Generated from protobuf field optional .google.cloud.compute.v1.ConsistentHashLoadBalancerSettings consistent_hash = 905883; */ - private $consistent_hash = null; + protected $consistent_hash = null; /** * [Output Only] Creation timestamp in RFC3339 text format. * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * List of custom metrics that are used for the WEIGHTED_ROUND_ROBIN locality_lb_policy. * @@ -91,50 +91,50 @@ class BackendService extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * [Output Only] The resource URL for the edge security policy associated with this backend service. * * Generated from protobuf field optional string edge_security_policy = 41036943; */ - private $edge_security_policy = null; + protected $edge_security_policy = null; /** * If true, enables Cloud CDN for the backend service of a global external Application Load Balancer. * * Generated from protobuf field optional bool enable_c_d_n = 250733499; */ - private $enable_c_d_n = null; + protected $enable_c_d_n = null; /** * Specifies the canary migration state. Possible values are PREPARE, TEST_BY_PERCENTAGE, and TEST_ALL_TRAFFIC. To begin the migration from EXTERNAL to EXTERNAL_MANAGED, the state must be changed to PREPARE. The state must be changed to TEST_ALL_TRAFFIC before the loadBalancingScheme can be changed to EXTERNAL_MANAGED. Optionally, the TEST_BY_PERCENTAGE state can be used to migrate traffic by percentage using externalManagedMigrationTestingPercentage. Rolling back a migration requires the states to be set in reverse order. So changing the scheme from EXTERNAL_MANAGED to EXTERNAL requires the state to be set to TEST_ALL_TRAFFIC at the same time. Optionally, the TEST_BY_PERCENTAGE state can be used to migrate some traffic back to EXTERNAL or PREPARE can be used to migrate all traffic back to EXTERNAL. * Check the ExternalManagedMigrationState enum for the list of possible values. * * Generated from protobuf field optional string external_managed_migration_state = 66947020; */ - private $external_managed_migration_state = null; + protected $external_managed_migration_state = null; /** * Determines the fraction of requests that should be processed by the Global external Application Load Balancer. The value of this field must be in the range [0, 100]. Session affinity options will slightly affect this routing behavior, for more details, see: Session Affinity. This value can only be set if the loadBalancingScheme in the BackendService is set to EXTERNAL (when using the classic Application Load Balancer) and the migration state is TEST_BY_PERCENTAGE. * * Generated from protobuf field optional float external_managed_migration_testing_percentage = 507232462; */ - private $external_managed_migration_testing_percentage = null; + protected $external_managed_migration_testing_percentage = null; /** * Requires at least one backend instance group to be defined as a backup (failover) backend. For load balancers that have configurable failover: [Internal passthrough Network Load Balancers](https://cloud.google.com/load-balancing/docs/internal/failover-overview) and [external passthrough Network Load Balancers](https://cloud.google.com/load-balancing/docs/network/networklb-failover-overview). failoverPolicy cannot be specified with haPolicy. * * Generated from protobuf field optional .google.cloud.compute.v1.BackendServiceFailoverPolicy failover_policy = 105658655; */ - private $failover_policy = null; + protected $failover_policy = null; /** * Fingerprint of this resource. A hash of the contents stored in this object. This field is used in optimistic locking. This field will be ignored when inserting a BackendService. An up-to-date fingerprint must be provided in order to update the BackendService, otherwise the request will fail with error 412 conditionNotMet. To see the latest fingerprint, make a get() request to retrieve a BackendService. * * Generated from protobuf field optional string fingerprint = 234678500; */ - private $fingerprint = null; + protected $fingerprint = null; /** * Configures self-managed High Availability (HA) for External and Internal Protocol Forwarding. The backends of this regional backend service must only specify zonal network endpoint groups (NEGs) of type GCE_VM_IP. When haPolicy is set for an Internal Passthrough Network Load Balancer, the regional backend service must set the network field. All zonal NEGs must belong to the same network. However, individual NEGs can belong to different subnetworks of that network. When haPolicy is specified, the set of attached network endpoints across all backends comprise an High Availability domain from which one endpoint is selected as the active endpoint (the leader) that receives all traffic. haPolicy can be added only at backend service creation time. Once set up, it cannot be deleted. Note that haPolicy is not for load balancing, and therefore cannot be specified with sessionAffinity, connectionTrackingPolicy, and failoverPolicy. haPolicy requires customers to be responsible for tracking backend endpoint health and electing a leader among the healthy endpoints. Therefore, haPolicy cannot be specified with healthChecks. haPolicy can only be specified for External Passthrough Network Load Balancers and Internal Passthrough Network Load Balancers. * * Generated from protobuf field optional .google.cloud.compute.v1.BackendServiceHAPolicy ha_policy = 519879480; */ - private $ha_policy = null; + protected $ha_policy = null; /** * The list of URLs to the healthChecks, httpHealthChecks (legacy), or httpsHealthChecks (legacy) resource for health checking this backend service. Not all backend services support legacy health checks. See Load balancer guide. Currently, at most one health check can be specified for each backend service. Backend services with instance group or zonal NEG backends must have a health check unless haPolicy is specified. Backend services with internet or serverless NEG backends must not have a health check. healthChecks[] cannot be specified with haPolicy. * @@ -146,33 +146,33 @@ class BackendService extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.BackendServiceIAP iap = 104024; */ - private $iap = null; + protected $iap = null; /** * [Output Only] The unique identifier for the resource. This identifier is defined by the server. * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * Specifies a preference for traffic sent from the proxy to the backend (or from the client to the backend for proxyless gRPC). The possible values are: - IPV4_ONLY: Only send IPv4 traffic to the backends of the backend service (Instance Group, Managed Instance Group, Network Endpoint Group), regardless of traffic from the client to the proxy. Only IPv4 health checks are used to check the health of the backends. This is the default setting. - PREFER_IPV6: Prioritize the connection to the endpoint's IPv6 address over its IPv4 address (provided there is a healthy IPv6 address). - IPV6_ONLY: Only send IPv6 traffic to the backends of the backend service (Instance Group, Managed Instance Group, Network Endpoint Group), regardless of traffic from the client to the proxy. Only IPv6 health checks are used to check the health of the backends. This field is applicable to either: - Advanced global external Application Load Balancer (load balancing scheme EXTERNAL_MANAGED), - Regional external Application Load Balancer, - Internal proxy Network Load Balancer (load balancing scheme INTERNAL_MANAGED), - Regional internal Application Load Balancer (load balancing scheme INTERNAL_MANAGED), - Traffic Director with Envoy proxies and proxyless gRPC (load balancing scheme INTERNAL_SELF_MANAGED). * Check the IpAddressSelectionPolicy enum for the list of possible values. * * Generated from protobuf field optional string ip_address_selection_policy = 77600840; */ - private $ip_address_selection_policy = null; + protected $ip_address_selection_policy = null; /** * [Output Only] Type of resource. Always compute#backendService for backend services. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * Specifies the load balancer type. A backend service created for one type of load balancer cannot be used with another. For more information, refer to Choosing a load balancer. * Check the LoadBalancingScheme enum for the list of possible values. * * Generated from protobuf field optional string load_balancing_scheme = 363890244; */ - private $load_balancing_scheme = null; + protected $load_balancing_scheme = null; /** * A list of locality load-balancing policies to be used in order of preference. When you use localityLbPolicies, you must set at least one value for either the localityLbPolicies[].policy or the localityLbPolicies[].customPolicy field. localityLbPolicies overrides any value set in the localityLbPolicy field. For an example of how to use this field, see Define a list of preferred policies. Caution: This field and its children are intended for use in a service mesh that includes gRPC clients only. Envoy proxies can't use backend services that have this configuration. * @@ -185,19 +185,19 @@ class BackendService extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string locality_lb_policy = 131431487; */ - private $locality_lb_policy = null; + protected $locality_lb_policy = null; /** * This field denotes the logging options for the load balancer traffic served by this backend service. If logging is enabled, logs will be exported to Stackdriver. * * Generated from protobuf field optional .google.cloud.compute.v1.BackendServiceLogConfig log_config = 351299741; */ - private $log_config = null; + protected $log_config = null; /** * Specifies the default maximum duration (timeout) for streams to this service. Duration is computed from the beginning of the stream until the response has been completely processed, including all retries. A stream that does not complete in this duration is closed. If not specified, there will be no timeout limit, i.e. the maximum duration is infinite. This value can be overridden in the PathMatcher configuration of the UrlMap that references this backend service. This field is only allowed when the loadBalancingScheme of the backend service is INTERNAL_SELF_MANAGED. * * Generated from protobuf field optional .google.cloud.compute.v1.Duration max_stream_duration = 61428376; */ - private $max_stream_duration = null; + protected $max_stream_duration = null; /** * Deployment metadata associated with the resource to be set by a GKE hub controller and read by the backend RCTH * @@ -209,68 +209,68 @@ class BackendService extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * The URL of the network to which this backend service belongs. This field must be set for Internal Passthrough Network Load Balancers when the haPolicy is enabled, and for External Passthrough Network Load Balancers when the haPolicy fastIpMove is enabled. This field can only be specified when the load balancing scheme is set to INTERNAL, or when the load balancing scheme is set to EXTERNAL and haPolicy fastIpMove is enabled. * * Generated from protobuf field optional string network = 232872494; */ - private $network = null; + protected $network = null; /** * Settings controlling the ejection of unhealthy backend endpoints from the load balancing pool of each individual proxy instance that processes the traffic for the given backend service. If not set, this feature is considered disabled. Results of the outlier detection algorithm (ejection of endpoints from the load balancing pool and returning them back to the pool) are executed independently by each proxy instance of the load balancer. In most cases, more than one proxy instance handles the traffic received by a backend service. Thus, it is possible that an unhealthy endpoint is detected and ejected by only some of the proxies, and while this happens, other proxies may continue to send requests to the same unhealthy endpoint until they detect and eject the unhealthy endpoint. Applicable backend endpoints can be: - VM instances in an Instance Group - Endpoints in a Zonal NEG (GCE_VM_IP, GCE_VM_IP_PORT) - Endpoints in a Hybrid Connectivity NEG (NON_GCP_PRIVATE_IP_PORT) - Serverless NEGs, that resolve to Cloud Run, App Engine, or Cloud Functions Services - Private Service Connect NEGs, that resolve to Google-managed regional API endpoints or managed services published using Private Service Connect Applicable backend service types can be: - A global backend service with the loadBalancingScheme set to INTERNAL_SELF_MANAGED or EXTERNAL_MANAGED. - A regional backend service with the serviceProtocol set to HTTP, HTTPS, HTTP2 or H2C, and loadBalancingScheme set to INTERNAL_MANAGED or EXTERNAL_MANAGED. Not supported for Serverless NEGs. Not supported when the backend service is referenced by a URL map that is bound to target gRPC proxy that has validateForProxyless field set to true. * * Generated from protobuf field optional .google.cloud.compute.v1.OutlierDetection outlier_detection = 354625086; */ - private $outlier_detection = null; + protected $outlier_detection = null; /** * Input only. [Input Only] Additional params passed with the request, but not persisted as part of resource payload. * * Generated from protobuf field optional .google.cloud.compute.v1.BackendServiceParams params = 78313862; */ - private $params = null; + protected $params = null; /** * Deprecated in favor of portName. The TCP port to connect on the backend. The default value is 80. For internal passthrough Network Load Balancers and external passthrough Network Load Balancers, omit port. * * Generated from protobuf field optional int32 port = 3446913; */ - private $port = null; + protected $port = null; /** * A named port on a backend instance group representing the port for communication to the backend VMs in that group. The named port must be [defined on each backend instance group](https://cloud.google.com/load-balancing/docs/backend-service#named_ports). This parameter has no meaning if the backends are NEGs. For internal passthrough Network Load Balancers and external passthrough Network Load Balancers, omit port_name. * * Generated from protobuf field optional string port_name = 41534345; */ - private $port_name = null; + protected $port_name = null; /** * The protocol this BackendService uses to communicate with backends. Possible values are HTTP, HTTPS, HTTP2, H2C, TCP, SSL, UDP or GRPC. depending on the chosen load balancer or Traffic Director configuration. Refer to the documentation for the load balancers or for Traffic Director for more information. Must be set to GRPC when the backend service is referenced by a URL map that is bound to target gRPC proxy. * Check the Protocol enum for the list of possible values. * * Generated from protobuf field optional string protocol = 84577944; */ - private $protocol = null; + protected $protocol = null; /** * [Output Only] URL of the region where the regional backend service resides. This field is not applicable to global backend services. You must specify this field as part of the HTTP request URL. It is not settable as a field in the request body. * * Generated from protobuf field optional string region = 138946292; */ - private $region = null; + protected $region = null; /** * [Output Only] The resource URL for the security policy associated with this backend service. * * Generated from protobuf field optional string security_policy = 171082513; */ - private $security_policy = null; + protected $security_policy = null; /** * This field specifies the security settings that apply to this backend service. This field is applicable to a global backend service with the load_balancing_scheme set to INTERNAL_SELF_MANAGED. * * Generated from protobuf field optional .google.cloud.compute.v1.SecuritySettings security_settings = 478649922; */ - private $security_settings = null; + protected $security_settings = null; /** * [Output Only] Server-defined URL for the resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * URLs of networkservices.ServiceBinding resources. Can only be set if load balancing scheme is INTERNAL_SELF_MANAGED. If set, lists of backends and health checks must be both empty. * @@ -282,38 +282,38 @@ class BackendService extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string service_lb_policy = 94848785; */ - private $service_lb_policy = null; + protected $service_lb_policy = null; /** * Type of session affinity to use. The default is NONE. Only NONE and HEADER_FIELD are supported when the backend service is referenced by a URL map that is bound to target gRPC proxy that has validateForProxyless field set to true. For more details, see: [Session Affinity](https://cloud.google.com/load-balancing/docs/backend-service#session_affinity). sessionAffinity cannot be specified with haPolicy. * Check the SessionAffinity enum for the list of possible values. * * Generated from protobuf field optional string session_affinity = 463888561; */ - private $session_affinity = null; + protected $session_affinity = null; /** * Describes the HTTP cookie used for stateful session affinity. This field is applicable and required if the sessionAffinity is set to STRONG_COOKIE_AFFINITY. * * Generated from protobuf field optional .google.cloud.compute.v1.BackendServiceHttpCookie strong_session_affinity_cookie = 238195722; */ - private $strong_session_affinity_cookie = null; + protected $strong_session_affinity_cookie = null; /** * subsetting cannot be specified with haPolicy. * * Generated from protobuf field optional .google.cloud.compute.v1.Subsetting subsetting = 450283536; */ - private $subsetting = null; + protected $subsetting = null; /** * The backend service timeout has a different meaning depending on the type of load balancer. For more information see, Backend service settings. The default is 30 seconds. The full range of timeout values allowed goes from 1 through 2,147,483,647 seconds. This value can be overridden in the PathMatcher configuration of the UrlMap that references this backend service. Not supported when the backend service is referenced by a URL map that is bound to target gRPC proxy that has validateForProxyless field set to true. Instead, use maxStreamDuration. * * Generated from protobuf field optional int32 timeout_sec = 79994995; */ - private $timeout_sec = null; + protected $timeout_sec = null; /** * Configuration for Backend Authenticated TLS and mTLS. May only be specified when the backend protocol is SSL, HTTPS or HTTP2. * * Generated from protobuf field optional .google.cloud.compute.v1.BackendServiceTlsSettings tls_settings = 81794791; */ - private $tls_settings = null; + protected $tls_settings = null; /** * [Output Only] List of resources referencing given backend service. * diff --git a/Compute/src/V1/BackendServiceAggregatedList.php b/Compute/src/V1/BackendServiceAggregatedList.php index 9a831ec2a5f0..c1e5e2d3254c 100644 --- a/Compute/src/V1/BackendServiceAggregatedList.php +++ b/Compute/src/V1/BackendServiceAggregatedList.php @@ -20,7 +20,7 @@ class BackendServiceAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of BackendServicesScopedList resources. * @@ -32,19 +32,19 @@ class BackendServiceAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Unreachable resources. * @@ -56,7 +56,7 @@ class BackendServiceAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/BackendServiceCdnPolicy.php b/Compute/src/V1/BackendServiceCdnPolicy.php index 905c75b63d35..54909f1d85ee 100644 --- a/Compute/src/V1/BackendServiceCdnPolicy.php +++ b/Compute/src/V1/BackendServiceCdnPolicy.php @@ -26,38 +26,38 @@ class BackendServiceCdnPolicy extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.CacheKeyPolicy cache_key_policy = 159263727; */ - private $cache_key_policy = null; + protected $cache_key_policy = null; /** * Specifies the cache setting for all responses from this backend. The possible values are: USE_ORIGIN_HEADERS Requires the origin to set valid caching headers to cache content. Responses without these headers will not be cached at Google's edge, and will require a full trip to the origin on every request, potentially impacting performance and increasing load on the origin server. FORCE_CACHE_ALL Cache all content, ignoring any "private", "no-store" or "no-cache" directives in Cache-Control response headers. Warning: this may result in Cloud CDN caching private, per-user (user identifiable) content. CACHE_ALL_STATIC Automatically cache static content, including common image formats, media (video and audio), and web assets (JavaScript and CSS). Requests and responses that are marked as uncacheable, as well as dynamic content (including HTML), will not be cached. If no value is provided for cdnPolicy.cacheMode, it defaults to CACHE_ALL_STATIC. * Check the CacheMode enum for the list of possible values. * * Generated from protobuf field optional string cache_mode = 28877888; */ - private $cache_mode = null; + protected $cache_mode = null; /** * Specifies a separate client (e.g. browser client) maximum TTL. This is used to clamp the max-age (or Expires) value sent to the client. With FORCE_CACHE_ALL, the lesser of client_ttl and default_ttl is used for the response max-age directive, along with a "public" directive. For cacheable content in CACHE_ALL_STATIC mode, client_ttl clamps the max-age from the origin (if specified), or else sets the response max-age directive to the lesser of the client_ttl and default_ttl, and also ensures a "public" cache-control directive is present. If a client TTL is not specified, a default value (1 hour) will be used. The maximum allowed value is 31,622,400s (1 year). * * Generated from protobuf field optional int32 client_ttl = 29034360; */ - private $client_ttl = null; + protected $client_ttl = null; /** * Specifies the default TTL for cached content served by this origin for responses that do not have an existing valid TTL (max-age or s-maxage). Setting a TTL of "0" means "always revalidate". The value of defaultTTL cannot be set to a value greater than that of maxTTL, but can be equal. When the cacheMode is set to FORCE_CACHE_ALL, the defaultTTL will overwrite the TTL set in all responses. The maximum allowed value is 31,622,400s (1 year), noting that infrequently accessed objects may be evicted from the cache before the defined TTL. * * Generated from protobuf field optional int32 default_ttl = 100253422; */ - private $default_ttl = null; + protected $default_ttl = null; /** * Specifies the maximum allowed TTL for cached content served by this origin. Cache directives that attempt to set a max-age or s-maxage higher than this, or an Expires header more than maxTTL seconds in the future will be capped at the value of maxTTL, as if it were the value of an s-maxage Cache-Control directive. Headers sent to the client will not be modified. Setting a TTL of "0" means "always revalidate". The maximum allowed value is 31,622,400s (1 year), noting that infrequently accessed objects may be evicted from the cache before the defined TTL. * * Generated from protobuf field optional int32 max_ttl = 307578001; */ - private $max_ttl = null; + protected $max_ttl = null; /** * Negative caching allows per-status code TTLs to be set, in order to apply fine-grained caching for common errors or redirects. This can reduce the load on your origin and improve end-user experience by reducing response latency. When the cache mode is set to CACHE_ALL_STATIC or USE_ORIGIN_HEADERS, negative caching applies to responses with the specified response code that lack any Cache-Control, Expires, or Pragma: no-cache directives. When the cache mode is set to FORCE_CACHE_ALL, negative caching applies to all responses with the specified response code, and override any caching headers. By default, Cloud CDN will apply the following default TTLs to these status codes: HTTP 300 (Multiple Choice), 301, 308 (Permanent Redirects): 10m HTTP 404 (Not Found), 410 (Gone), 451 (Unavailable For Legal Reasons): 120s HTTP 405 (Method Not Found), 421 (Misdirected Request), 501 (Not Implemented): 60s. These defaults can be overridden in negative_caching_policy. * * Generated from protobuf field optional bool negative_caching = 336110005; */ - private $negative_caching = null; + protected $negative_caching = null; /** * Sets a cache TTL for the specified HTTP status code. negative_caching must be enabled to configure negative_caching_policy. Omitting the policy and leaving negative_caching enabled will use Cloud CDN's default cache TTLs. Note that when specifying an explicit negative_caching_policy, you should take care to specify a cache TTL for all response codes that you wish to cache. Cloud CDN will not apply any default negative caching when a policy exists. * @@ -69,19 +69,19 @@ class BackendServiceCdnPolicy extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional bool request_coalescing = 532808276; */ - private $request_coalescing = null; + protected $request_coalescing = null; /** * Serve existing content from the cache (if available) when revalidating content with the origin, or when an error is encountered when refreshing the cache. This setting defines the default "max-stale" duration for any cached responses that do not specify a max-stale directive. Stale responses that exceed the TTL configured here will not be served. The default limit (max-stale) is 86400s (1 day), which will allow stale content to be served up to this limit beyond the max-age (or s-maxage) of a cached response. The maximum allowed value is 604800 (1 week). Set this to zero (0) to disable serve-while-stale. * * Generated from protobuf field optional int32 serve_while_stale = 236682203; */ - private $serve_while_stale = null; + protected $serve_while_stale = null; /** * Maximum number of seconds the response to a signed URL request will be considered fresh. After this time period, the response will be revalidated before being served. Defaults to 1hr (3600s). When serving responses to signed URL requests, Cloud CDN will internally behave as though all responses from this backend had a "Cache-Control: public, max-age=[TTL]" header, regardless of any existing Cache-Control header. The actual headers served in responses will not be altered. * * Generated from protobuf field optional int64 signed_url_cache_max_age_sec = 269374534; */ - private $signed_url_cache_max_age_sec = null; + protected $signed_url_cache_max_age_sec = null; /** * [Output Only] Names of the keys for signing request URLs. * diff --git a/Compute/src/V1/BackendServiceCdnPolicyBypassCacheOnRequestHeader.php b/Compute/src/V1/BackendServiceCdnPolicyBypassCacheOnRequestHeader.php index d1f82695e5f4..c47444b2c2b3 100644 --- a/Compute/src/V1/BackendServiceCdnPolicyBypassCacheOnRequestHeader.php +++ b/Compute/src/V1/BackendServiceCdnPolicyBypassCacheOnRequestHeader.php @@ -20,7 +20,7 @@ class BackendServiceCdnPolicyBypassCacheOnRequestHeader extends \Google\Protobuf * * Generated from protobuf field optional string header_name = 110223613; */ - private $header_name = null; + protected $header_name = null; /** * Constructor. diff --git a/Compute/src/V1/BackendServiceCdnPolicyNegativeCachingPolicy.php b/Compute/src/V1/BackendServiceCdnPolicyNegativeCachingPolicy.php index 1002a3dd162d..9a336afe5a4e 100644 --- a/Compute/src/V1/BackendServiceCdnPolicyNegativeCachingPolicy.php +++ b/Compute/src/V1/BackendServiceCdnPolicyNegativeCachingPolicy.php @@ -20,13 +20,13 @@ class BackendServiceCdnPolicyNegativeCachingPolicy extends \Google\Protobuf\Inte * * Generated from protobuf field optional int32 code = 3059181; */ - private $code = null; + protected $code = null; /** * The TTL (in seconds) for which to cache responses with the corresponding status code. The maximum allowed value is 1800s (30 minutes), noting that infrequently accessed objects may be evicted from the cache before the defined TTL. * * Generated from protobuf field optional int32 ttl = 115180; */ - private $ttl = null; + protected $ttl = null; /** * Constructor. diff --git a/Compute/src/V1/BackendServiceConnectionTrackingPolicy.php b/Compute/src/V1/BackendServiceConnectionTrackingPolicy.php index af7c0c1538dc..2512102d7135 100644 --- a/Compute/src/V1/BackendServiceConnectionTrackingPolicy.php +++ b/Compute/src/V1/BackendServiceConnectionTrackingPolicy.php @@ -21,26 +21,26 @@ class BackendServiceConnectionTrackingPolicy extends \Google\Protobuf\Internal\M * * Generated from protobuf field optional string connection_persistence_on_unhealthy_backends = 152439033; */ - private $connection_persistence_on_unhealthy_backends = null; + protected $connection_persistence_on_unhealthy_backends = null; /** * Enable Strong Session Affinity for external passthrough Network Load Balancers. This option is not available publicly. * * Generated from protobuf field optional bool enable_strong_affinity = 24539924; */ - private $enable_strong_affinity = null; + protected $enable_strong_affinity = null; /** * Specifies how long to keep a Connection Tracking entry while there is no matching traffic (in seconds). For internal passthrough Network Load Balancers: - The minimum (default) is 10 minutes and the maximum is 16 hours. - It can be set only if Connection Tracking is less than 5-tuple (i.e. Session Affinity is CLIENT_IP_NO_DESTINATION, CLIENT_IP or CLIENT_IP_PROTO, and Tracking Mode is PER_SESSION). For external passthrough Network Load Balancers the default is 60 seconds. This option is not available publicly. * * Generated from protobuf field optional int32 idle_timeout_sec = 24977544; */ - private $idle_timeout_sec = null; + protected $idle_timeout_sec = null; /** * Specifies the key used for connection tracking. There are two options: - PER_CONNECTION: This is the default mode. The Connection Tracking is performed as per the Connection Key (default Hash Method) for the specific protocol. - PER_SESSION: The Connection Tracking is performed as per the configured Session Affinity. It matches the configured Session Affinity. For more details, see [Tracking Mode for Network Load Balancing](https://cloud.google.com/load-balancing/docs/network/networklb-backend-service#tracking-mode) and [Tracking Mode for Internal TCP/UDP Load Balancing](https://cloud.google.com/load-balancing/docs/internal#tracking-mode). * Check the TrackingMode enum for the list of possible values. * * Generated from protobuf field optional string tracking_mode = 127757867; */ - private $tracking_mode = null; + protected $tracking_mode = null; /** * Constructor. diff --git a/Compute/src/V1/BackendServiceCustomMetric.php b/Compute/src/V1/BackendServiceCustomMetric.php index b48893262a60..992623c94e20 100644 --- a/Compute/src/V1/BackendServiceCustomMetric.php +++ b/Compute/src/V1/BackendServiceCustomMetric.php @@ -20,13 +20,13 @@ class BackendServiceCustomMetric extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional bool dry_run = 323854839; */ - private $dry_run = null; + protected $dry_run = null; /** * Name of a custom utilization signal. The name must be 1-64 characters long and match the regular expression [a-z]([-_.a-z0-9]*[a-z0-9])? which means that the first character must be a lowercase letter, and all following characters must be a dash, period, underscore, lowercase letter, or digit, except the last character, which cannot be a dash, period, or underscore. For usage guidelines, see Custom Metrics balancing mode. This field can only be used for a global or regional backend service with the loadBalancingScheme set to EXTERNAL_MANAGED, INTERNAL_MANAGED INTERNAL_SELF_MANAGED. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * Constructor. diff --git a/Compute/src/V1/BackendServiceFailoverPolicy.php b/Compute/src/V1/BackendServiceFailoverPolicy.php index 941218bcac35..eedf9d113150 100644 --- a/Compute/src/V1/BackendServiceFailoverPolicy.php +++ b/Compute/src/V1/BackendServiceFailoverPolicy.php @@ -20,19 +20,19 @@ class BackendServiceFailoverPolicy extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional bool disable_connection_drain_on_failover = 182150753; */ - private $disable_connection_drain_on_failover = null; + protected $disable_connection_drain_on_failover = null; /** * If set to true, connections to the load balancer are dropped when all primary and all backup backend VMs are unhealthy.If set to false, connections are distributed among all primary VMs when all primary and all backup backend VMs are unhealthy. For load balancers that have configurable failover: [Internal passthrough Network Load Balancers](https://cloud.google.com/load-balancing/docs/internal/failover-overview) and [external passthrough Network Load Balancers](https://cloud.google.com/load-balancing/docs/network/networklb-failover-overview). The default is false. * * Generated from protobuf field optional bool drop_traffic_if_unhealthy = 112289428; */ - private $drop_traffic_if_unhealthy = null; + protected $drop_traffic_if_unhealthy = null; /** * The value of the field must be in the range [0, 1]. If the value is 0, the load balancer performs a failover when the number of healthy primary VMs equals zero. For all other values, the load balancer performs a failover when the total number of healthy primary VMs is less than this ratio. For load balancers that have configurable failover: [Internal TCP/UDP Load Balancing](https://cloud.google.com/load-balancing/docs/internal/failover-overview) and [external TCP/UDP Load Balancing](https://cloud.google.com/load-balancing/docs/network/networklb-failover-overview). * * Generated from protobuf field optional float failover_ratio = 212667006; */ - private $failover_ratio = null; + protected $failover_ratio = null; /** * Constructor. diff --git a/Compute/src/V1/BackendServiceGroupHealth.php b/Compute/src/V1/BackendServiceGroupHealth.php index 5df8fe05d5e0..55d0c4c92fd4 100644 --- a/Compute/src/V1/BackendServiceGroupHealth.php +++ b/Compute/src/V1/BackendServiceGroupHealth.php @@ -31,7 +31,7 @@ class BackendServiceGroupHealth extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * Constructor. diff --git a/Compute/src/V1/BackendServiceHAPolicy.php b/Compute/src/V1/BackendServiceHAPolicy.php index 3c6506c7eff0..50c876e06277 100644 --- a/Compute/src/V1/BackendServiceHAPolicy.php +++ b/Compute/src/V1/BackendServiceHAPolicy.php @@ -20,13 +20,13 @@ class BackendServiceHAPolicy extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string fast_i_p_move = 222633817; */ - private $fast_i_p_move = null; + protected $fast_i_p_move = null; /** * Selects one of the network endpoints attached to the backend NEGs of this service as the active endpoint (the leader) that receives all traffic. When the leader changes, there is no connection draining to persist existing connections on the old leader. You are responsible for selecting a suitable endpoint as the leader. For example, preferring a healthy endpoint over unhealthy ones. Note that this service does not track backend endpoint health, and selects the configured leader unconditionally. * * Generated from protobuf field optional .google.cloud.compute.v1.BackendServiceHAPolicyLeader leader = 503858441; */ - private $leader = null; + protected $leader = null; /** * Constructor. diff --git a/Compute/src/V1/BackendServiceHAPolicyLeader.php b/Compute/src/V1/BackendServiceHAPolicyLeader.php index 9ce777468e71..4518557019d6 100644 --- a/Compute/src/V1/BackendServiceHAPolicyLeader.php +++ b/Compute/src/V1/BackendServiceHAPolicyLeader.php @@ -19,13 +19,13 @@ class BackendServiceHAPolicyLeader extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string backend_group = 457777428; */ - private $backend_group = null; + protected $backend_group = null; /** * The network endpoint within the leader.backendGroup that is designated as the leader. This network endpoint cannot be detached from the NEG specified in the haPolicy.leader.backendGroup until the leader is updated with another network endpoint, or the leader is removed from the haPolicy. * * Generated from protobuf field optional .google.cloud.compute.v1.BackendServiceHAPolicyLeaderNetworkEndpoint network_endpoint = 56789126; */ - private $network_endpoint = null; + protected $network_endpoint = null; /** * Constructor. diff --git a/Compute/src/V1/BackendServiceHAPolicyLeaderNetworkEndpoint.php b/Compute/src/V1/BackendServiceHAPolicyLeaderNetworkEndpoint.php index 43eca27fc370..0044bcf2f691 100644 --- a/Compute/src/V1/BackendServiceHAPolicyLeaderNetworkEndpoint.php +++ b/Compute/src/V1/BackendServiceHAPolicyLeaderNetworkEndpoint.php @@ -19,7 +19,7 @@ class BackendServiceHAPolicyLeaderNetworkEndpoint extends \Google\Protobuf\Inter * * Generated from protobuf field optional string instance = 18257045; */ - private $instance = null; + protected $instance = null; /** * Constructor. diff --git a/Compute/src/V1/BackendServiceHttpCookie.php b/Compute/src/V1/BackendServiceHttpCookie.php index 4c0e16aa7425..d877f8b5f73e 100644 --- a/Compute/src/V1/BackendServiceHttpCookie.php +++ b/Compute/src/V1/BackendServiceHttpCookie.php @@ -20,19 +20,19 @@ class BackendServiceHttpCookie extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * Path to set for the cookie. * * Generated from protobuf field optional string path = 3433509; */ - private $path = null; + protected $path = null; /** * Lifetime of the cookie. * * Generated from protobuf field optional .google.cloud.compute.v1.Duration ttl = 115180; */ - private $ttl = null; + protected $ttl = null; /** * Constructor. diff --git a/Compute/src/V1/BackendServiceIAP.php b/Compute/src/V1/BackendServiceIAP.php index ee6d8a660108..025a9a5ac8d5 100644 --- a/Compute/src/V1/BackendServiceIAP.php +++ b/Compute/src/V1/BackendServiceIAP.php @@ -20,25 +20,25 @@ class BackendServiceIAP extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional bool enabled = 1018689; */ - private $enabled = null; + protected $enabled = null; /** * OAuth2 client ID to use for the authentication flow. * * Generated from protobuf field optional string oauth2_client_id = 314017611; */ - private $oauth2_client_id = null; + protected $oauth2_client_id = null; /** * OAuth2 client secret to use for the authentication flow. For security reasons, this value cannot be retrieved via the API. Instead, the SHA-256 hash of the value is returned in the oauth2ClientSecretSha256 field. @InputOnly * * Generated from protobuf field optional string oauth2_client_secret = 50999520; */ - private $oauth2_client_secret = null; + protected $oauth2_client_secret = null; /** * [Output Only] SHA256 hash value for the field oauth2_client_secret above. * * Generated from protobuf field optional string oauth2_client_secret_sha256 = 112903782; */ - private $oauth2_client_secret_sha256 = null; + protected $oauth2_client_secret_sha256 = null; /** * Constructor. diff --git a/Compute/src/V1/BackendServiceList.php b/Compute/src/V1/BackendServiceList.php index 56a1f6a844d9..3cda4ee81652 100644 --- a/Compute/src/V1/BackendServiceList.php +++ b/Compute/src/V1/BackendServiceList.php @@ -20,7 +20,7 @@ class BackendServiceList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of BackendService resources. * @@ -32,25 +32,25 @@ class BackendServiceList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/BackendServiceListUsable.php b/Compute/src/V1/BackendServiceListUsable.php index f37ac1ddc5ce..3cc7c05f4e11 100644 --- a/Compute/src/V1/BackendServiceListUsable.php +++ b/Compute/src/V1/BackendServiceListUsable.php @@ -20,7 +20,7 @@ class BackendServiceListUsable extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of BackendService resources. * @@ -32,25 +32,25 @@ class BackendServiceListUsable extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/BackendServiceLocalityLoadBalancingPolicyConfig.php b/Compute/src/V1/BackendServiceLocalityLoadBalancingPolicyConfig.php index bc69947af445..bbf1f1c9ebe0 100644 --- a/Compute/src/V1/BackendServiceLocalityLoadBalancingPolicyConfig.php +++ b/Compute/src/V1/BackendServiceLocalityLoadBalancingPolicyConfig.php @@ -18,11 +18,11 @@ class BackendServiceLocalityLoadBalancingPolicyConfig extends \Google\Protobuf\I /** * Generated from protobuf field optional .google.cloud.compute.v1.BackendServiceLocalityLoadBalancingPolicyConfigCustomPolicy custom_policy = 4818368; */ - private $custom_policy = null; + protected $custom_policy = null; /** * Generated from protobuf field optional .google.cloud.compute.v1.BackendServiceLocalityLoadBalancingPolicyConfigPolicy policy = 91071794; */ - private $policy = null; + protected $policy = null; /** * Constructor. diff --git a/Compute/src/V1/BackendServiceLocalityLoadBalancingPolicyConfigCustomPolicy.php b/Compute/src/V1/BackendServiceLocalityLoadBalancingPolicyConfigCustomPolicy.php index b7f24a428a27..d3e4339a3dde 100644 --- a/Compute/src/V1/BackendServiceLocalityLoadBalancingPolicyConfigCustomPolicy.php +++ b/Compute/src/V1/BackendServiceLocalityLoadBalancingPolicyConfigCustomPolicy.php @@ -20,13 +20,13 @@ class BackendServiceLocalityLoadBalancingPolicyConfigCustomPolicy extends \Googl * * Generated from protobuf field optional string data = 3076010; */ - private $data = null; + protected $data = null; /** * Identifies the custom policy. The value should match the name of a custom implementation registered on the gRPC clients. It should follow protocol buffer message naming conventions and include the full path (for example, myorg.CustomLbPolicy). The maximum length is 256 characters. Do not specify the same custom policy more than once for a backend. If you do, the configuration is rejected. For an example of how to use this field, see Use a custom policy. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * Constructor. diff --git a/Compute/src/V1/BackendServiceLocalityLoadBalancingPolicyConfigPolicy.php b/Compute/src/V1/BackendServiceLocalityLoadBalancingPolicyConfigPolicy.php index 6ee4d5ac35bf..11d2d4197429 100644 --- a/Compute/src/V1/BackendServiceLocalityLoadBalancingPolicyConfigPolicy.php +++ b/Compute/src/V1/BackendServiceLocalityLoadBalancingPolicyConfigPolicy.php @@ -21,7 +21,7 @@ class BackendServiceLocalityLoadBalancingPolicyConfigPolicy extends \Google\Prot * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * Constructor. diff --git a/Compute/src/V1/BackendServiceLogConfig.php b/Compute/src/V1/BackendServiceLogConfig.php index aba14cd11309..fd676ea5fa12 100644 --- a/Compute/src/V1/BackendServiceLogConfig.php +++ b/Compute/src/V1/BackendServiceLogConfig.php @@ -20,7 +20,7 @@ class BackendServiceLogConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional bool enable = 311764355; */ - private $enable = null; + protected $enable = null; /** * This field can only be specified if logging is enabled for this backend service and "logConfig.optionalMode" was set to CUSTOM. Contains a list of optional fields you want to include in the logs. For example: serverInstance, serverGkeDetails.cluster, serverGkeDetails.pod.podNamespace * @@ -33,13 +33,13 @@ class BackendServiceLogConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string optional_mode = 128697122; */ - private $optional_mode = null; + protected $optional_mode = null; /** * This field can only be specified if logging is enabled for this backend service. The value of the field must be in [0, 1]. This configures the sampling rate of requests to the load balancer where 1.0 means all logged requests are reported and 0.0 means no logged requests are reported. The default value is 1.0. * * Generated from protobuf field optional float sample_rate = 153193045; */ - private $sample_rate = null; + protected $sample_rate = null; /** * Constructor. diff --git a/Compute/src/V1/BackendServiceReference.php b/Compute/src/V1/BackendServiceReference.php index 53c4ecb8b951..26fe43a2a0a1 100644 --- a/Compute/src/V1/BackendServiceReference.php +++ b/Compute/src/V1/BackendServiceReference.php @@ -17,7 +17,7 @@ class BackendServiceReference extends \Google\Protobuf\Internal\Message /** * Generated from protobuf field optional string backend_service = 306946058; */ - private $backend_service = null; + protected $backend_service = null; /** * Constructor. diff --git a/Compute/src/V1/BackendServiceTlsSettings.php b/Compute/src/V1/BackendServiceTlsSettings.php index 91eb9c26c6b7..00ddb7919943 100644 --- a/Compute/src/V1/BackendServiceTlsSettings.php +++ b/Compute/src/V1/BackendServiceTlsSettings.php @@ -19,13 +19,13 @@ class BackendServiceTlsSettings extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string authentication_config = 408053481; */ - private $authentication_config = null; + protected $authentication_config = null; /** * Server Name Indication - see RFC3546 section 3.1. If set, the load balancer sends this string as the SNI hostname in the TLS connection to the backend, and requires that this string match a Subject Alternative Name (SAN) in the backend's server certificate. With a Regional Internet NEG backend, if the SNI is specified here, the load balancer uses it regardless of whether the Regional Internet NEG is specified with FQDN or IP address and port. When both sni and subjectAltNames[] are specified, the load balancer matches the backend certificate's SAN only to subjectAltNames[]. * * Generated from protobuf field optional string sni = 114030; */ - private $sni = null; + protected $sni = null; /** * A list of Subject Alternative Names (SANs) that the Load Balancer verifies during a TLS handshake with the backend. When the server presents its X.509 certificate to the Load Balancer, the Load Balancer inspects the certificate's SAN field, and requires that at least one SAN match one of the subjectAltNames in the list. This field is limited to 5 entries. When both sni and subjectAltNames[] are specified, the load balancer matches the backend certificate's SAN only to subjectAltNames[]. * diff --git a/Compute/src/V1/BackendServiceTlsSettingsSubjectAltName.php b/Compute/src/V1/BackendServiceTlsSettingsSubjectAltName.php index a76c5ddf407b..80672e723045 100644 --- a/Compute/src/V1/BackendServiceTlsSettingsSubjectAltName.php +++ b/Compute/src/V1/BackendServiceTlsSettingsSubjectAltName.php @@ -20,13 +20,13 @@ class BackendServiceTlsSettingsSubjectAltName extends \Google\Protobuf\Internal\ * * Generated from protobuf field optional string dns_name = 411992033; */ - private $dns_name = null; + protected $dns_name = null; /** * The SAN specified as a URI. * * Generated from protobuf field optional string uniform_resource_identifier = 491409007; */ - private $uniform_resource_identifier = null; + protected $uniform_resource_identifier = null; /** * Constructor. diff --git a/Compute/src/V1/BackendServiceUsedBy.php b/Compute/src/V1/BackendServiceUsedBy.php index 9e8742663910..7531442bd4fb 100644 --- a/Compute/src/V1/BackendServiceUsedBy.php +++ b/Compute/src/V1/BackendServiceUsedBy.php @@ -19,7 +19,7 @@ class BackendServiceUsedBy extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string reference = 148586315; */ - private $reference = null; + protected $reference = null; /** * Constructor. diff --git a/Compute/src/V1/BackendServicesClient.php b/Compute/src/V1/BackendServicesClient.php deleted file mode 100644 index d6afcad81b5b..000000000000 --- a/Compute/src/V1/BackendServicesClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/BfdPacket.php b/Compute/src/V1/BfdPacket.php index 5d309bf7cbd9..62fc9a675e98 100644 --- a/Compute/src/V1/BfdPacket.php +++ b/Compute/src/V1/BfdPacket.php @@ -19,99 +19,99 @@ class BfdPacket extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional bool authentication_present = 105974260; */ - private $authentication_present = null; + protected $authentication_present = null; /** * The Control Plane Independent bit of the BFD packet. This is specified in section 4.1 of RFC5880 * * Generated from protobuf field optional bool control_plane_independent = 62363573; */ - private $control_plane_independent = null; + protected $control_plane_independent = null; /** * The demand bit of the BFD packet. This is specified in section 4.1 of RFC5880 * * Generated from protobuf field optional bool demand = 275180107; */ - private $demand = null; + protected $demand = null; /** * The diagnostic code specifies the local system's reason for the last change in session state. This allows remote systems to determine the reason that the previous session failed, for example. These diagnostic codes are specified in section 4.1 of RFC5880 * Check the Diagnostic enum for the list of possible values. * * Generated from protobuf field optional string diagnostic = 62708647; */ - private $diagnostic = null; + protected $diagnostic = null; /** * The Final bit of the BFD packet. This is specified in section 4.1 of RFC5880 * * Generated from protobuf field optional bool final = 97436022; */ - private $final = null; + protected $final = null; /** * The length of the BFD Control packet in bytes. This is specified in section 4.1 of RFC5880 * * Generated from protobuf field optional uint32 length = 504249062; */ - private $length = null; + protected $length = null; /** * The Required Min Echo RX Interval value in the BFD packet. This is specified in section 4.1 of RFC5880 * * Generated from protobuf field optional uint32 min_echo_rx_interval_ms = 97286868; */ - private $min_echo_rx_interval_ms = null; + protected $min_echo_rx_interval_ms = null; /** * The Required Min RX Interval value in the BFD packet. This is specified in section 4.1 of RFC5880 * * Generated from protobuf field optional uint32 min_rx_interval_ms = 463399028; */ - private $min_rx_interval_ms = null; + protected $min_rx_interval_ms = null; /** * The Desired Min TX Interval value in the BFD packet. This is specified in section 4.1 of RFC5880 * * Generated from protobuf field optional uint32 min_tx_interval_ms = 526023602; */ - private $min_tx_interval_ms = null; + protected $min_tx_interval_ms = null; /** * The detection time multiplier of the BFD packet. This is specified in section 4.1 of RFC5880 * * Generated from protobuf field optional uint32 multiplier = 191331777; */ - private $multiplier = null; + protected $multiplier = null; /** * The multipoint bit of the BFD packet. This is specified in section 4.1 of RFC5880 * * Generated from protobuf field optional bool multipoint = 191421431; */ - private $multipoint = null; + protected $multipoint = null; /** * The My Discriminator value in the BFD packet. This is specified in section 4.1 of RFC5880 * * Generated from protobuf field optional uint32 my_discriminator = 76663113; */ - private $my_discriminator = null; + protected $my_discriminator = null; /** * The Poll bit of the BFD packet. This is specified in section 4.1 of RFC5880 * * Generated from protobuf field optional bool poll = 3446719; */ - private $poll = null; + protected $poll = null; /** * The current BFD session state as seen by the transmitting system. These states are specified in section 4.1 of RFC5880 * Check the State enum for the list of possible values. * * Generated from protobuf field optional string state = 109757585; */ - private $state = null; + protected $state = null; /** * The version number of the BFD protocol, as specified in section 4.1 of RFC5880. * * Generated from protobuf field optional uint32 version = 351608024; */ - private $version = null; + protected $version = null; /** * The Your Discriminator value in the BFD packet. This is specified in section 4.1 of RFC5880 * * Generated from protobuf field optional uint32 your_discriminator = 515634064; */ - private $your_discriminator = null; + protected $your_discriminator = null; /** * Constructor. diff --git a/Compute/src/V1/BfdStatus.php b/Compute/src/V1/BfdStatus.php index 22d6b7a50c6e..654b40e895fd 100644 --- a/Compute/src/V1/BfdStatus.php +++ b/Compute/src/V1/BfdStatus.php @@ -21,19 +21,19 @@ class BfdStatus extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string bfd_session_initialization_mode = 218156954; */ - private $bfd_session_initialization_mode = null; + protected $bfd_session_initialization_mode = null; /** * Unix timestamp of the most recent config update. * * Generated from protobuf field optional int64 config_update_timestamp_micros = 457195569; */ - private $config_update_timestamp_micros = null; + protected $config_update_timestamp_micros = null; /** * Control packet counts for the current BFD session. * * Generated from protobuf field optional .google.cloud.compute.v1.BfdStatusPacketCounts control_packet_counts = 132573561; */ - private $control_packet_counts = null; + protected $control_packet_counts = null; /** * Inter-packet time interval statistics for control packets. * @@ -46,38 +46,38 @@ class BfdStatus extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string local_diagnostic = 463737083; */ - private $local_diagnostic = null; + protected $local_diagnostic = null; /** * The current BFD session state as seen by the transmitting system. These states are specified in section 4.1 of RFC5880 * Check the LocalState enum for the list of possible values. * * Generated from protobuf field optional string local_state = 149195453; */ - private $local_state = null; + protected $local_state = null; /** * Negotiated transmit interval for control packets. * * Generated from protobuf field optional uint32 negotiated_local_control_tx_interval_ms = 21768340; */ - private $negotiated_local_control_tx_interval_ms = null; + protected $negotiated_local_control_tx_interval_ms = null; /** * The most recent Rx control packet for this BFD session. * * Generated from protobuf field optional .google.cloud.compute.v1.BfdPacket rx_packet = 505069729; */ - private $rx_packet = null; + protected $rx_packet = null; /** * The most recent Tx control packet for this BFD session. * * Generated from protobuf field optional .google.cloud.compute.v1.BfdPacket tx_packet = 111386275; */ - private $tx_packet = null; + protected $tx_packet = null; /** * Session uptime in milliseconds. Value will be 0 if session is not up. * * Generated from protobuf field optional int64 uptime_ms = 125398365; */ - private $uptime_ms = null; + protected $uptime_ms = null; /** * Constructor. diff --git a/Compute/src/V1/BfdStatusPacketCounts.php b/Compute/src/V1/BfdStatusPacketCounts.php index 4965dead8b40..ac61018e6224 100644 --- a/Compute/src/V1/BfdStatusPacketCounts.php +++ b/Compute/src/V1/BfdStatusPacketCounts.php @@ -19,25 +19,25 @@ class BfdStatusPacketCounts extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional uint32 num_rx = 39375263; */ - private $num_rx = null; + protected $num_rx = null; /** * Number of packets received that were rejected because of errors since the beginning of the current BFD session. * * Generated from protobuf field optional uint32 num_rx_rejected = 281007902; */ - private $num_rx_rejected = null; + protected $num_rx_rejected = null; /** * Number of packets received that were successfully processed since the beginning of the current BFD session. * * Generated from protobuf field optional uint32 num_rx_successful = 455361850; */ - private $num_rx_successful = null; + protected $num_rx_successful = null; /** * Number of packets transmitted since the beginning of the current BFD session. * * Generated from protobuf field optional uint32 num_tx = 39375325; */ - private $num_tx = null; + protected $num_tx = null; /** * Constructor. diff --git a/Compute/src/V1/BgpRoute.php b/Compute/src/V1/BgpRoute.php index 37103f9cc084..05486bcaaa24 100644 --- a/Compute/src/V1/BgpRoute.php +++ b/Compute/src/V1/BgpRoute.php @@ -31,20 +31,20 @@ class BgpRoute extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.BgpRouteNetworkLayerReachabilityInformation destination = 180765710; */ - private $destination = null; + protected $destination = null; /** * [Output only] BGP multi-exit discriminator * * Generated from protobuf field optional uint32 med = 107980; */ - private $med = null; + protected $med = null; /** * [Output only] BGP origin (EGP, IGP or INCOMPLETE) * Check the Origin enum for the list of possible values. * * Generated from protobuf field optional string origin = 65122086; */ - private $origin = null; + protected $origin = null; /** * Constructor. diff --git a/Compute/src/V1/BgpRouteAsPath.php b/Compute/src/V1/BgpRouteAsPath.php index b619274aa09f..75f1b13c9d3d 100644 --- a/Compute/src/V1/BgpRouteAsPath.php +++ b/Compute/src/V1/BgpRouteAsPath.php @@ -26,7 +26,7 @@ class BgpRouteAsPath extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string type = 3575610; */ - private $type = null; + protected $type = null; /** * Constructor. diff --git a/Compute/src/V1/BgpRouteNetworkLayerReachabilityInformation.php b/Compute/src/V1/BgpRouteNetworkLayerReachabilityInformation.php index 5cf548d88f84..61678edd5d66 100644 --- a/Compute/src/V1/BgpRouteNetworkLayerReachabilityInformation.php +++ b/Compute/src/V1/BgpRouteNetworkLayerReachabilityInformation.php @@ -20,13 +20,13 @@ class BgpRouteNetworkLayerReachabilityInformation extends \Google\Protobuf\Inter * * Generated from protobuf field optional uint32 path_id = 282287989; */ - private $path_id = null; + protected $path_id = null; /** * Human readable CIDR notation for a prefix. E.g. 10.42.0.0/16. * * Generated from protobuf field optional string prefix = 93631122; */ - private $prefix = null; + protected $prefix = null; /** * Constructor. diff --git a/Compute/src/V1/Binding.php b/Compute/src/V1/Binding.php index 68f00cb29b8b..274655beadf9 100644 --- a/Compute/src/V1/Binding.php +++ b/Compute/src/V1/Binding.php @@ -18,13 +18,13 @@ class Binding extends \Google\Protobuf\Internal\Message /** * Generated from protobuf field optional string binding_id = 441088277; */ - private $binding_id = null; + protected $binding_id = null; /** * The condition that is associated with this binding. If the condition evaluates to `true`, then this binding applies to the current request. If the condition evaluates to `false`, then this binding does not apply to the current request. However, a different role binding might grant the same role to one or more of the principals in this binding. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies). * * Generated from protobuf field optional .google.cloud.compute.v1.Expr condition = 212430107; */ - private $condition = null; + protected $condition = null; /** * Specifies the principals requesting access for a Google Cloud resource. `members` can have the following values: * `allUsers`: A special identifier that represents anyone who is on the internet; with or without a Google account. * `allAuthenticatedUsers`: A special identifier that represents anyone who is authenticated with a Google account or a service account. Does not include identities that come from external identity providers (IdPs) through identity federation. * `user:{emailid}`: An email address that represents a specific Google account. For example, `alice@example.com` . * `serviceAccount:{emailid}`: An email address that represents a Google service account. For example, `my-other-app@appspot.gserviceaccount.com`. * `serviceAccount:{projectid}.svc.id.goog[{namespace}/{kubernetes-sa}]`: An identifier for a [Kubernetes service account](https://cloud.google.com/kubernetes-engine/docs/how-to/kubernetes-service-accounts). For example, `my-project.svc.id.goog[my-namespace/my-kubernetes-sa]`. * `group:{emailid}`: An email address that represents a Google group. For example, `admins@example.com`. * `domain:{domain}`: The G Suite domain (primary) that represents all the users of that domain. For example, `google.com` or `example.com`. * `principal://iam.googleapis.com/locations/global/workforcePools/{pool_id}/subject/{subject_attribute_value}`: A single identity in a workforce identity pool. * `principalSet://iam.googleapis.com/locations/global/workforcePools/{pool_id}/group/{group_id}`: All workforce identities in a group. * `principalSet://iam.googleapis.com/locations/global/workforcePools/{pool_id}/attribute.{attribute_name}/{attribute_value}`: All workforce identities with a specific attribute value. * `principalSet://iam.googleapis.com/locations/global/workforcePools/{pool_id}/*`: All identities in a workforce identity pool. * `principal://iam.googleapis.com/projects/{project_number}/locations/global/workloadIdentityPools/{pool_id}/subject/{subject_attribute_value}`: A single identity in a workload identity pool. * `principalSet://iam.googleapis.com/projects/{project_number}/locations/global/workloadIdentityPools/{pool_id}/group/{group_id}`: A workload identity pool group. * `principalSet://iam.googleapis.com/projects/{project_number}/locations/global/workloadIdentityPools/{pool_id}/attribute.{attribute_name}/{attribute_value}`: All identities in a workload identity pool with a certain attribute. * `principalSet://iam.googleapis.com/projects/{project_number}/locations/global/workloadIdentityPools/{pool_id}/*`: All identities in a workload identity pool. * `deleted:user:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a user that has been recently deleted. For example, `alice@example.com?uid=123456789012345678901`. If the user is recovered, this value reverts to `user:{emailid}` and the recovered user retains the role in the binding. * `deleted:serviceAccount:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a service account that has been recently deleted. For example, `my-other-app@appspot.gserviceaccount.com?uid=123456789012345678901`. If the service account is undeleted, this value reverts to `serviceAccount:{emailid}` and the undeleted service account retains the role in the binding. * `deleted:group:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a Google group that has been recently deleted. For example, `admins@example.com?uid=123456789012345678901`. If the group is recovered, this value reverts to `group:{emailid}` and the recovered group retains the role in the binding. * `deleted:principal://iam.googleapis.com/locations/global/workforcePools/{pool_id}/subject/{subject_attribute_value}`: Deleted single identity in a workforce identity pool. For example, `deleted:principal://iam.googleapis.com/locations/global/workforcePools/my-pool-id/subject/my-subject-attribute-value`. * @@ -36,7 +36,7 @@ class Binding extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string role = 3506294; */ - private $role = null; + protected $role = null; /** * Constructor. diff --git a/Compute/src/V1/BulkInsertDiskRequest.php b/Compute/src/V1/BulkInsertDiskRequest.php index 1825617da1a5..d60771e992a2 100644 --- a/Compute/src/V1/BulkInsertDiskRequest.php +++ b/Compute/src/V1/BulkInsertDiskRequest.php @@ -20,25 +20,25 @@ class BulkInsertDiskRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.compute.v1.BulkInsertDiskResource bulk_insert_disk_resource_resource = 289799382 [(.google.api.field_behavior) = REQUIRED]; */ - private $bulk_insert_disk_resource_resource = null; + protected $bulk_insert_disk_resource_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/BulkInsertDiskResource.php b/Compute/src/V1/BulkInsertDiskResource.php index 9a5fad5cd696..4af890eddc9a 100644 --- a/Compute/src/V1/BulkInsertDiskResource.php +++ b/Compute/src/V1/BulkInsertDiskResource.php @@ -20,7 +20,7 @@ class BulkInsertDiskResource extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string source_consistency_group_policy = 19616093; */ - private $source_consistency_group_policy = null; + protected $source_consistency_group_policy = null; /** * Constructor. diff --git a/Compute/src/V1/BulkInsertInstanceRequest.php b/Compute/src/V1/BulkInsertInstanceRequest.php index bbdc3859d4d7..27a57ccdb4b9 100644 --- a/Compute/src/V1/BulkInsertInstanceRequest.php +++ b/Compute/src/V1/BulkInsertInstanceRequest.php @@ -20,25 +20,25 @@ class BulkInsertInstanceRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.compute.v1.BulkInsertInstanceResource bulk_insert_instance_resource_resource = 41427278 [(.google.api.field_behavior) = REQUIRED]; */ - private $bulk_insert_instance_resource_resource = null; + protected $bulk_insert_instance_resource_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/BulkInsertInstanceResource.php b/Compute/src/V1/BulkInsertInstanceResource.php index b37ef121a300..83ead47987d9 100644 --- a/Compute/src/V1/BulkInsertInstanceResource.php +++ b/Compute/src/V1/BulkInsertInstanceResource.php @@ -20,31 +20,31 @@ class BulkInsertInstanceResource extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int64 count = 94851343; */ - private $count = null; + protected $count = null; /** * The instance properties defining the VM instances to be created. Required if sourceInstanceTemplate is not provided. * * Generated from protobuf field optional .google.cloud.compute.v1.InstanceProperties instance_properties = 215355165; */ - private $instance_properties = null; + protected $instance_properties = null; /** * Policy for choosing target zone. For more information, see Create VMs in bulk. * * Generated from protobuf field optional .google.cloud.compute.v1.LocationPolicy location_policy = 465689852; */ - private $location_policy = null; + protected $location_policy = null; /** * The minimum number of instances to create. If no min_count is specified then count is used as the default value. If min_count instances cannot be created, then no instances will be created and instances already created will be deleted. * * Generated from protobuf field optional int64 min_count = 523228386; */ - private $min_count = null; + protected $min_count = null; /** * The string pattern used for the names of the VMs. Either name_pattern or per_instance_properties must be set. The pattern must contain one continuous sequence of placeholder hash characters (#) with each character corresponding to one digit of the generated instance name. Example: a name_pattern of inst-#### generates instance names such as inst-0001 and inst-0002. If existing instances in the same project and zone have names that match the name pattern then the generated instance numbers start after the biggest existing number. For example, if there exists an instance with name inst-0050, then instance names generated using the pattern inst-#### begin with inst-0051. The name pattern placeholder #...# can contain up to 18 characters. * * Generated from protobuf field optional string name_pattern = 413815260; */ - private $name_pattern = null; + protected $name_pattern = null; /** * Per-instance properties to be set on individual instances. Keys of this map specify requested instance names. Can be empty if name_pattern is used. * @@ -56,7 +56,7 @@ class BulkInsertInstanceResource extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string source_instance_template = 332423616; */ - private $source_instance_template = null; + protected $source_instance_template = null; /** * Constructor. diff --git a/Compute/src/V1/BulkInsertInstanceResourcePerInstanceProperties.php b/Compute/src/V1/BulkInsertInstanceResourcePerInstanceProperties.php index 268b447df1ba..394fdae695c9 100644 --- a/Compute/src/V1/BulkInsertInstanceResourcePerInstanceProperties.php +++ b/Compute/src/V1/BulkInsertInstanceResourcePerInstanceProperties.php @@ -20,13 +20,13 @@ class BulkInsertInstanceResourcePerInstanceProperties extends \Google\Protobuf\I * * Generated from protobuf field optional string hostname = 237067315; */ - private $hostname = null; + protected $hostname = null; /** * This field is only temporary. It will be removed. Do not use it. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * Constructor. diff --git a/Compute/src/V1/BulkInsertOperationStatus.php b/Compute/src/V1/BulkInsertOperationStatus.php index abcf398966cf..7a4be2a061f4 100644 --- a/Compute/src/V1/BulkInsertOperationStatus.php +++ b/Compute/src/V1/BulkInsertOperationStatus.php @@ -19,32 +19,32 @@ class BulkInsertOperationStatus extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int32 created_vm_count = 396924158; */ - private $created_vm_count = null; + protected $created_vm_count = null; /** * [Output Only] Count of VMs that got deleted during rollback. * * Generated from protobuf field optional int32 deleted_vm_count = 271756013; */ - private $deleted_vm_count = null; + protected $deleted_vm_count = null; /** * [Output Only] Count of VMs that started creating but encountered an error. * * Generated from protobuf field optional int32 failed_to_create_vm_count = 58384104; */ - private $failed_to_create_vm_count = null; + protected $failed_to_create_vm_count = null; /** * [Output Only] Creation status of BulkInsert operation - information if the flow is rolling forward or rolling back. * Check the Status enum for the list of possible values. * * Generated from protobuf field optional string status = 181260274; */ - private $status = null; + protected $status = null; /** * [Output Only] Count of VMs originally planned to be created. * * Generated from protobuf field optional int32 target_vm_count = 532975733; */ - private $target_vm_count = null; + protected $target_vm_count = null; /** * Constructor. diff --git a/Compute/src/V1/BulkInsertRegionDiskRequest.php b/Compute/src/V1/BulkInsertRegionDiskRequest.php index ee5bea51509e..751f8b18af09 100644 --- a/Compute/src/V1/BulkInsertRegionDiskRequest.php +++ b/Compute/src/V1/BulkInsertRegionDiskRequest.php @@ -20,25 +20,25 @@ class BulkInsertRegionDiskRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.compute.v1.BulkInsertDiskResource bulk_insert_disk_resource_resource = 289799382 [(.google.api.field_behavior) = REQUIRED]; */ - private $bulk_insert_disk_resource_resource = null; + protected $bulk_insert_disk_resource_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * The name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/BulkInsertRegionInstanceRequest.php b/Compute/src/V1/BulkInsertRegionInstanceRequest.php index 0517378690f9..33f6340d830f 100644 --- a/Compute/src/V1/BulkInsertRegionInstanceRequest.php +++ b/Compute/src/V1/BulkInsertRegionInstanceRequest.php @@ -20,25 +20,25 @@ class BulkInsertRegionInstanceRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.compute.v1.BulkInsertInstanceResource bulk_insert_instance_resource_resource = 41427278 [(.google.api.field_behavior) = REQUIRED]; */ - private $bulk_insert_instance_resource_resource = null; + protected $bulk_insert_instance_resource_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * The name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/BulkSetLabelsDiskRequest.php b/Compute/src/V1/BulkSetLabelsDiskRequest.php index a54b92417b4a..102db2f87026 100644 --- a/Compute/src/V1/BulkSetLabelsDiskRequest.php +++ b/Compute/src/V1/BulkSetLabelsDiskRequest.php @@ -20,31 +20,31 @@ class BulkSetLabelsDiskRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.compute.v1.BulkZoneSetLabelsRequest bulk_zone_set_labels_request_resource = 531305115 [(.google.api.field_behavior) = REQUIRED]; */ - private $bulk_zone_set_labels_request_resource = null; + protected $bulk_zone_set_labels_request_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name or id of the resource for this request. * * Generated from protobuf field optional string resource = 195806222; */ - private $resource = null; + protected $resource = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/BulkSetLabelsRequest.php b/Compute/src/V1/BulkSetLabelsRequest.php index 08a31a1bad3b..cfda7f60b035 100644 --- a/Compute/src/V1/BulkSetLabelsRequest.php +++ b/Compute/src/V1/BulkSetLabelsRequest.php @@ -19,7 +19,7 @@ class BulkSetLabelsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string label_fingerprint = 178124825; */ - private $label_fingerprint = null; + protected $label_fingerprint = null; /** * The labels to set for this resource. * diff --git a/Compute/src/V1/CacheInvalidationRule.php b/Compute/src/V1/CacheInvalidationRule.php index d189f110395f..39830311328d 100644 --- a/Compute/src/V1/CacheInvalidationRule.php +++ b/Compute/src/V1/CacheInvalidationRule.php @@ -25,11 +25,11 @@ class CacheInvalidationRule extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string host = 3208616; */ - private $host = null; + protected $host = null; /** * Generated from protobuf field optional string path = 3433509; */ - private $path = null; + protected $path = null; /** * Constructor. diff --git a/Compute/src/V1/CacheKeyPolicy.php b/Compute/src/V1/CacheKeyPolicy.php index 5e787e84c61e..e2b55657b05b 100644 --- a/Compute/src/V1/CacheKeyPolicy.php +++ b/Compute/src/V1/CacheKeyPolicy.php @@ -20,7 +20,7 @@ class CacheKeyPolicy extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional bool include_host = 486867679; */ - private $include_host = null; + protected $include_host = null; /** * Allows HTTP request headers (by name) to be used in the cache key. * @@ -38,13 +38,13 @@ class CacheKeyPolicy extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional bool include_protocol = 303507535; */ - private $include_protocol = null; + protected $include_protocol = null; /** * If true, include query string parameters in the cache key according to query_string_whitelist and query_string_blacklist. If neither is set, the entire query string will be included. If false, the query string will be excluded from the cache key entirely. * * Generated from protobuf field optional bool include_query_string = 474036639; */ - private $include_query_string = null; + protected $include_query_string = null; /** * Names of query string parameters to exclude in cache keys. All other parameters will be included. Either specify query_string_whitelist or query_string_blacklist, not both. '&' and '=' will be percent encoded and not treated as delimiters. * diff --git a/Compute/src/V1/CancelInstanceGroupManagerResizeRequestRequest.php b/Compute/src/V1/CancelInstanceGroupManagerResizeRequestRequest.php index 9ca95fd4f7cd..56e9f3608759 100644 --- a/Compute/src/V1/CancelInstanceGroupManagerResizeRequestRequest.php +++ b/Compute/src/V1/CancelInstanceGroupManagerResizeRequestRequest.php @@ -20,31 +20,31 @@ class CancelInstanceGroupManagerResizeRequestRequest extends \Google\Protobuf\In * * Generated from protobuf field string instance_group_manager = 249363395 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group_manager = ''; + protected $instance_group_manager = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the resize request to cancel. The name should conform to RFC1035 or be a resource ID. * * Generated from protobuf field string resize_request = 216941060 [(.google.api.field_behavior) = REQUIRED]; */ - private $resize_request = ''; + protected $resize_request = ''; /** * The name of the zone where the managed instance group is located. The name should conform to RFC1035. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/CircuitBreakers.php b/Compute/src/V1/CircuitBreakers.php index efafc8682e02..d996fe70835a 100644 --- a/Compute/src/V1/CircuitBreakers.php +++ b/Compute/src/V1/CircuitBreakers.php @@ -20,31 +20,31 @@ class CircuitBreakers extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int32 max_connections = 110652154; */ - private $max_connections = null; + protected $max_connections = null; /** * The maximum number of pending requests allowed to the backend service. If not specified, there is no limit. Not supported when the backend service is referenced by a URL map that is bound to target gRPC proxy that has validateForProxyless field set to true. * * Generated from protobuf field optional int32 max_pending_requests = 375558887; */ - private $max_pending_requests = null; + protected $max_pending_requests = null; /** * The maximum number of parallel requests that allowed to the backend service. If not specified, there is no limit. * * Generated from protobuf field optional int32 max_requests = 28097599; */ - private $max_requests = null; + protected $max_requests = null; /** * Maximum requests for a single connection to the backend service. This parameter is respected by both the HTTP/1.1 and HTTP/2 implementations. If not specified, there is no limit. Setting this parameter to 1 will effectively disable keep alive. Not supported when the backend service is referenced by a URL map that is bound to target gRPC proxy that has validateForProxyless field set to true. * * Generated from protobuf field optional int32 max_requests_per_connection = 361630528; */ - private $max_requests_per_connection = null; + protected $max_requests_per_connection = null; /** * The maximum number of parallel retries allowed to the backend cluster. If not specified, the default is 1. Not supported when the backend service is referenced by a URL map that is bound to target gRPC proxy that has validateForProxyless field set to true. * * Generated from protobuf field optional int32 max_retries = 55546219; */ - private $max_retries = null; + protected $max_retries = null; /** * Constructor. diff --git a/Compute/src/V1/Client/AcceleratorTypesClient.php b/Compute/src/V1/Client/AcceleratorTypesClient.php index 9c952d43d74c..ff6332119f3d 100644 --- a/Compute/src/V1/Client/AcceleratorTypesClient.php +++ b/Compute/src/V1/Client/AcceleratorTypesClient.php @@ -1,6 +1,6 @@ startApiCall('AggregatedList', $request, $callOptions); } diff --git a/Compute/src/V1/Client/AddressesClient.php b/Compute/src/V1/Client/AddressesClient.php index a97894efe338..b79cf3fca207 100644 --- a/Compute/src/V1/Client/AddressesClient.php +++ b/Compute/src/V1/Client/AddressesClient.php @@ -1,6 +1,6 @@ __DIR__ . '/../resources/addresses_rest_client_config.php', ], ], - 'operationsClientClass' => RegionOperationsClient::class, ]; } @@ -119,9 +117,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -138,10 +134,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], + 'additionalArgumentMethods' => ['getProject', 'getRegion'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -169,12 +162,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 RegionOperationsClient + */ + 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 RegionOperationsClient($options); + } + /** * Constructor. * diff --git a/Compute/src/V1/Client/AutoscalersClient.php b/Compute/src/V1/Client/AutoscalersClient.php index 4f7d84323772..dd01422a8da5 100644 --- a/Compute/src/V1/Client/AutoscalersClient.php +++ b/Compute/src/V1/Client/AutoscalersClient.php @@ -1,6 +1,6 @@ __DIR__ . '/../resources/autoscalers_rest_client_config.php', ], ], - 'operationsClientClass' => ZoneOperationsClient::class, ]; } @@ -119,9 +117,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -138,10 +134,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getZone', - ], + 'additionalArgumentMethods' => ['getProject', 'getZone'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -169,12 +162,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 ZoneOperationsClient + */ + 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 ZoneOperationsClient($options); + } + /** * Constructor. * @@ -274,8 +288,10 @@ public function __call($method, $args) * * @throws ApiException Thrown if the API call fails. */ - public function aggregatedList(AggregatedListAutoscalersRequest $request, array $callOptions = []): PagedListResponse - { + public function aggregatedList( + AggregatedListAutoscalersRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('AggregatedList', $request, $callOptions); } diff --git a/Compute/src/V1/Client/BackendBucketsClient.php b/Compute/src/V1/Client/BackendBucketsClient.php index da82f3204cd8..19700d70c217 100644 --- a/Compute/src/V1/Client/BackendBucketsClient.php +++ b/Compute/src/V1/Client/BackendBucketsClient.php @@ -1,6 +1,6 @@ __DIR__ . '/../resources/backend_buckets_rest_client_config.php', ], ], - 'operationsClientClass' => GlobalOperationsClient::class, ]; } @@ -131,9 +129,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -150,9 +146,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - ], + 'additionalArgumentMethods' => ['getProject'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -180,12 +174,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 GlobalOperationsClient + */ + 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 GlobalOperationsClient($options); + } + /** * Constructor. * @@ -285,8 +300,10 @@ public function __call($method, $args) * * @throws ApiException Thrown if the API call fails. */ - public function addSignedUrlKey(AddSignedUrlKeyBackendBucketRequest $request, array $callOptions = []): OperationResponse - { + public function addSignedUrlKey( + AddSignedUrlKeyBackendBucketRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('AddSignedUrlKey', $request, $callOptions)->wait(); } @@ -337,8 +354,10 @@ public function delete(DeleteBackendBucketRequest $request, array $callOptions = * * @throws ApiException Thrown if the API call fails. */ - public function deleteSignedUrlKey(DeleteSignedUrlKeyBackendBucketRequest $request, array $callOptions = []): OperationResponse - { + public function deleteSignedUrlKey( + DeleteSignedUrlKeyBackendBucketRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('DeleteSignedUrlKey', $request, $callOptions)->wait(); } @@ -493,8 +512,10 @@ public function patch(PatchBackendBucketRequest $request, array $callOptions = [ * * @throws ApiException Thrown if the API call fails. */ - public function setEdgeSecurityPolicy(SetEdgeSecurityPolicyBackendBucketRequest $request, array $callOptions = []): OperationResponse - { + public function setEdgeSecurityPolicy( + SetEdgeSecurityPolicyBackendBucketRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('SetEdgeSecurityPolicy', $request, $callOptions)->wait(); } @@ -545,8 +566,10 @@ public function setIamPolicy(SetIamPolicyBackendBucketRequest $request, array $c * * @throws ApiException Thrown if the API call fails. */ - public function testIamPermissions(TestIamPermissionsBackendBucketRequest $request, array $callOptions = []): TestPermissionsResponse - { + public function testIamPermissions( + TestIamPermissionsBackendBucketRequest $request, + array $callOptions = [] + ): TestPermissionsResponse { return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); } diff --git a/Compute/src/V1/Client/BackendServicesClient.php b/Compute/src/V1/Client/BackendServicesClient.php index ee7770897f96..174547e306d7 100644 --- a/Compute/src/V1/Client/BackendServicesClient.php +++ b/Compute/src/V1/Client/BackendServicesClient.php @@ -1,6 +1,6 @@ __DIR__ . '/../resources/backend_services_rest_client_config.php', ], ], - 'operationsClientClass' => GlobalOperationsClient::class, ]; } @@ -140,9 +138,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -159,9 +155,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - ], + 'additionalArgumentMethods' => ['getProject'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -189,12 +183,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 GlobalOperationsClient + */ + 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 GlobalOperationsClient($options); + } + /** * Constructor. * @@ -294,8 +309,10 @@ public function __call($method, $args) * * @throws ApiException Thrown if the API call fails. */ - public function addSignedUrlKey(AddSignedUrlKeyBackendServiceRequest $request, array $callOptions = []): OperationResponse - { + public function addSignedUrlKey( + AddSignedUrlKeyBackendServiceRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('AddSignedUrlKey', $request, $callOptions)->wait(); } @@ -320,8 +337,10 @@ public function addSignedUrlKey(AddSignedUrlKeyBackendServiceRequest $request, a * * @throws ApiException Thrown if the API call fails. */ - public function aggregatedList(AggregatedListBackendServicesRequest $request, array $callOptions = []): PagedListResponse - { + public function aggregatedList( + AggregatedListBackendServicesRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('AggregatedList', $request, $callOptions); } @@ -372,8 +391,10 @@ public function delete(DeleteBackendServiceRequest $request, array $callOptions * * @throws ApiException Thrown if the API call fails. */ - public function deleteSignedUrlKey(DeleteSignedUrlKeyBackendServiceRequest $request, array $callOptions = []): OperationResponse - { + public function deleteSignedUrlKey( + DeleteSignedUrlKeyBackendServiceRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('DeleteSignedUrlKey', $request, $callOptions)->wait(); } @@ -424,8 +445,10 @@ public function get(GetBackendServiceRequest $request, array $callOptions = []): * * @throws ApiException Thrown if the API call fails. */ - public function getHealth(GetHealthBackendServiceRequest $request, array $callOptions = []): BackendServiceGroupHealth - { + public function getHealth( + GetHealthBackendServiceRequest $request, + array $callOptions = [] + ): BackendServiceGroupHealth { return $this->startApiCall('GetHealth', $request, $callOptions)->wait(); } @@ -581,8 +604,10 @@ public function patch(PatchBackendServiceRequest $request, array $callOptions = * * @throws ApiException Thrown if the API call fails. */ - public function setEdgeSecurityPolicy(SetEdgeSecurityPolicyBackendServiceRequest $request, array $callOptions = []): OperationResponse - { + public function setEdgeSecurityPolicy( + SetEdgeSecurityPolicyBackendServiceRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('SetEdgeSecurityPolicy', $request, $callOptions)->wait(); } @@ -633,8 +658,10 @@ public function setIamPolicy(SetIamPolicyBackendServiceRequest $request, array $ * * @throws ApiException Thrown if the API call fails. */ - public function setSecurityPolicy(SetSecurityPolicyBackendServiceRequest $request, array $callOptions = []): OperationResponse - { + public function setSecurityPolicy( + SetSecurityPolicyBackendServiceRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('SetSecurityPolicy', $request, $callOptions)->wait(); } @@ -659,8 +686,10 @@ public function setSecurityPolicy(SetSecurityPolicyBackendServiceRequest $reques * * @throws ApiException Thrown if the API call fails. */ - public function testIamPermissions(TestIamPermissionsBackendServiceRequest $request, array $callOptions = []): TestPermissionsResponse - { + public function testIamPermissions( + TestIamPermissionsBackendServiceRequest $request, + array $callOptions = [] + ): TestPermissionsResponse { return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); } diff --git a/Compute/src/V1/Client/DiskTypesClient.php b/Compute/src/V1/Client/DiskTypesClient.php index ea30dea76849..a9f87fcfa43b 100644 --- a/Compute/src/V1/Client/DiskTypesClient.php +++ b/Compute/src/V1/Client/DiskTypesClient.php @@ -1,6 +1,6 @@ __DIR__ . '/../resources/disks_rest_client_config.php', ], ], - 'operationsClientClass' => ZoneOperationsClient::class, ]; } @@ -145,9 +143,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -164,10 +160,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getZone', - ], + 'additionalArgumentMethods' => ['getProject', 'getZone'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -195,12 +188,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 ZoneOperationsClient + */ + 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 ZoneOperationsClient($options); + } + /** * Constructor. * @@ -300,8 +314,10 @@ public function __call($method, $args) * * @throws ApiException Thrown if the API call fails. */ - public function addResourcePolicies(AddResourcePoliciesDiskRequest $request, array $callOptions = []): OperationResponse - { + public function addResourcePolicies( + AddResourcePoliciesDiskRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('AddResourcePolicies', $request, $callOptions)->wait(); } @@ -560,8 +576,10 @@ public function list(ListDisksRequest $request, array $callOptions = []): PagedL * * @throws ApiException Thrown if the API call fails. */ - public function removeResourcePolicies(RemoveResourcePoliciesDiskRequest $request, array $callOptions = []): OperationResponse - { + public function removeResourcePolicies( + RemoveResourcePoliciesDiskRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('RemoveResourcePolicies', $request, $callOptions)->wait(); } @@ -664,8 +682,10 @@ public function setLabels(SetLabelsDiskRequest $request, array $callOptions = [] * * @throws ApiException Thrown if the API call fails. */ - public function startAsyncReplication(StartAsyncReplicationDiskRequest $request, array $callOptions = []): OperationResponse - { + public function startAsyncReplication( + StartAsyncReplicationDiskRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('StartAsyncReplication', $request, $callOptions)->wait(); } @@ -690,8 +710,10 @@ public function startAsyncReplication(StartAsyncReplicationDiskRequest $request, * * @throws ApiException Thrown if the API call fails. */ - public function stopAsyncReplication(StopAsyncReplicationDiskRequest $request, array $callOptions = []): OperationResponse - { + public function stopAsyncReplication( + StopAsyncReplicationDiskRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('StopAsyncReplication', $request, $callOptions)->wait(); } @@ -716,8 +738,10 @@ public function stopAsyncReplication(StopAsyncReplicationDiskRequest $request, a * * @throws ApiException Thrown if the API call fails. */ - public function stopGroupAsyncReplication(StopGroupAsyncReplicationDiskRequest $request, array $callOptions = []): OperationResponse - { + public function stopGroupAsyncReplication( + StopGroupAsyncReplicationDiskRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('StopGroupAsyncReplication', $request, $callOptions)->wait(); } @@ -742,8 +766,10 @@ public function stopGroupAsyncReplication(StopGroupAsyncReplicationDiskRequest $ * * @throws ApiException Thrown if the API call fails. */ - public function testIamPermissions(TestIamPermissionsDiskRequest $request, array $callOptions = []): TestPermissionsResponse - { + public function testIamPermissions( + TestIamPermissionsDiskRequest $request, + array $callOptions = [] + ): TestPermissionsResponse { return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); } diff --git a/Compute/src/V1/Client/ExternalVpnGatewaysClient.php b/Compute/src/V1/Client/ExternalVpnGatewaysClient.php index 9d1ba246dbfc..80a468fcbd25 100644 --- a/Compute/src/V1/Client/ExternalVpnGatewaysClient.php +++ b/Compute/src/V1/Client/ExternalVpnGatewaysClient.php @@ -1,6 +1,6 @@ __DIR__ . '/../resources/external_vpn_gateways_rest_client_config.php', ], ], - 'operationsClientClass' => GlobalOperationsClient::class, ]; } @@ -118,9 +116,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -137,9 +133,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - ], + 'additionalArgumentMethods' => ['getProject'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -167,12 +161,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 GlobalOperationsClient + */ + 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 GlobalOperationsClient($options); + } + /** * Constructor. * @@ -403,8 +418,10 @@ public function setLabels(SetLabelsExternalVpnGatewayRequest $request, array $ca * * @throws ApiException Thrown if the API call fails. */ - public function testIamPermissions(TestIamPermissionsExternalVpnGatewayRequest $request, array $callOptions = []): TestPermissionsResponse - { + public function testIamPermissions( + TestIamPermissionsExternalVpnGatewayRequest $request, + array $callOptions = [] + ): TestPermissionsResponse { return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); } } diff --git a/Compute/src/V1/Client/FirewallPoliciesClient.php b/Compute/src/V1/Client/FirewallPoliciesClient.php index e26631942c14..ebd41446bd9f 100644 --- a/Compute/src/V1/Client/FirewallPoliciesClient.php +++ b/Compute/src/V1/Client/FirewallPoliciesClient.php @@ -1,6 +1,6 @@ __DIR__ . '/../resources/firewall_policies_rest_client_config.php', ], ], - 'operationsClientClass' => GlobalOrganizationOperationsClient::class, ]; } @@ -146,9 +144,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -194,12 +190,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 GlobalOrganizationOperationsClient + */ + 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 GlobalOrganizationOperationsClient($options); + } + /** * Constructor. * @@ -299,8 +316,10 @@ public function __call($method, $args) * * @throws ApiException Thrown if the API call fails. */ - public function addAssociation(AddAssociationFirewallPolicyRequest $request, array $callOptions = []): OperationResponse - { + public function addAssociation( + AddAssociationFirewallPolicyRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('AddAssociation', $request, $callOptions)->wait(); } @@ -429,8 +448,10 @@ public function get(GetFirewallPolicyRequest $request, array $callOptions = []): * * @throws ApiException Thrown if the API call fails. */ - public function getAssociation(GetAssociationFirewallPolicyRequest $request, array $callOptions = []): FirewallPolicyAssociation - { + public function getAssociation( + GetAssociationFirewallPolicyRequest $request, + array $callOptions = [] + ): FirewallPolicyAssociation { return $this->startApiCall('GetAssociation', $request, $callOptions)->wait(); } @@ -559,8 +580,10 @@ public function list(ListFirewallPoliciesRequest $request, array $callOptions = * * @throws ApiException Thrown if the API call fails. */ - public function listAssociations(ListAssociationsFirewallPolicyRequest $request, array $callOptions = []): FirewallPoliciesListAssociationsResponse - { + public function listAssociations( + ListAssociationsFirewallPolicyRequest $request, + array $callOptions = [] + ): FirewallPoliciesListAssociationsResponse { return $this->startApiCall('ListAssociations', $request, $callOptions)->wait(); } @@ -663,8 +686,10 @@ public function patchRule(PatchRuleFirewallPolicyRequest $request, array $callOp * * @throws ApiException Thrown if the API call fails. */ - public function removeAssociation(RemoveAssociationFirewallPolicyRequest $request, array $callOptions = []): OperationResponse - { + public function removeAssociation( + RemoveAssociationFirewallPolicyRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('RemoveAssociation', $request, $callOptions)->wait(); } @@ -741,8 +766,10 @@ public function setIamPolicy(SetIamPolicyFirewallPolicyRequest $request, array $ * * @throws ApiException Thrown if the API call fails. */ - public function testIamPermissions(TestIamPermissionsFirewallPolicyRequest $request, array $callOptions = []): TestPermissionsResponse - { + public function testIamPermissions( + TestIamPermissionsFirewallPolicyRequest $request, + array $callOptions = [] + ): TestPermissionsResponse { return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); } } diff --git a/Compute/src/V1/Client/FirewallsClient.php b/Compute/src/V1/Client/FirewallsClient.php index d8a7c3634b73..a42a55a67b46 100644 --- a/Compute/src/V1/Client/FirewallsClient.php +++ b/Compute/src/V1/Client/FirewallsClient.php @@ -1,6 +1,6 @@ __DIR__ . '/../resources/firewalls_rest_client_config.php', ], ], - 'operationsClientClass' => GlobalOperationsClient::class, ]; } @@ -117,9 +115,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -136,9 +132,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - ], + 'additionalArgumentMethods' => ['getProject'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -166,12 +160,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 GlobalOperationsClient + */ + 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 GlobalOperationsClient($options); + } + /** * Constructor. * diff --git a/Compute/src/V1/Client/ForwardingRulesClient.php b/Compute/src/V1/Client/ForwardingRulesClient.php index f400e9f49210..b62c2f84a899 100644 --- a/Compute/src/V1/Client/ForwardingRulesClient.php +++ b/Compute/src/V1/Client/ForwardingRulesClient.php @@ -1,6 +1,6 @@ __DIR__ . '/../resources/forwarding_rules_rest_client_config.php', ], ], - 'operationsClientClass' => RegionOperationsClient::class, ]; } @@ -121,9 +119,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -140,10 +136,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], + 'additionalArgumentMethods' => ['getProject', 'getRegion'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -171,12 +164,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 RegionOperationsClient + */ + 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 RegionOperationsClient($options); + } + /** * Constructor. * @@ -276,8 +290,10 @@ public function __call($method, $args) * * @throws ApiException Thrown if the API call fails. */ - public function aggregatedList(AggregatedListForwardingRulesRequest $request, array $callOptions = []): PagedListResponse - { + public function aggregatedList( + AggregatedListForwardingRulesRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('AggregatedList', $request, $callOptions); } diff --git a/Compute/src/V1/Client/GlobalAddressesClient.php b/Compute/src/V1/Client/GlobalAddressesClient.php index 025a1b43595a..936f033b9541 100644 --- a/Compute/src/V1/Client/GlobalAddressesClient.php +++ b/Compute/src/V1/Client/GlobalAddressesClient.php @@ -1,6 +1,6 @@ __DIR__ . '/../resources/global_addresses_rest_client_config.php', ], ], - 'operationsClientClass' => GlobalOperationsClient::class, ]; } @@ -117,9 +115,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -136,9 +132,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - ], + 'additionalArgumentMethods' => ['getProject'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -166,12 +160,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 GlobalOperationsClient + */ + 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 GlobalOperationsClient($options); + } + /** * Constructor. * diff --git a/Compute/src/V1/Client/GlobalForwardingRulesClient.php b/Compute/src/V1/Client/GlobalForwardingRulesClient.php index 72fa6b9cbf62..39694f8e559f 100644 --- a/Compute/src/V1/Client/GlobalForwardingRulesClient.php +++ b/Compute/src/V1/Client/GlobalForwardingRulesClient.php @@ -1,6 +1,6 @@ __DIR__ . '/../resources/global_forwarding_rules_rest_client_config.php', ], ], - 'operationsClientClass' => GlobalOperationsClient::class, ]; } @@ -119,9 +117,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -138,9 +134,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - ], + 'additionalArgumentMethods' => ['getProject'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -168,12 +162,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 GlobalOperationsClient + */ + 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 GlobalOperationsClient($options); + } + /** * Constructor. * diff --git a/Compute/src/V1/Client/GlobalNetworkEndpointGroupsClient.php b/Compute/src/V1/Client/GlobalNetworkEndpointGroupsClient.php index b8299bd4ad3c..49ad9f792f1d 100644 --- a/Compute/src/V1/Client/GlobalNetworkEndpointGroupsClient.php +++ b/Compute/src/V1/Client/GlobalNetworkEndpointGroupsClient.php @@ -1,6 +1,6 @@ [ 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/global_network_endpoint_groups_rest_client_config.php', + 'restClientConfigPath' => + __DIR__ . '/../resources/global_network_endpoint_groups_rest_client_config.php', ], ], - 'operationsClientClass' => GlobalOperationsClient::class, ]; } @@ -119,9 +118,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -138,9 +135,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - ], + 'additionalArgumentMethods' => ['getProject'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -168,12 +163,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 GlobalOperationsClient + */ + 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 GlobalOperationsClient($options); + } + /** * Constructor. * @@ -274,8 +290,10 @@ public function __call($method, $args) * * @throws ApiException Thrown if the API call fails. */ - public function attachNetworkEndpoints(AttachNetworkEndpointsGlobalNetworkEndpointGroupRequest $request, array $callOptions = []): OperationResponse - { + public function attachNetworkEndpoints( + AttachNetworkEndpointsGlobalNetworkEndpointGroupRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('AttachNetworkEndpoints', $request, $callOptions)->wait(); } @@ -327,8 +345,10 @@ public function delete(DeleteGlobalNetworkEndpointGroupRequest $request, array $ * * @throws ApiException Thrown if the API call fails. */ - public function detachNetworkEndpoints(DetachNetworkEndpointsGlobalNetworkEndpointGroupRequest $request, array $callOptions = []): OperationResponse - { + public function detachNetworkEndpoints( + DetachNetworkEndpointsGlobalNetworkEndpointGroupRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('DetachNetworkEndpoints', $request, $callOptions)->wait(); } @@ -432,8 +452,10 @@ public function list(ListGlobalNetworkEndpointGroupsRequest $request, array $cal * * @throws ApiException Thrown if the API call fails. */ - public function listNetworkEndpoints(ListNetworkEndpointsGlobalNetworkEndpointGroupsRequest $request, array $callOptions = []): PagedListResponse - { + public function listNetworkEndpoints( + ListNetworkEndpointsGlobalNetworkEndpointGroupsRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('ListNetworkEndpoints', $request, $callOptions); } } diff --git a/Compute/src/V1/Client/GlobalOperationsClient.php b/Compute/src/V1/Client/GlobalOperationsClient.php index 7bc5a572d3fc..342b268cd21a 100644 --- a/Compute/src/V1/Client/GlobalOperationsClient.php +++ b/Compute/src/V1/Client/GlobalOperationsClient.php @@ -1,6 +1,6 @@ startApiCall('AggregatedList', $request, $callOptions); } @@ -240,8 +240,10 @@ public function aggregatedList(AggregatedListGlobalOperationsRequest $request, a * * @throws ApiException Thrown if the API call fails. */ - public function delete(DeleteGlobalOperationRequest $request, array $callOptions = []): DeleteGlobalOperationResponse - { + public function delete( + DeleteGlobalOperationRequest $request, + array $callOptions = [] + ): DeleteGlobalOperationResponse { return $this->startApiCall('Delete', $request, $callOptions)->wait(); } diff --git a/Compute/src/V1/Client/GlobalOrganizationOperationsClient.php b/Compute/src/V1/Client/GlobalOrganizationOperationsClient.php index 810f6d211ff9..845759b64fa2 100644 --- a/Compute/src/V1/Client/GlobalOrganizationOperationsClient.php +++ b/Compute/src/V1/Client/GlobalOrganizationOperationsClient.php @@ -1,6 +1,6 @@ [ 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/global_organization_operations_rest_client_config.php', + 'restClientConfigPath' => + __DIR__ . '/../resources/global_organization_operations_rest_client_config.php', ], ], ]; @@ -107,9 +108,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -210,8 +209,10 @@ public function __call($method, $args) * * @throws ApiException Thrown if the API call fails. */ - public function delete(DeleteGlobalOrganizationOperationRequest $request, array $callOptions = []): DeleteGlobalOrganizationOperationResponse - { + public function delete( + DeleteGlobalOrganizationOperationRequest $request, + array $callOptions = [] + ): DeleteGlobalOrganizationOperationResponse { return $this->startApiCall('Delete', $request, $callOptions)->wait(); } diff --git a/Compute/src/V1/Client/GlobalPublicDelegatedPrefixesClient.php b/Compute/src/V1/Client/GlobalPublicDelegatedPrefixesClient.php index 46b0b294a2ec..baecd349c924 100644 --- a/Compute/src/V1/Client/GlobalPublicDelegatedPrefixesClient.php +++ b/Compute/src/V1/Client/GlobalPublicDelegatedPrefixesClient.php @@ -1,6 +1,6 @@ [ 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/global_public_delegated_prefixes_rest_client_config.php', + 'restClientConfigPath' => + __DIR__ . '/../resources/global_public_delegated_prefixes_rest_client_config.php', ], ], - 'operationsClientClass' => GlobalOperationsClient::class, ]; } @@ -115,9 +114,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -134,9 +131,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - ], + 'additionalArgumentMethods' => ['getProject'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -164,12 +159,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 GlobalOperationsClient + */ + 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 GlobalOperationsClient($options); + } + /** * Constructor. * @@ -269,8 +285,10 @@ public function __call($method, $args) * * @throws ApiException Thrown if the API call fails. */ - public function delete(DeleteGlobalPublicDelegatedPrefixeRequest $request, array $callOptions = []): OperationResponse - { + public function delete( + DeleteGlobalPublicDelegatedPrefixeRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('Delete', $request, $callOptions)->wait(); } @@ -321,8 +339,10 @@ public function get(GetGlobalPublicDelegatedPrefixeRequest $request, array $call * * @throws ApiException Thrown if the API call fails. */ - public function insert(InsertGlobalPublicDelegatedPrefixeRequest $request, array $callOptions = []): OperationResponse - { + public function insert( + InsertGlobalPublicDelegatedPrefixeRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('Insert', $request, $callOptions)->wait(); } diff --git a/Compute/src/V1/Client/HealthChecksClient.php b/Compute/src/V1/Client/HealthChecksClient.php index fd460fc4c200..41d3f2ed0eb9 100644 --- a/Compute/src/V1/Client/HealthChecksClient.php +++ b/Compute/src/V1/Client/HealthChecksClient.php @@ -1,6 +1,6 @@ __DIR__ . '/../resources/health_checks_rest_client_config.php', ], ], - 'operationsClientClass' => GlobalOperationsClient::class, ]; } @@ -119,9 +117,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -138,9 +134,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - ], + 'additionalArgumentMethods' => ['getProject'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -168,12 +162,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 GlobalOperationsClient + */ + 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 GlobalOperationsClient($options); + } + /** * Constructor. * @@ -273,8 +288,10 @@ public function __call($method, $args) * * @throws ApiException Thrown if the API call fails. */ - public function aggregatedList(AggregatedListHealthChecksRequest $request, array $callOptions = []): PagedListResponse - { + public function aggregatedList( + AggregatedListHealthChecksRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('AggregatedList', $request, $callOptions); } diff --git a/Compute/src/V1/Client/ImageFamilyViewsClient.php b/Compute/src/V1/Client/ImageFamilyViewsClient.php index 8fd2738e4837..2f20a3de6c78 100644 --- a/Compute/src/V1/Client/ImageFamilyViewsClient.php +++ b/Compute/src/V1/Client/ImageFamilyViewsClient.php @@ -1,6 +1,6 @@ __DIR__ . '/../resources/images_rest_client_config.php', ], ], - 'operationsClientClass' => GlobalOperationsClient::class, ]; } @@ -129,9 +127,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -148,9 +144,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - ], + 'additionalArgumentMethods' => ['getProject'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -178,12 +172,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 GlobalOperationsClient + */ + 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 GlobalOperationsClient($options); + } + /** * Constructor. * @@ -543,8 +558,10 @@ public function setLabels(SetLabelsImageRequest $request, array $callOptions = [ * * @throws ApiException Thrown if the API call fails. */ - public function testIamPermissions(TestIamPermissionsImageRequest $request, array $callOptions = []): TestPermissionsResponse - { + public function testIamPermissions( + TestIamPermissionsImageRequest $request, + array $callOptions = [] + ): TestPermissionsResponse { return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); } } diff --git a/Compute/src/V1/Client/InstanceGroupManagerResizeRequestsClient.php b/Compute/src/V1/Client/InstanceGroupManagerResizeRequestsClient.php index 7a7d203bfc36..671e73e227c2 100644 --- a/Compute/src/V1/Client/InstanceGroupManagerResizeRequestsClient.php +++ b/Compute/src/V1/Client/InstanceGroupManagerResizeRequestsClient.php @@ -1,6 +1,6 @@ self::SERVICE_NAME, 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, 'clientConfig' => __DIR__ . '/../resources/instance_group_manager_resize_requests_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/instance_group_manager_resize_requests_descriptor_config.php', + 'descriptorsConfigPath' => + __DIR__ . '/../resources/instance_group_manager_resize_requests_descriptor_config.php', 'credentialsConfig' => [ 'defaultScopes' => self::$serviceScopes, 'useJwtAccessWithScope' => false, ], 'transportConfig' => [ 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/instance_group_manager_resize_requests_rest_client_config.php', + 'restClientConfigPath' => + __DIR__ . '/../resources/instance_group_manager_resize_requests_rest_client_config.php', ], ], - 'operationsClientClass' => ZoneOperationsClient::class, ]; } @@ -115,9 +115,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -134,10 +132,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getZone', - ], + 'additionalArgumentMethods' => ['getProject', 'getZone'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -165,12 +160,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 ZoneOperationsClient + */ + 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 ZoneOperationsClient($options); + } + /** * Constructor. * @@ -271,8 +287,10 @@ public function __call($method, $args) * * @throws ApiException Thrown if the API call fails. */ - public function cancel(CancelInstanceGroupManagerResizeRequestRequest $request, array $callOptions = []): OperationResponse - { + public function cancel( + CancelInstanceGroupManagerResizeRequestRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('Cancel', $request, $callOptions)->wait(); } @@ -298,8 +316,10 @@ public function cancel(CancelInstanceGroupManagerResizeRequestRequest $request, * * @throws ApiException Thrown if the API call fails. */ - public function delete(DeleteInstanceGroupManagerResizeRequestRequest $request, array $callOptions = []): OperationResponse - { + public function delete( + DeleteInstanceGroupManagerResizeRequestRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('Delete', $request, $callOptions)->wait(); } @@ -325,8 +345,10 @@ public function delete(DeleteInstanceGroupManagerResizeRequestRequest $request, * * @throws ApiException Thrown if the API call fails. */ - public function get(GetInstanceGroupManagerResizeRequestRequest $request, array $callOptions = []): InstanceGroupManagerResizeRequest - { + public function get( + GetInstanceGroupManagerResizeRequestRequest $request, + array $callOptions = [] + ): InstanceGroupManagerResizeRequest { return $this->startApiCall('Get', $request, $callOptions)->wait(); } @@ -352,8 +374,10 @@ public function get(GetInstanceGroupManagerResizeRequestRequest $request, array * * @throws ApiException Thrown if the API call fails. */ - public function insert(InsertInstanceGroupManagerResizeRequestRequest $request, array $callOptions = []): OperationResponse - { + public function insert( + InsertInstanceGroupManagerResizeRequestRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('Insert', $request, $callOptions)->wait(); } @@ -379,8 +403,10 @@ public function insert(InsertInstanceGroupManagerResizeRequestRequest $request, * * @throws ApiException Thrown if the API call fails. */ - public function list(ListInstanceGroupManagerResizeRequestsRequest $request, array $callOptions = []): PagedListResponse - { + public function list( + ListInstanceGroupManagerResizeRequestsRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('List', $request, $callOptions); } } diff --git a/Compute/src/V1/Client/InstanceGroupManagersClient.php b/Compute/src/V1/Client/InstanceGroupManagersClient.php index 017144a60bd5..ef053a518585 100644 --- a/Compute/src/V1/Client/InstanceGroupManagersClient.php +++ b/Compute/src/V1/Client/InstanceGroupManagersClient.php @@ -1,6 +1,6 @@ __DIR__ . '/../resources/instance_group_managers_rest_client_config.php', ], ], - 'operationsClientClass' => ZoneOperationsClient::class, ]; } @@ -153,9 +151,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -172,10 +168,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getZone', - ], + 'additionalArgumentMethods' => ['getProject', 'getZone'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -203,12 +196,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 ZoneOperationsClient + */ + 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 ZoneOperationsClient($options); + } + /** * Constructor. * @@ -309,8 +323,10 @@ public function __call($method, $args) * * @throws ApiException Thrown if the API call fails. */ - public function abandonInstances(AbandonInstancesInstanceGroupManagerRequest $request, array $callOptions = []): OperationResponse - { + public function abandonInstances( + AbandonInstancesInstanceGroupManagerRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('AbandonInstances', $request, $callOptions)->wait(); } @@ -335,8 +351,10 @@ public function abandonInstances(AbandonInstancesInstanceGroupManagerRequest $re * * @throws ApiException Thrown if the API call fails. */ - public function aggregatedList(AggregatedListInstanceGroupManagersRequest $request, array $callOptions = []): PagedListResponse - { + public function aggregatedList( + AggregatedListInstanceGroupManagersRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('AggregatedList', $request, $callOptions); } @@ -362,8 +380,10 @@ public function aggregatedList(AggregatedListInstanceGroupManagersRequest $reque * * @throws ApiException Thrown if the API call fails. */ - public function applyUpdatesToInstances(ApplyUpdatesToInstancesInstanceGroupManagerRequest $request, array $callOptions = []): OperationResponse - { + public function applyUpdatesToInstances( + ApplyUpdatesToInstancesInstanceGroupManagerRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('ApplyUpdatesToInstances', $request, $callOptions)->wait(); } @@ -389,8 +409,10 @@ public function applyUpdatesToInstances(ApplyUpdatesToInstancesInstanceGroupMana * * @throws ApiException Thrown if the API call fails. */ - public function createInstances(CreateInstancesInstanceGroupManagerRequest $request, array $callOptions = []): OperationResponse - { + public function createInstances( + CreateInstancesInstanceGroupManagerRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('CreateInstances', $request, $callOptions)->wait(); } @@ -442,8 +464,10 @@ public function delete(DeleteInstanceGroupManagerRequest $request, array $callOp * * @throws ApiException Thrown if the API call fails. */ - public function deleteInstances(DeleteInstancesInstanceGroupManagerRequest $request, array $callOptions = []): OperationResponse - { + public function deleteInstances( + DeleteInstancesInstanceGroupManagerRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('DeleteInstances', $request, $callOptions)->wait(); } @@ -469,8 +493,10 @@ public function deleteInstances(DeleteInstancesInstanceGroupManagerRequest $requ * * @throws ApiException Thrown if the API call fails. */ - public function deletePerInstanceConfigs(DeletePerInstanceConfigsInstanceGroupManagerRequest $request, array $callOptions = []): OperationResponse - { + public function deletePerInstanceConfigs( + DeletePerInstanceConfigsInstanceGroupManagerRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('DeletePerInstanceConfigs', $request, $callOptions)->wait(); } @@ -573,8 +599,10 @@ public function list(ListInstanceGroupManagersRequest $request, array $callOptio * * @throws ApiException Thrown if the API call fails. */ - public function listErrors(ListErrorsInstanceGroupManagersRequest $request, array $callOptions = []): PagedListResponse - { + public function listErrors( + ListErrorsInstanceGroupManagersRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('ListErrors', $request, $callOptions); } @@ -600,8 +628,10 @@ public function listErrors(ListErrorsInstanceGroupManagersRequest $request, arra * * @throws ApiException Thrown if the API call fails. */ - public function listManagedInstances(ListManagedInstancesInstanceGroupManagersRequest $request, array $callOptions = []): PagedListResponse - { + public function listManagedInstances( + ListManagedInstancesInstanceGroupManagersRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('ListManagedInstances', $request, $callOptions); } @@ -627,8 +657,10 @@ public function listManagedInstances(ListManagedInstancesInstanceGroupManagersRe * * @throws ApiException Thrown if the API call fails. */ - public function listPerInstanceConfigs(ListPerInstanceConfigsInstanceGroupManagersRequest $request, array $callOptions = []): PagedListResponse - { + public function listPerInstanceConfigs( + ListPerInstanceConfigsInstanceGroupManagersRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('ListPerInstanceConfigs', $request, $callOptions); } @@ -680,8 +712,10 @@ public function patch(PatchInstanceGroupManagerRequest $request, array $callOpti * * @throws ApiException Thrown if the API call fails. */ - public function patchPerInstanceConfigs(PatchPerInstanceConfigsInstanceGroupManagerRequest $request, array $callOptions = []): OperationResponse - { + public function patchPerInstanceConfigs( + PatchPerInstanceConfigsInstanceGroupManagerRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('PatchPerInstanceConfigs', $request, $callOptions)->wait(); } @@ -707,8 +741,10 @@ public function patchPerInstanceConfigs(PatchPerInstanceConfigsInstanceGroupMana * * @throws ApiException Thrown if the API call fails. */ - public function recreateInstances(RecreateInstancesInstanceGroupManagerRequest $request, array $callOptions = []): OperationResponse - { + public function recreateInstances( + RecreateInstancesInstanceGroupManagerRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('RecreateInstances', $request, $callOptions)->wait(); } @@ -760,8 +796,10 @@ public function resize(ResizeInstanceGroupManagerRequest $request, array $callOp * * @throws ApiException Thrown if the API call fails. */ - public function resumeInstances(ResumeInstancesInstanceGroupManagerRequest $request, array $callOptions = []): OperationResponse - { + public function resumeInstances( + ResumeInstancesInstanceGroupManagerRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('ResumeInstances', $request, $callOptions)->wait(); } @@ -787,8 +825,10 @@ public function resumeInstances(ResumeInstancesInstanceGroupManagerRequest $requ * * @throws ApiException Thrown if the API call fails. */ - public function setInstanceTemplate(SetInstanceTemplateInstanceGroupManagerRequest $request, array $callOptions = []): OperationResponse - { + public function setInstanceTemplate( + SetInstanceTemplateInstanceGroupManagerRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('SetInstanceTemplate', $request, $callOptions)->wait(); } @@ -813,8 +853,10 @@ public function setInstanceTemplate(SetInstanceTemplateInstanceGroupManagerReque * * @throws ApiException Thrown if the API call fails. */ - public function setTargetPools(SetTargetPoolsInstanceGroupManagerRequest $request, array $callOptions = []): OperationResponse - { + public function setTargetPools( + SetTargetPoolsInstanceGroupManagerRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('SetTargetPools', $request, $callOptions)->wait(); } @@ -839,8 +881,10 @@ public function setTargetPools(SetTargetPoolsInstanceGroupManagerRequest $reques * * @throws ApiException Thrown if the API call fails. */ - public function startInstances(StartInstancesInstanceGroupManagerRequest $request, array $callOptions = []): OperationResponse - { + public function startInstances( + StartInstancesInstanceGroupManagerRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('StartInstances', $request, $callOptions)->wait(); } @@ -865,8 +909,10 @@ public function startInstances(StartInstancesInstanceGroupManagerRequest $reques * * @throws ApiException Thrown if the API call fails. */ - public function stopInstances(StopInstancesInstanceGroupManagerRequest $request, array $callOptions = []): OperationResponse - { + public function stopInstances( + StopInstancesInstanceGroupManagerRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('StopInstances', $request, $callOptions)->wait(); } @@ -892,8 +938,10 @@ public function stopInstances(StopInstancesInstanceGroupManagerRequest $request, * * @throws ApiException Thrown if the API call fails. */ - public function suspendInstances(SuspendInstancesInstanceGroupManagerRequest $request, array $callOptions = []): OperationResponse - { + public function suspendInstances( + SuspendInstancesInstanceGroupManagerRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('SuspendInstances', $request, $callOptions)->wait(); } @@ -919,8 +967,10 @@ public function suspendInstances(SuspendInstancesInstanceGroupManagerRequest $re * * @throws ApiException Thrown if the API call fails. */ - public function updatePerInstanceConfigs(UpdatePerInstanceConfigsInstanceGroupManagerRequest $request, array $callOptions = []): OperationResponse - { + public function updatePerInstanceConfigs( + UpdatePerInstanceConfigsInstanceGroupManagerRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('UpdatePerInstanceConfigs', $request, $callOptions)->wait(); } } diff --git a/Compute/src/V1/Client/InstanceGroupsClient.php b/Compute/src/V1/Client/InstanceGroupsClient.php index d1eb3a55262e..2a2b3096db8a 100644 --- a/Compute/src/V1/Client/InstanceGroupsClient.php +++ b/Compute/src/V1/Client/InstanceGroupsClient.php @@ -1,6 +1,6 @@ __DIR__ . '/../resources/instance_groups_rest_client_config.php', ], ], - 'operationsClientClass' => ZoneOperationsClient::class, ]; } @@ -123,9 +121,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -142,10 +138,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getZone', - ], + 'additionalArgumentMethods' => ['getProject', 'getZone'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -173,12 +166,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 ZoneOperationsClient + */ + 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 ZoneOperationsClient($options); + } + /** * Constructor. * @@ -304,8 +318,10 @@ public function addInstances(AddInstancesInstanceGroupRequest $request, array $c * * @throws ApiException Thrown if the API call fails. */ - public function aggregatedList(AggregatedListInstanceGroupsRequest $request, array $callOptions = []): PagedListResponse - { + public function aggregatedList( + AggregatedListInstanceGroupsRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('AggregatedList', $request, $callOptions); } @@ -434,8 +450,10 @@ public function list(ListInstanceGroupsRequest $request, array $callOptions = [] * * @throws ApiException Thrown if the API call fails. */ - public function listInstances(ListInstancesInstanceGroupsRequest $request, array $callOptions = []): PagedListResponse - { + public function listInstances( + ListInstancesInstanceGroupsRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('ListInstances', $request, $callOptions); } @@ -460,8 +478,10 @@ public function listInstances(ListInstancesInstanceGroupsRequest $request, array * * @throws ApiException Thrown if the API call fails. */ - public function removeInstances(RemoveInstancesInstanceGroupRequest $request, array $callOptions = []): OperationResponse - { + public function removeInstances( + RemoveInstancesInstanceGroupRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('RemoveInstances', $request, $callOptions)->wait(); } @@ -486,8 +506,10 @@ public function removeInstances(RemoveInstancesInstanceGroupRequest $request, ar * * @throws ApiException Thrown if the API call fails. */ - public function setNamedPorts(SetNamedPortsInstanceGroupRequest $request, array $callOptions = []): OperationResponse - { + public function setNamedPorts( + SetNamedPortsInstanceGroupRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('SetNamedPorts', $request, $callOptions)->wait(); } } diff --git a/Compute/src/V1/Client/InstanceSettingsServiceClient.php b/Compute/src/V1/Client/InstanceSettingsServiceClient.php index ec4f243db1dc..d392b44cc0d1 100644 --- a/Compute/src/V1/Client/InstanceSettingsServiceClient.php +++ b/Compute/src/V1/Client/InstanceSettingsServiceClient.php @@ -1,6 +1,6 @@ [ 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/instance_settings_service_rest_client_config.php', + 'restClientConfigPath' => + __DIR__ . '/../resources/instance_settings_service_rest_client_config.php', ], ], - 'operationsClientClass' => ZoneOperationsClient::class, ]; } @@ -108,9 +107,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -127,10 +124,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getZone', - ], + 'additionalArgumentMethods' => ['getProject', 'getZone'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -158,12 +152,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 ZoneOperationsClient + */ + 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 ZoneOperationsClient($options); + } + /** * Constructor. * diff --git a/Compute/src/V1/Client/InstanceTemplatesClient.php b/Compute/src/V1/Client/InstanceTemplatesClient.php index fdd542b8e1c7..8ae2af1de44a 100644 --- a/Compute/src/V1/Client/InstanceTemplatesClient.php +++ b/Compute/src/V1/Client/InstanceTemplatesClient.php @@ -1,6 +1,6 @@ __DIR__ . '/../resources/instance_templates_rest_client_config.php', ], ], - 'operationsClientClass' => GlobalOperationsClient::class, ]; } @@ -123,9 +121,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -142,9 +138,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - ], + 'additionalArgumentMethods' => ['getProject'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -172,12 +166,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 GlobalOperationsClient + */ + 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 GlobalOperationsClient($options); + } + /** * Constructor. * @@ -277,8 +292,10 @@ public function __call($method, $args) * * @throws ApiException Thrown if the API call fails. */ - public function aggregatedList(AggregatedListInstanceTemplatesRequest $request, array $callOptions = []): PagedListResponse - { + public function aggregatedList( + AggregatedListInstanceTemplatesRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('AggregatedList', $request, $callOptions); } @@ -459,8 +476,10 @@ public function setIamPolicy(SetIamPolicyInstanceTemplateRequest $request, array * * @throws ApiException Thrown if the API call fails. */ - public function testIamPermissions(TestIamPermissionsInstanceTemplateRequest $request, array $callOptions = []): TestPermissionsResponse - { + public function testIamPermissions( + TestIamPermissionsInstanceTemplateRequest $request, + array $callOptions = [] + ): TestPermissionsResponse { return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); } } diff --git a/Compute/src/V1/Client/InstancesClient.php b/Compute/src/V1/Client/InstancesClient.php index a56ccf9d1971..2cc8f0199d34 100644 --- a/Compute/src/V1/Client/InstancesClient.php +++ b/Compute/src/V1/Client/InstancesClient.php @@ -1,6 +1,6 @@ __DIR__ . '/../resources/instances_rest_client_config.php', ], ], - 'operationsClientClass' => ZoneOperationsClient::class, ]; } @@ -211,9 +209,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -230,10 +226,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getZone', - ], + 'additionalArgumentMethods' => ['getProject', 'getZone'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -261,12 +254,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 ZoneOperationsClient + */ + 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 ZoneOperationsClient($options); + } + /** * Constructor. * @@ -392,8 +406,10 @@ public function addAccessConfig(AddAccessConfigInstanceRequest $request, array $ * * @throws ApiException Thrown if the API call fails. */ - public function addResourcePolicies(AddResourcePoliciesInstanceRequest $request, array $callOptions = []): OperationResponse - { + public function addResourcePolicies( + AddResourcePoliciesInstanceRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('AddResourcePolicies', $request, $callOptions)->wait(); } @@ -522,8 +538,10 @@ public function delete(DeleteInstanceRequest $request, array $callOptions = []): * * @throws ApiException Thrown if the API call fails. */ - public function deleteAccessConfig(DeleteAccessConfigInstanceRequest $request, array $callOptions = []): OperationResponse - { + public function deleteAccessConfig( + DeleteAccessConfigInstanceRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('DeleteAccessConfig', $request, $callOptions)->wait(); } @@ -600,8 +618,10 @@ public function get(GetInstanceRequest $request, array $callOptions = []): Insta * * @throws ApiException Thrown if the API call fails. */ - public function getEffectiveFirewalls(GetEffectiveFirewallsInstanceRequest $request, array $callOptions = []): InstancesGetEffectiveFirewallsResponse - { + public function getEffectiveFirewalls( + GetEffectiveFirewallsInstanceRequest $request, + array $callOptions = [] + ): InstancesGetEffectiveFirewallsResponse { return $this->startApiCall('GetEffectiveFirewalls', $request, $callOptions)->wait(); } @@ -626,8 +646,10 @@ public function getEffectiveFirewalls(GetEffectiveFirewallsInstanceRequest $requ * * @throws ApiException Thrown if the API call fails. */ - public function getGuestAttributes(GetGuestAttributesInstanceRequest $request, array $callOptions = []): GuestAttributes - { + public function getGuestAttributes( + GetGuestAttributesInstanceRequest $request, + array $callOptions = [] + ): GuestAttributes { return $this->startApiCall('GetGuestAttributes', $request, $callOptions)->wait(); } @@ -704,8 +726,10 @@ public function getScreenshot(GetScreenshotInstanceRequest $request, array $call * * @throws ApiException Thrown if the API call fails. */ - public function getSerialPortOutput(GetSerialPortOutputInstanceRequest $request, array $callOptions = []): SerialPortOutput - { + public function getSerialPortOutput( + GetSerialPortOutputInstanceRequest $request, + array $callOptions = [] + ): SerialPortOutput { return $this->startApiCall('GetSerialPortOutput', $request, $callOptions)->wait(); } @@ -731,8 +755,10 @@ public function getSerialPortOutput(GetSerialPortOutputInstanceRequest $request, * * @throws ApiException Thrown if the API call fails. */ - public function getShieldedInstanceIdentity(GetShieldedInstanceIdentityInstanceRequest $request, array $callOptions = []): ShieldedInstanceIdentity - { + public function getShieldedInstanceIdentity( + GetShieldedInstanceIdentityInstanceRequest $request, + array $callOptions = [] + ): ShieldedInstanceIdentity { return $this->startApiCall('GetShieldedInstanceIdentity', $request, $callOptions)->wait(); } @@ -835,8 +861,10 @@ public function listReferrers(ListReferrersInstancesRequest $request, array $cal * * @throws ApiException Thrown if the API call fails. */ - public function performMaintenance(PerformMaintenanceInstanceRequest $request, array $callOptions = []): OperationResponse - { + public function performMaintenance( + PerformMaintenanceInstanceRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('PerformMaintenance', $request, $callOptions)->wait(); } @@ -861,8 +889,10 @@ public function performMaintenance(PerformMaintenanceInstanceRequest $request, a * * @throws ApiException Thrown if the API call fails. */ - public function removeResourcePolicies(RemoveResourcePoliciesInstanceRequest $request, array $callOptions = []): OperationResponse - { + public function removeResourcePolicies( + RemoveResourcePoliciesInstanceRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('RemoveResourcePolicies', $request, $callOptions)->wait(); } @@ -887,8 +917,10 @@ public function removeResourcePolicies(RemoveResourcePoliciesInstanceRequest $re * * @throws ApiException Thrown if the API call fails. */ - public function reportHostAsFaulty(ReportHostAsFaultyInstanceRequest $request, array $callOptions = []): OperationResponse - { + public function reportHostAsFaulty( + ReportHostAsFaultyInstanceRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('ReportHostAsFaulty', $request, $callOptions)->wait(); } @@ -965,8 +997,10 @@ public function resume(ResumeInstanceRequest $request, array $callOptions = []): * * @throws ApiException Thrown if the API call fails. */ - public function sendDiagnosticInterrupt(SendDiagnosticInterruptInstanceRequest $request, array $callOptions = []): SendDiagnosticInterruptInstanceResponse - { + public function sendDiagnosticInterrupt( + SendDiagnosticInterruptInstanceRequest $request, + array $callOptions = [] + ): SendDiagnosticInterruptInstanceResponse { return $this->startApiCall('SendDiagnosticInterrupt', $request, $callOptions)->wait(); } @@ -991,8 +1025,10 @@ public function sendDiagnosticInterrupt(SendDiagnosticInterruptInstanceRequest $ * * @throws ApiException Thrown if the API call fails. */ - public function setDeletionProtection(SetDeletionProtectionInstanceRequest $request, array $callOptions = []): OperationResponse - { + public function setDeletionProtection( + SetDeletionProtectionInstanceRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('SetDeletionProtection', $request, $callOptions)->wait(); } @@ -1017,8 +1053,10 @@ public function setDeletionProtection(SetDeletionProtectionInstanceRequest $requ * * @throws ApiException Thrown if the API call fails. */ - public function setDiskAutoDelete(SetDiskAutoDeleteInstanceRequest $request, array $callOptions = []): OperationResponse - { + public function setDiskAutoDelete( + SetDiskAutoDeleteInstanceRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('SetDiskAutoDelete', $request, $callOptions)->wait(); } @@ -1095,8 +1133,10 @@ public function setLabels(SetLabelsInstanceRequest $request, array $callOptions * * @throws ApiException Thrown if the API call fails. */ - public function setMachineResources(SetMachineResourcesInstanceRequest $request, array $callOptions = []): OperationResponse - { + public function setMachineResources( + SetMachineResourcesInstanceRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('SetMachineResources', $request, $callOptions)->wait(); } @@ -1173,8 +1213,10 @@ public function setMetadata(SetMetadataInstanceRequest $request, array $callOpti * * @throws ApiException Thrown if the API call fails. */ - public function setMinCpuPlatform(SetMinCpuPlatformInstanceRequest $request, array $callOptions = []): OperationResponse - { + public function setMinCpuPlatform( + SetMinCpuPlatformInstanceRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('SetMinCpuPlatform', $request, $callOptions)->wait(); } @@ -1251,8 +1293,10 @@ public function setScheduling(SetSchedulingInstanceRequest $request, array $call * * @throws ApiException Thrown if the API call fails. */ - public function setSecurityPolicy(SetSecurityPolicyInstanceRequest $request, array $callOptions = []): OperationResponse - { + public function setSecurityPolicy( + SetSecurityPolicyInstanceRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('SetSecurityPolicy', $request, $callOptions)->wait(); } @@ -1277,8 +1321,10 @@ public function setSecurityPolicy(SetSecurityPolicyInstanceRequest $request, arr * * @throws ApiException Thrown if the API call fails. */ - public function setServiceAccount(SetServiceAccountInstanceRequest $request, array $callOptions = []): OperationResponse - { + public function setServiceAccount( + SetServiceAccountInstanceRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('SetServiceAccount', $request, $callOptions)->wait(); } @@ -1304,8 +1350,10 @@ public function setServiceAccount(SetServiceAccountInstanceRequest $request, arr * * @throws ApiException Thrown if the API call fails. */ - public function setShieldedInstanceIntegrityPolicy(SetShieldedInstanceIntegrityPolicyInstanceRequest $request, array $callOptions = []): OperationResponse - { + public function setShieldedInstanceIntegrityPolicy( + SetShieldedInstanceIntegrityPolicyInstanceRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('SetShieldedInstanceIntegrityPolicy', $request, $callOptions)->wait(); } @@ -1356,8 +1404,10 @@ public function setTags(SetTagsInstanceRequest $request, array $callOptions = [] * * @throws ApiException Thrown if the API call fails. */ - public function simulateMaintenanceEvent(SimulateMaintenanceEventInstanceRequest $request, array $callOptions = []): OperationResponse - { + public function simulateMaintenanceEvent( + SimulateMaintenanceEventInstanceRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('SimulateMaintenanceEvent', $request, $callOptions)->wait(); } @@ -1408,8 +1458,10 @@ public function start(StartInstanceRequest $request, array $callOptions = []): O * * @throws ApiException Thrown if the API call fails. */ - public function startWithEncryptionKey(StartWithEncryptionKeyInstanceRequest $request, array $callOptions = []): OperationResponse - { + public function startWithEncryptionKey( + StartWithEncryptionKeyInstanceRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('StartWithEncryptionKey', $request, $callOptions)->wait(); } @@ -1486,8 +1538,10 @@ public function suspend(SuspendInstanceRequest $request, array $callOptions = [] * * @throws ApiException Thrown if the API call fails. */ - public function testIamPermissions(TestIamPermissionsInstanceRequest $request, array $callOptions = []): TestPermissionsResponse - { + public function testIamPermissions( + TestIamPermissionsInstanceRequest $request, + array $callOptions = [] + ): TestPermissionsResponse { return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); } @@ -1538,8 +1592,10 @@ public function update(UpdateInstanceRequest $request, array $callOptions = []): * * @throws ApiException Thrown if the API call fails. */ - public function updateAccessConfig(UpdateAccessConfigInstanceRequest $request, array $callOptions = []): OperationResponse - { + public function updateAccessConfig( + UpdateAccessConfigInstanceRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('UpdateAccessConfig', $request, $callOptions)->wait(); } @@ -1564,8 +1620,10 @@ public function updateAccessConfig(UpdateAccessConfigInstanceRequest $request, a * * @throws ApiException Thrown if the API call fails. */ - public function updateDisplayDevice(UpdateDisplayDeviceInstanceRequest $request, array $callOptions = []): OperationResponse - { + public function updateDisplayDevice( + UpdateDisplayDeviceInstanceRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('UpdateDisplayDevice', $request, $callOptions)->wait(); } @@ -1590,8 +1648,10 @@ public function updateDisplayDevice(UpdateDisplayDeviceInstanceRequest $request, * * @throws ApiException Thrown if the API call fails. */ - public function updateNetworkInterface(UpdateNetworkInterfaceInstanceRequest $request, array $callOptions = []): OperationResponse - { + public function updateNetworkInterface( + UpdateNetworkInterfaceInstanceRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('UpdateNetworkInterface', $request, $callOptions)->wait(); } @@ -1617,8 +1677,10 @@ public function updateNetworkInterface(UpdateNetworkInterfaceInstanceRequest $re * * @throws ApiException Thrown if the API call fails. */ - public function updateShieldedInstanceConfig(UpdateShieldedInstanceConfigInstanceRequest $request, array $callOptions = []): OperationResponse - { + public function updateShieldedInstanceConfig( + UpdateShieldedInstanceConfigInstanceRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('UpdateShieldedInstanceConfig', $request, $callOptions)->wait(); } } diff --git a/Compute/src/V1/Client/InstantSnapshotsClient.php b/Compute/src/V1/Client/InstantSnapshotsClient.php index 36a4b775c974..57ef583e31ef 100644 --- a/Compute/src/V1/Client/InstantSnapshotsClient.php +++ b/Compute/src/V1/Client/InstantSnapshotsClient.php @@ -1,6 +1,6 @@ __DIR__ . '/../resources/instant_snapshots_rest_client_config.php', ], ], - 'operationsClientClass' => ZoneOperationsClient::class, ]; } @@ -125,9 +123,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -144,10 +140,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getZone', - ], + 'additionalArgumentMethods' => ['getProject', 'getZone'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -175,12 +168,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 ZoneOperationsClient + */ + 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 ZoneOperationsClient($options); + } + /** * Constructor. * @@ -280,8 +294,10 @@ public function __call($method, $args) * * @throws ApiException Thrown if the API call fails. */ - public function aggregatedList(AggregatedListInstantSnapshotsRequest $request, array $callOptions = []): PagedListResponse - { + public function aggregatedList( + AggregatedListInstantSnapshotsRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('AggregatedList', $request, $callOptions); } @@ -488,8 +504,10 @@ public function setLabels(SetLabelsInstantSnapshotRequest $request, array $callO * * @throws ApiException Thrown if the API call fails. */ - public function testIamPermissions(TestIamPermissionsInstantSnapshotRequest $request, array $callOptions = []): TestPermissionsResponse - { + public function testIamPermissions( + TestIamPermissionsInstantSnapshotRequest $request, + array $callOptions = [] + ): TestPermissionsResponse { return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); } } diff --git a/Compute/src/V1/Client/InterconnectAttachmentGroupsClient.php b/Compute/src/V1/Client/InterconnectAttachmentGroupsClient.php index 4e7cabbca295..2fe3faa7d493 100644 --- a/Compute/src/V1/Client/InterconnectAttachmentGroupsClient.php +++ b/Compute/src/V1/Client/InterconnectAttachmentGroupsClient.php @@ -36,7 +36,6 @@ use Google\Cloud\Compute\V1\GetIamPolicyInterconnectAttachmentGroupRequest; use Google\Cloud\Compute\V1\GetInterconnectAttachmentGroupRequest; use Google\Cloud\Compute\V1\GetOperationalStatusInterconnectAttachmentGroupRequest; -use Google\Cloud\Compute\V1\GlobalOperationsClient; use Google\Cloud\Compute\V1\InsertInterconnectAttachmentGroupRequest; use Google\Cloud\Compute\V1\InterconnectAttachmentGroup; use Google\Cloud\Compute\V1\InterconnectAttachmentGroupsGetOperationalStatusResponse; @@ -110,10 +109,10 @@ private static function getClientDefaults() ], 'transportConfig' => [ 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/interconnect_attachment_groups_rest_client_config.php', + 'restClientConfigPath' => + __DIR__ . '/../resources/interconnect_attachment_groups_rest_client_config.php', ], ], - 'operationsClientClass' => GlobalOperationsClient::class, ]; } @@ -126,9 +125,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -145,9 +142,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - ], + 'additionalArgumentMethods' => ['getProject'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -175,12 +170,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 GlobalOperationsClient + */ + 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 GlobalOperationsClient($options); + } + /** * Constructor. * @@ -280,8 +296,10 @@ public function __call($method, $args) * * @throws ApiException Thrown if the API call fails. */ - public function delete(DeleteInterconnectAttachmentGroupRequest $request, array $callOptions = []): OperationResponse - { + public function delete( + DeleteInterconnectAttachmentGroupRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('Delete', $request, $callOptions)->wait(); } @@ -306,8 +324,10 @@ public function delete(DeleteInterconnectAttachmentGroupRequest $request, array * * @throws ApiException Thrown if the API call fails. */ - public function get(GetInterconnectAttachmentGroupRequest $request, array $callOptions = []): InterconnectAttachmentGroup - { + public function get( + GetInterconnectAttachmentGroupRequest $request, + array $callOptions = [] + ): InterconnectAttachmentGroup { return $this->startApiCall('Get', $request, $callOptions)->wait(); } @@ -333,8 +353,10 @@ public function get(GetInterconnectAttachmentGroupRequest $request, array $callO * * @throws ApiException Thrown if the API call fails. */ - public function getIamPolicy(GetIamPolicyInterconnectAttachmentGroupRequest $request, array $callOptions = []): Policy - { + public function getIamPolicy( + GetIamPolicyInterconnectAttachmentGroupRequest $request, + array $callOptions = [] + ): Policy { return $this->startApiCall('GetIamPolicy', $request, $callOptions)->wait(); } @@ -360,8 +382,10 @@ public function getIamPolicy(GetIamPolicyInterconnectAttachmentGroupRequest $req * * @throws ApiException Thrown if the API call fails. */ - public function getOperationalStatus(GetOperationalStatusInterconnectAttachmentGroupRequest $request, array $callOptions = []): InterconnectAttachmentGroupsGetOperationalStatusResponse - { + public function getOperationalStatus( + GetOperationalStatusInterconnectAttachmentGroupRequest $request, + array $callOptions = [] + ): InterconnectAttachmentGroupsGetOperationalStatusResponse { return $this->startApiCall('GetOperationalStatus', $request, $callOptions)->wait(); } @@ -386,8 +410,10 @@ public function getOperationalStatus(GetOperationalStatusInterconnectAttachmentG * * @throws ApiException Thrown if the API call fails. */ - public function insert(InsertInterconnectAttachmentGroupRequest $request, array $callOptions = []): OperationResponse - { + public function insert( + InsertInterconnectAttachmentGroupRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('Insert', $request, $callOptions)->wait(); } @@ -412,8 +438,10 @@ public function insert(InsertInterconnectAttachmentGroupRequest $request, array * * @throws ApiException Thrown if the API call fails. */ - public function list(ListInterconnectAttachmentGroupsRequest $request, array $callOptions = []): InterconnectAttachmentGroupsListResponse - { + public function list( + ListInterconnectAttachmentGroupsRequest $request, + array $callOptions = [] + ): InterconnectAttachmentGroupsListResponse { return $this->startApiCall('List', $request, $callOptions)->wait(); } @@ -465,8 +493,10 @@ public function patch(PatchInterconnectAttachmentGroupRequest $request, array $c * * @throws ApiException Thrown if the API call fails. */ - public function setIamPolicy(SetIamPolicyInterconnectAttachmentGroupRequest $request, array $callOptions = []): Policy - { + public function setIamPolicy( + SetIamPolicyInterconnectAttachmentGroupRequest $request, + array $callOptions = [] + ): Policy { return $this->startApiCall('SetIamPolicy', $request, $callOptions)->wait(); } @@ -492,8 +522,10 @@ public function setIamPolicy(SetIamPolicyInterconnectAttachmentGroupRequest $req * * @throws ApiException Thrown if the API call fails. */ - public function testIamPermissions(TestIamPermissionsInterconnectAttachmentGroupRequest $request, array $callOptions = []): TestPermissionsResponse - { + public function testIamPermissions( + TestIamPermissionsInterconnectAttachmentGroupRequest $request, + array $callOptions = [] + ): TestPermissionsResponse { return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); } } diff --git a/Compute/src/V1/Client/InterconnectAttachmentsClient.php b/Compute/src/V1/Client/InterconnectAttachmentsClient.php index ddcbcc367816..bd4fc6e6af90 100644 --- a/Compute/src/V1/Client/InterconnectAttachmentsClient.php +++ b/Compute/src/V1/Client/InterconnectAttachmentsClient.php @@ -1,6 +1,6 @@ __DIR__ . '/../resources/interconnect_attachments_rest_client_config.php', ], ], - 'operationsClientClass' => RegionOperationsClient::class, ]; } @@ -119,9 +117,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -138,10 +134,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], + 'additionalArgumentMethods' => ['getProject', 'getRegion'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -169,12 +162,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 RegionOperationsClient + */ + 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 RegionOperationsClient($options); + } + /** * Constructor. * @@ -275,8 +289,10 @@ public function __call($method, $args) * * @throws ApiException Thrown if the API call fails. */ - public function aggregatedList(AggregatedListInterconnectAttachmentsRequest $request, array $callOptions = []): PagedListResponse - { + public function aggregatedList( + AggregatedListInterconnectAttachmentsRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('AggregatedList', $request, $callOptions); } @@ -431,8 +447,10 @@ public function patch(PatchInterconnectAttachmentRequest $request, array $callOp * * @throws ApiException Thrown if the API call fails. */ - public function setLabels(SetLabelsInterconnectAttachmentRequest $request, array $callOptions = []): OperationResponse - { + public function setLabels( + SetLabelsInterconnectAttachmentRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('SetLabels', $request, $callOptions)->wait(); } } diff --git a/Compute/src/V1/Client/InterconnectGroupsClient.php b/Compute/src/V1/Client/InterconnectGroupsClient.php index b5a46e86d2cc..5cdcc4fa7586 100644 --- a/Compute/src/V1/Client/InterconnectGroupsClient.php +++ b/Compute/src/V1/Client/InterconnectGroupsClient.php @@ -37,7 +37,6 @@ use Google\Cloud\Compute\V1\GetIamPolicyInterconnectGroupRequest; use Google\Cloud\Compute\V1\GetInterconnectGroupRequest; use Google\Cloud\Compute\V1\GetOperationalStatusInterconnectGroupRequest; -use Google\Cloud\Compute\V1\GlobalOperationsClient; use Google\Cloud\Compute\V1\InsertInterconnectGroupRequest; use Google\Cloud\Compute\V1\InterconnectGroup; use Google\Cloud\Compute\V1\InterconnectGroupsGetOperationalStatusResponse; @@ -115,7 +114,6 @@ private static function getClientDefaults() 'restClientConfigPath' => __DIR__ . '/../resources/interconnect_groups_rest_client_config.php', ], ], - 'operationsClientClass' => GlobalOperationsClient::class, ]; } @@ -128,9 +126,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -147,9 +143,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - ], + 'additionalArgumentMethods' => ['getProject'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -177,12 +171,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 GlobalOperationsClient + */ + 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 GlobalOperationsClient($options); + } + /** * Constructor. * @@ -282,8 +297,10 @@ public function __call($method, $args) * * @throws ApiException Thrown if the API call fails. */ - public function createMembers(CreateMembersInterconnectGroupRequest $request, array $callOptions = []): OperationResponse - { + public function createMembers( + CreateMembersInterconnectGroupRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('CreateMembers', $request, $callOptions)->wait(); } @@ -387,8 +404,10 @@ public function getIamPolicy(GetIamPolicyInterconnectGroupRequest $request, arra * * @throws ApiException Thrown if the API call fails. */ - public function getOperationalStatus(GetOperationalStatusInterconnectGroupRequest $request, array $callOptions = []): InterconnectGroupsGetOperationalStatusResponse - { + public function getOperationalStatus( + GetOperationalStatusInterconnectGroupRequest $request, + array $callOptions = [] + ): InterconnectGroupsGetOperationalStatusResponse { return $this->startApiCall('GetOperationalStatus', $request, $callOptions)->wait(); } @@ -439,8 +458,10 @@ public function insert(InsertInterconnectGroupRequest $request, array $callOptio * * @throws ApiException Thrown if the API call fails. */ - public function list(ListInterconnectGroupsRequest $request, array $callOptions = []): InterconnectGroupsListResponse - { + public function list( + ListInterconnectGroupsRequest $request, + array $callOptions = [] + ): InterconnectGroupsListResponse { return $this->startApiCall('List', $request, $callOptions)->wait(); } @@ -518,8 +539,10 @@ public function setIamPolicy(SetIamPolicyInterconnectGroupRequest $request, arra * * @throws ApiException Thrown if the API call fails. */ - public function testIamPermissions(TestIamPermissionsInterconnectGroupRequest $request, array $callOptions = []): TestPermissionsResponse - { + public function testIamPermissions( + TestIamPermissionsInterconnectGroupRequest $request, + array $callOptions = [] + ): TestPermissionsResponse { return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); } } diff --git a/Compute/src/V1/Client/InterconnectLocationsClient.php b/Compute/src/V1/Client/InterconnectLocationsClient.php index 7636693870e5..bdc2626f134c 100644 --- a/Compute/src/V1/Client/InterconnectLocationsClient.php +++ b/Compute/src/V1/Client/InterconnectLocationsClient.php @@ -1,6 +1,6 @@ [ 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/interconnect_remote_locations_rest_client_config.php', + 'restClientConfigPath' => + __DIR__ . '/../resources/interconnect_remote_locations_rest_client_config.php', ], ], ]; @@ -105,9 +106,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -208,8 +207,10 @@ public function __call($method, $args) * * @throws ApiException Thrown if the API call fails. */ - public function get(GetInterconnectRemoteLocationRequest $request, array $callOptions = []): InterconnectRemoteLocation - { + public function get( + GetInterconnectRemoteLocationRequest $request, + array $callOptions = [] + ): InterconnectRemoteLocation { return $this->startApiCall('Get', $request, $callOptions)->wait(); } diff --git a/Compute/src/V1/Client/InterconnectsClient.php b/Compute/src/V1/Client/InterconnectsClient.php index 36ff68820e23..1582d981ed2e 100644 --- a/Compute/src/V1/Client/InterconnectsClient.php +++ b/Compute/src/V1/Client/InterconnectsClient.php @@ -1,6 +1,6 @@ __DIR__ . '/../resources/interconnects_rest_client_config.php', ], ], - 'operationsClientClass' => GlobalOperationsClient::class, ]; } @@ -123,9 +121,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -142,9 +138,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - ], + 'additionalArgumentMethods' => ['getProject'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -172,12 +166,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 GlobalOperationsClient + */ + 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 GlobalOperationsClient($options); + } + /** * Constructor. * @@ -329,8 +344,10 @@ public function get(GetInterconnectRequest $request, array $callOptions = []): I * * @throws ApiException Thrown if the API call fails. */ - public function getDiagnostics(GetDiagnosticsInterconnectRequest $request, array $callOptions = []): InterconnectsGetDiagnosticsResponse - { + public function getDiagnostics( + GetDiagnosticsInterconnectRequest $request, + array $callOptions = [] + ): InterconnectsGetDiagnosticsResponse { return $this->startApiCall('GetDiagnostics', $request, $callOptions)->wait(); } @@ -355,8 +372,10 @@ public function getDiagnostics(GetDiagnosticsInterconnectRequest $request, array * * @throws ApiException Thrown if the API call fails. */ - public function getMacsecConfig(GetMacsecConfigInterconnectRequest $request, array $callOptions = []): InterconnectsGetMacsecConfigResponse - { + public function getMacsecConfig( + GetMacsecConfigInterconnectRequest $request, + array $callOptions = [] + ): InterconnectsGetMacsecConfigResponse { return $this->startApiCall('GetMacsecConfig', $request, $callOptions)->wait(); } diff --git a/Compute/src/V1/Client/LicenseCodesClient.php b/Compute/src/V1/Client/LicenseCodesClient.php index 22b2d30d3297..3ff91f2c407e 100644 --- a/Compute/src/V1/Client/LicenseCodesClient.php +++ b/Compute/src/V1/Client/LicenseCodesClient.php @@ -1,6 +1,6 @@ startApiCall('TestIamPermissions', $request, $callOptions)->wait(); } } diff --git a/Compute/src/V1/Client/LicensesClient.php b/Compute/src/V1/Client/LicensesClient.php index 04e39b66164f..684d1dd45425 100644 --- a/Compute/src/V1/Client/LicensesClient.php +++ b/Compute/src/V1/Client/LicensesClient.php @@ -1,6 +1,6 @@ __DIR__ . '/../resources/licenses_rest_client_config.php', ], ], - 'operationsClientClass' => GlobalOperationsClient::class, ]; } @@ -123,9 +121,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -142,9 +138,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - ], + 'additionalArgumentMethods' => ['getProject'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -172,12 +166,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 GlobalOperationsClient + */ + 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 GlobalOperationsClient($options); + } + /** * Constructor. * @@ -433,8 +448,10 @@ public function setIamPolicy(SetIamPolicyLicenseRequest $request, array $callOpt * * @throws ApiException Thrown if the API call fails. */ - public function testIamPermissions(TestIamPermissionsLicenseRequest $request, array $callOptions = []): TestPermissionsResponse - { + public function testIamPermissions( + TestIamPermissionsLicenseRequest $request, + array $callOptions = [] + ): TestPermissionsResponse { return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); } diff --git a/Compute/src/V1/Client/MachineImagesClient.php b/Compute/src/V1/Client/MachineImagesClient.php index 4a7c573013be..fea63b81b38a 100644 --- a/Compute/src/V1/Client/MachineImagesClient.php +++ b/Compute/src/V1/Client/MachineImagesClient.php @@ -1,6 +1,6 @@ __DIR__ . '/../resources/machine_images_rest_client_config.php', ], ], - 'operationsClientClass' => GlobalOperationsClient::class, ]; } @@ -123,9 +121,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -142,9 +138,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - ], + 'additionalArgumentMethods' => ['getProject'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -172,12 +166,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 GlobalOperationsClient + */ + 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 GlobalOperationsClient($options); + } + /** * Constructor. * @@ -459,8 +474,10 @@ public function setLabels(SetLabelsMachineImageRequest $request, array $callOpti * * @throws ApiException Thrown if the API call fails. */ - public function testIamPermissions(TestIamPermissionsMachineImageRequest $request, array $callOptions = []): TestPermissionsResponse - { + public function testIamPermissions( + TestIamPermissionsMachineImageRequest $request, + array $callOptions = [] + ): TestPermissionsResponse { return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); } } diff --git a/Compute/src/V1/Client/MachineTypesClient.php b/Compute/src/V1/Client/MachineTypesClient.php index c297e72e922f..f13c2798d442 100644 --- a/Compute/src/V1/Client/MachineTypesClient.php +++ b/Compute/src/V1/Client/MachineTypesClient.php @@ -1,6 +1,6 @@ startApiCall('AggregatedList', $request, $callOptions); } diff --git a/Compute/src/V1/Client/NetworkAttachmentsClient.php b/Compute/src/V1/Client/NetworkAttachmentsClient.php index d843e87831ce..ca42c1fcb5a1 100644 --- a/Compute/src/V1/Client/NetworkAttachmentsClient.php +++ b/Compute/src/V1/Client/NetworkAttachmentsClient.php @@ -1,6 +1,6 @@ __DIR__ . '/../resources/network_attachments_rest_client_config.php', ], ], - 'operationsClientClass' => RegionOperationsClient::class, ]; } @@ -125,9 +123,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -144,10 +140,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], + 'additionalArgumentMethods' => ['getProject', 'getRegion'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -175,12 +168,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 RegionOperationsClient + */ + 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 RegionOperationsClient($options); + } + /** * Constructor. * @@ -280,8 +294,10 @@ public function __call($method, $args) * * @throws ApiException Thrown if the API call fails. */ - public function aggregatedList(AggregatedListNetworkAttachmentsRequest $request, array $callOptions = []): PagedListResponse - { + public function aggregatedList( + AggregatedListNetworkAttachmentsRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('AggregatedList', $request, $callOptions); } @@ -489,8 +505,10 @@ public function setIamPolicy(SetIamPolicyNetworkAttachmentRequest $request, arra * * @throws ApiException Thrown if the API call fails. */ - public function testIamPermissions(TestIamPermissionsNetworkAttachmentRequest $request, array $callOptions = []): TestPermissionsResponse - { + public function testIamPermissions( + TestIamPermissionsNetworkAttachmentRequest $request, + array $callOptions = [] + ): TestPermissionsResponse { return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); } } diff --git a/Compute/src/V1/Client/NetworkEdgeSecurityServicesClient.php b/Compute/src/V1/Client/NetworkEdgeSecurityServicesClient.php index 0167e83fd954..22297277e598 100644 --- a/Compute/src/V1/Client/NetworkEdgeSecurityServicesClient.php +++ b/Compute/src/V1/Client/NetworkEdgeSecurityServicesClient.php @@ -1,6 +1,6 @@ [ 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/network_edge_security_services_rest_client_config.php', + 'restClientConfigPath' => + __DIR__ . '/../resources/network_edge_security_services_rest_client_config.php', ], ], - 'operationsClientClass' => RegionOperationsClient::class, ]; } @@ -115,9 +114,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -134,10 +131,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], + 'additionalArgumentMethods' => ['getProject', 'getRegion'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -165,12 +159,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 RegionOperationsClient + */ + 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 RegionOperationsClient($options); + } + /** * Constructor. * @@ -271,8 +286,10 @@ public function __call($method, $args) * * @throws ApiException Thrown if the API call fails. */ - public function aggregatedList(AggregatedListNetworkEdgeSecurityServicesRequest $request, array $callOptions = []): PagedListResponse - { + public function aggregatedList( + AggregatedListNetworkEdgeSecurityServicesRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('AggregatedList', $request, $callOptions); } @@ -323,8 +340,10 @@ public function delete(DeleteNetworkEdgeSecurityServiceRequest $request, array $ * * @throws ApiException Thrown if the API call fails. */ - public function get(GetNetworkEdgeSecurityServiceRequest $request, array $callOptions = []): NetworkEdgeSecurityService - { + public function get( + GetNetworkEdgeSecurityServiceRequest $request, + array $callOptions = [] + ): NetworkEdgeSecurityService { return $this->startApiCall('Get', $request, $callOptions)->wait(); } diff --git a/Compute/src/V1/Client/NetworkEndpointGroupsClient.php b/Compute/src/V1/Client/NetworkEndpointGroupsClient.php index 2d8460117519..e3a6e4af441c 100644 --- a/Compute/src/V1/Client/NetworkEndpointGroupsClient.php +++ b/Compute/src/V1/Client/NetworkEndpointGroupsClient.php @@ -1,6 +1,6 @@ __DIR__ . '/../resources/network_endpoint_groups_rest_client_config.php', ], ], - 'operationsClientClass' => ZoneOperationsClient::class, ]; } @@ -124,9 +122,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -143,10 +139,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getZone', - ], + 'additionalArgumentMethods' => ['getProject', 'getZone'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -174,12 +167,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 ZoneOperationsClient + */ + 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 ZoneOperationsClient($options); + } + /** * Constructor. * @@ -279,8 +293,10 @@ public function __call($method, $args) * * @throws ApiException Thrown if the API call fails. */ - public function aggregatedList(AggregatedListNetworkEndpointGroupsRequest $request, array $callOptions = []): PagedListResponse - { + public function aggregatedList( + AggregatedListNetworkEndpointGroupsRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('AggregatedList', $request, $callOptions); } @@ -306,8 +322,10 @@ public function aggregatedList(AggregatedListNetworkEndpointGroupsRequest $reque * * @throws ApiException Thrown if the API call fails. */ - public function attachNetworkEndpoints(AttachNetworkEndpointsNetworkEndpointGroupRequest $request, array $callOptions = []): OperationResponse - { + public function attachNetworkEndpoints( + AttachNetworkEndpointsNetworkEndpointGroupRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('AttachNetworkEndpoints', $request, $callOptions)->wait(); } @@ -359,8 +377,10 @@ public function delete(DeleteNetworkEndpointGroupRequest $request, array $callOp * * @throws ApiException Thrown if the API call fails. */ - public function detachNetworkEndpoints(DetachNetworkEndpointsNetworkEndpointGroupRequest $request, array $callOptions = []): OperationResponse - { + public function detachNetworkEndpoints( + DetachNetworkEndpointsNetworkEndpointGroupRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('DetachNetworkEndpoints', $request, $callOptions)->wait(); } @@ -464,8 +484,10 @@ public function list(ListNetworkEndpointGroupsRequest $request, array $callOptio * * @throws ApiException Thrown if the API call fails. */ - public function listNetworkEndpoints(ListNetworkEndpointsNetworkEndpointGroupsRequest $request, array $callOptions = []): PagedListResponse - { + public function listNetworkEndpoints( + ListNetworkEndpointsNetworkEndpointGroupsRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('ListNetworkEndpoints', $request, $callOptions); } @@ -491,8 +513,10 @@ public function listNetworkEndpoints(ListNetworkEndpointsNetworkEndpointGroupsRe * * @throws ApiException Thrown if the API call fails. */ - public function testIamPermissions(TestIamPermissionsNetworkEndpointGroupRequest $request, array $callOptions = []): TestPermissionsResponse - { + public function testIamPermissions( + TestIamPermissionsNetworkEndpointGroupRequest $request, + array $callOptions = [] + ): TestPermissionsResponse { return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); } } diff --git a/Compute/src/V1/Client/NetworkFirewallPoliciesClient.php b/Compute/src/V1/Client/NetworkFirewallPoliciesClient.php index e98509262fef..ecada84eb938 100644 --- a/Compute/src/V1/Client/NetworkFirewallPoliciesClient.php +++ b/Compute/src/V1/Client/NetworkFirewallPoliciesClient.php @@ -1,6 +1,6 @@ [ 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/network_firewall_policies_rest_client_config.php', + 'restClientConfigPath' => + __DIR__ . '/../resources/network_firewall_policies_rest_client_config.php', ], ], - 'operationsClientClass' => GlobalOperationsClient::class, ]; } @@ -151,9 +150,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -170,9 +167,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - ], + 'additionalArgumentMethods' => ['getProject'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -200,12 +195,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 GlobalOperationsClient + */ + 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 GlobalOperationsClient($options); + } + /** * Constructor. * @@ -306,8 +322,10 @@ public function __call($method, $args) * * @throws ApiException Thrown if the API call fails. */ - public function addAssociation(AddAssociationNetworkFirewallPolicyRequest $request, array $callOptions = []): OperationResponse - { + public function addAssociation( + AddAssociationNetworkFirewallPolicyRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('AddAssociation', $request, $callOptions)->wait(); } @@ -333,8 +351,10 @@ public function addAssociation(AddAssociationNetworkFirewallPolicyRequest $reque * * @throws ApiException Thrown if the API call fails. */ - public function addPacketMirroringRule(AddPacketMirroringRuleNetworkFirewallPolicyRequest $request, array $callOptions = []): OperationResponse - { + public function addPacketMirroringRule( + AddPacketMirroringRuleNetworkFirewallPolicyRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('AddPacketMirroringRule', $request, $callOptions)->wait(); } @@ -386,8 +406,10 @@ public function addRule(AddRuleNetworkFirewallPolicyRequest $request, array $cal * * @throws ApiException Thrown if the API call fails. */ - public function aggregatedList(AggregatedListNetworkFirewallPoliciesRequest $request, array $callOptions = []): PagedListResponse - { + public function aggregatedList( + AggregatedListNetworkFirewallPoliciesRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('AggregatedList', $request, $callOptions); } @@ -412,8 +434,10 @@ public function aggregatedList(AggregatedListNetworkFirewallPoliciesRequest $req * * @throws ApiException Thrown if the API call fails. */ - public function cloneRules(CloneRulesNetworkFirewallPolicyRequest $request, array $callOptions = []): OperationResponse - { + public function cloneRules( + CloneRulesNetworkFirewallPolicyRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('CloneRules', $request, $callOptions)->wait(); } @@ -491,8 +515,10 @@ public function get(GetNetworkFirewallPolicyRequest $request, array $callOptions * * @throws ApiException Thrown if the API call fails. */ - public function getAssociation(GetAssociationNetworkFirewallPolicyRequest $request, array $callOptions = []): FirewallPolicyAssociation - { + public function getAssociation( + GetAssociationNetworkFirewallPolicyRequest $request, + array $callOptions = [] + ): FirewallPolicyAssociation { return $this->startApiCall('GetAssociation', $request, $callOptions)->wait(); } @@ -544,8 +570,10 @@ public function getIamPolicy(GetIamPolicyNetworkFirewallPolicyRequest $request, * * @throws ApiException Thrown if the API call fails. */ - public function getPacketMirroringRule(GetPacketMirroringRuleNetworkFirewallPolicyRequest $request, array $callOptions = []): FirewallPolicyRule - { + public function getPacketMirroringRule( + GetPacketMirroringRuleNetworkFirewallPolicyRequest $request, + array $callOptions = [] + ): FirewallPolicyRule { return $this->startApiCall('GetPacketMirroringRule', $request, $callOptions)->wait(); } @@ -675,8 +703,10 @@ public function patch(PatchNetworkFirewallPolicyRequest $request, array $callOpt * * @throws ApiException Thrown if the API call fails. */ - public function patchPacketMirroringRule(PatchPacketMirroringRuleNetworkFirewallPolicyRequest $request, array $callOptions = []): OperationResponse - { + public function patchPacketMirroringRule( + PatchPacketMirroringRuleNetworkFirewallPolicyRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('PatchPacketMirroringRule', $request, $callOptions)->wait(); } @@ -701,8 +731,10 @@ public function patchPacketMirroringRule(PatchPacketMirroringRuleNetworkFirewall * * @throws ApiException Thrown if the API call fails. */ - public function patchRule(PatchRuleNetworkFirewallPolicyRequest $request, array $callOptions = []): OperationResponse - { + public function patchRule( + PatchRuleNetworkFirewallPolicyRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('PatchRule', $request, $callOptions)->wait(); } @@ -728,8 +760,10 @@ public function patchRule(PatchRuleNetworkFirewallPolicyRequest $request, array * * @throws ApiException Thrown if the API call fails. */ - public function removeAssociation(RemoveAssociationNetworkFirewallPolicyRequest $request, array $callOptions = []): OperationResponse - { + public function removeAssociation( + RemoveAssociationNetworkFirewallPolicyRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('RemoveAssociation', $request, $callOptions)->wait(); } @@ -755,8 +789,10 @@ public function removeAssociation(RemoveAssociationNetworkFirewallPolicyRequest * * @throws ApiException Thrown if the API call fails. */ - public function removePacketMirroringRule(RemovePacketMirroringRuleNetworkFirewallPolicyRequest $request, array $callOptions = []): OperationResponse - { + public function removePacketMirroringRule( + RemovePacketMirroringRuleNetworkFirewallPolicyRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('RemovePacketMirroringRule', $request, $callOptions)->wait(); } @@ -781,8 +817,10 @@ public function removePacketMirroringRule(RemovePacketMirroringRuleNetworkFirewa * * @throws ApiException Thrown if the API call fails. */ - public function removeRule(RemoveRuleNetworkFirewallPolicyRequest $request, array $callOptions = []): OperationResponse - { + public function removeRule( + RemoveRuleNetworkFirewallPolicyRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('RemoveRule', $request, $callOptions)->wait(); } @@ -834,8 +872,10 @@ public function setIamPolicy(SetIamPolicyNetworkFirewallPolicyRequest $request, * * @throws ApiException Thrown if the API call fails. */ - public function testIamPermissions(TestIamPermissionsNetworkFirewallPolicyRequest $request, array $callOptions = []): TestPermissionsResponse - { + public function testIamPermissions( + TestIamPermissionsNetworkFirewallPolicyRequest $request, + array $callOptions = [] + ): TestPermissionsResponse { return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); } } diff --git a/Compute/src/V1/Client/NetworkProfilesClient.php b/Compute/src/V1/Client/NetworkProfilesClient.php index 461829d76a74..ec01e0d45f99 100644 --- a/Compute/src/V1/Client/NetworkProfilesClient.php +++ b/Compute/src/V1/Client/NetworkProfilesClient.php @@ -1,6 +1,6 @@ __DIR__ . '/../resources/networks_rest_client_config.php', ], ], - 'operationsClientClass' => GlobalOperationsClient::class, ]; } @@ -130,9 +128,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -149,9 +145,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - ], + 'additionalArgumentMethods' => ['getProject'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -179,12 +173,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 GlobalOperationsClient + */ + 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 GlobalOperationsClient($options); + } + /** * Constructor. * @@ -362,8 +377,10 @@ public function get(GetNetworkRequest $request, array $callOptions = []): Networ * * @throws ApiException Thrown if the API call fails. */ - public function getEffectiveFirewalls(GetEffectiveFirewallsNetworkRequest $request, array $callOptions = []): NetworksGetEffectiveFirewallsResponse - { + public function getEffectiveFirewalls( + GetEffectiveFirewallsNetworkRequest $request, + array $callOptions = [] + ): NetworksGetEffectiveFirewallsResponse { return $this->startApiCall('GetEffectiveFirewalls', $request, $callOptions)->wait(); } @@ -440,8 +457,10 @@ public function list(ListNetworksRequest $request, array $callOptions = []): Pag * * @throws ApiException Thrown if the API call fails. */ - public function listPeeringRoutes(ListPeeringRoutesNetworksRequest $request, array $callOptions = []): PagedListResponse - { + public function listPeeringRoutes( + ListPeeringRoutesNetworksRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('ListPeeringRoutes', $request, $callOptions); } @@ -518,8 +537,10 @@ public function removePeering(RemovePeeringNetworkRequest $request, array $callO * * @throws ApiException Thrown if the API call fails. */ - public function requestRemovePeering(RequestRemovePeeringNetworkRequest $request, array $callOptions = []): OperationResponse - { + public function requestRemovePeering( + RequestRemovePeeringNetworkRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('RequestRemovePeering', $request, $callOptions)->wait(); } @@ -544,8 +565,10 @@ public function requestRemovePeering(RequestRemovePeeringNetworkRequest $request * * @throws ApiException Thrown if the API call fails. */ - public function switchToCustomMode(SwitchToCustomModeNetworkRequest $request, array $callOptions = []): OperationResponse - { + public function switchToCustomMode( + SwitchToCustomModeNetworkRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('SwitchToCustomMode', $request, $callOptions)->wait(); } diff --git a/Compute/src/V1/Client/NodeGroupsClient.php b/Compute/src/V1/Client/NodeGroupsClient.php index 31c389438807..29cb0383a92a 100644 --- a/Compute/src/V1/Client/NodeGroupsClient.php +++ b/Compute/src/V1/Client/NodeGroupsClient.php @@ -1,6 +1,6 @@ __DIR__ . '/../resources/node_groups_rest_client_config.php', ], ], - 'operationsClientClass' => ZoneOperationsClient::class, ]; } @@ -137,9 +135,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -156,10 +152,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getZone', - ], + 'additionalArgumentMethods' => ['getProject', 'getZone'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -187,12 +180,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 ZoneOperationsClient + */ + 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 ZoneOperationsClient($options); + } + /** * Constructor. * @@ -552,8 +566,10 @@ public function patch(PatchNodeGroupRequest $request, array $callOptions = []): * * @throws ApiException Thrown if the API call fails. */ - public function performMaintenance(PerformMaintenanceNodeGroupRequest $request, array $callOptions = []): OperationResponse - { + public function performMaintenance( + PerformMaintenanceNodeGroupRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('PerformMaintenance', $request, $callOptions)->wait(); } @@ -604,8 +620,10 @@ public function setIamPolicy(SetIamPolicyNodeGroupRequest $request, array $callO * * @throws ApiException Thrown if the API call fails. */ - public function setNodeTemplate(SetNodeTemplateNodeGroupRequest $request, array $callOptions = []): OperationResponse - { + public function setNodeTemplate( + SetNodeTemplateNodeGroupRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('SetNodeTemplate', $request, $callOptions)->wait(); } @@ -630,8 +648,10 @@ public function setNodeTemplate(SetNodeTemplateNodeGroupRequest $request, array * * @throws ApiException Thrown if the API call fails. */ - public function simulateMaintenanceEvent(SimulateMaintenanceEventNodeGroupRequest $request, array $callOptions = []): OperationResponse - { + public function simulateMaintenanceEvent( + SimulateMaintenanceEventNodeGroupRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('SimulateMaintenanceEvent', $request, $callOptions)->wait(); } @@ -656,8 +676,10 @@ public function simulateMaintenanceEvent(SimulateMaintenanceEventNodeGroupReques * * @throws ApiException Thrown if the API call fails. */ - public function testIamPermissions(TestIamPermissionsNodeGroupRequest $request, array $callOptions = []): TestPermissionsResponse - { + public function testIamPermissions( + TestIamPermissionsNodeGroupRequest $request, + array $callOptions = [] + ): TestPermissionsResponse { return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); } } diff --git a/Compute/src/V1/Client/NodeTemplatesClient.php b/Compute/src/V1/Client/NodeTemplatesClient.php index aae5f43a42c0..3cf70cfcf32a 100644 --- a/Compute/src/V1/Client/NodeTemplatesClient.php +++ b/Compute/src/V1/Client/NodeTemplatesClient.php @@ -1,6 +1,6 @@ __DIR__ . '/../resources/node_templates_rest_client_config.php', ], ], - 'operationsClientClass' => RegionOperationsClient::class, ]; } @@ -123,9 +121,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -142,10 +138,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], + 'additionalArgumentMethods' => ['getProject', 'getRegion'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -173,12 +166,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 RegionOperationsClient + */ + 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 RegionOperationsClient($options); + } + /** * Constructor. * @@ -278,8 +292,10 @@ public function __call($method, $args) * * @throws ApiException Thrown if the API call fails. */ - public function aggregatedList(AggregatedListNodeTemplatesRequest $request, array $callOptions = []): PagedListResponse - { + public function aggregatedList( + AggregatedListNodeTemplatesRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('AggregatedList', $request, $callOptions); } @@ -460,8 +476,10 @@ public function setIamPolicy(SetIamPolicyNodeTemplateRequest $request, array $ca * * @throws ApiException Thrown if the API call fails. */ - public function testIamPermissions(TestIamPermissionsNodeTemplateRequest $request, array $callOptions = []): TestPermissionsResponse - { + public function testIamPermissions( + TestIamPermissionsNodeTemplateRequest $request, + array $callOptions = [] + ): TestPermissionsResponse { return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); } } diff --git a/Compute/src/V1/Client/NodeTypesClient.php b/Compute/src/V1/Client/NodeTypesClient.php index ba257d32ada4..908ad5a38daf 100644 --- a/Compute/src/V1/Client/NodeTypesClient.php +++ b/Compute/src/V1/Client/NodeTypesClient.php @@ -1,6 +1,6 @@ __DIR__ . '/../resources/packet_mirrorings_rest_client_config.php', ], ], - 'operationsClientClass' => RegionOperationsClient::class, ]; } @@ -120,9 +118,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -139,10 +135,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], + 'additionalArgumentMethods' => ['getProject', 'getRegion'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -170,12 +163,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 RegionOperationsClient + */ + 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 RegionOperationsClient($options); + } + /** * Constructor. * @@ -275,8 +289,10 @@ public function __call($method, $args) * * @throws ApiException Thrown if the API call fails. */ - public function aggregatedList(AggregatedListPacketMirroringsRequest $request, array $callOptions = []): PagedListResponse - { + public function aggregatedList( + AggregatedListPacketMirroringsRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('AggregatedList', $request, $callOptions); } @@ -431,8 +447,10 @@ public function patch(PatchPacketMirroringRequest $request, array $callOptions = * * @throws ApiException Thrown if the API call fails. */ - public function testIamPermissions(TestIamPermissionsPacketMirroringRequest $request, array $callOptions = []): TestPermissionsResponse - { + public function testIamPermissions( + TestIamPermissionsPacketMirroringRequest $request, + array $callOptions = [] + ): TestPermissionsResponse { return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); } } diff --git a/Compute/src/V1/Client/ProjectsClient.php b/Compute/src/V1/Client/ProjectsClient.php index 42db2538f6df..8fa0084fc965 100644 --- a/Compute/src/V1/Client/ProjectsClient.php +++ b/Compute/src/V1/Client/ProjectsClient.php @@ -1,6 +1,6 @@ __DIR__ . '/../resources/projects_rest_client_config.php', ], ], - 'operationsClientClass' => GlobalOperationsClient::class, ]; } @@ -133,9 +131,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -152,9 +148,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - ], + 'additionalArgumentMethods' => ['getProject'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -182,12 +176,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 GlobalOperationsClient + */ + 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 GlobalOperationsClient($options); + } + /** * Constructor. * @@ -313,8 +328,10 @@ public function disableXpnHost(DisableXpnHostProjectRequest $request, array $cal * * @throws ApiException Thrown if the API call fails. */ - public function disableXpnResource(DisableXpnResourceProjectRequest $request, array $callOptions = []): OperationResponse - { + public function disableXpnResource( + DisableXpnResourceProjectRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('DisableXpnResource', $request, $callOptions)->wait(); } @@ -365,8 +382,10 @@ public function enableXpnHost(EnableXpnHostProjectRequest $request, array $callO * * @throws ApiException Thrown if the API call fails. */ - public function enableXpnResource(EnableXpnResourceProjectRequest $request, array $callOptions = []): OperationResponse - { + public function enableXpnResource( + EnableXpnResourceProjectRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('EnableXpnResource', $request, $callOptions)->wait(); } @@ -501,7 +520,7 @@ public function moveDisk(MoveDiskProjectRequest $request, array $callOptions = [ } /** - * Moves an instance and its attached persistent disks from one zone to another. *Note*: Moving VMs or disks by using this method might cause unexpected behavior. For more information, see the [known issue](/compute/docs/troubleshooting/known-issues#moving_vms_or_disks_using_the_moveinstance_api_or_the_causes_unexpected_behavior). [Deprecated] This method is deprecated. See [moving instance across zones](https://cloud.google.com/compute/docs/instances/moving-instance-across-zones) instead. + * Moves an instance and its attached persistent disks from one zone to another. *Note*: Moving VMs or disks by using this method might cause unexpected behavior. For more information, see the [known issue](/compute/docs/troubleshooting/known-issues#moving_vms_or_disks_using_the_moveinstance_api_or_the_causes_unexpected_behavior). [Deprecated] This method is deprecated. See [moving instance across zones](/compute/docs/instances/moving-instance-across-zones) instead. * * The async variant is {@see ProjectsClient::moveInstanceAsync()} . * @@ -547,8 +566,10 @@ public function moveInstance(MoveInstanceProjectRequest $request, array $callOpt * * @throws ApiException Thrown if the API call fails. */ - public function setCloudArmorTier(SetCloudArmorTierProjectRequest $request, array $callOptions = []): OperationResponse - { + public function setCloudArmorTier( + SetCloudArmorTierProjectRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('SetCloudArmorTier', $request, $callOptions)->wait(); } @@ -573,8 +594,10 @@ public function setCloudArmorTier(SetCloudArmorTierProjectRequest $request, arra * * @throws ApiException Thrown if the API call fails. */ - public function setCommonInstanceMetadata(SetCommonInstanceMetadataProjectRequest $request, array $callOptions = []): OperationResponse - { + public function setCommonInstanceMetadata( + SetCommonInstanceMetadataProjectRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('SetCommonInstanceMetadata', $request, $callOptions)->wait(); } @@ -599,8 +622,10 @@ public function setCommonInstanceMetadata(SetCommonInstanceMetadataProjectReques * * @throws ApiException Thrown if the API call fails. */ - public function setDefaultNetworkTier(SetDefaultNetworkTierProjectRequest $request, array $callOptions = []): OperationResponse - { + public function setDefaultNetworkTier( + SetDefaultNetworkTierProjectRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('SetDefaultNetworkTier', $request, $callOptions)->wait(); } @@ -625,8 +650,10 @@ public function setDefaultNetworkTier(SetDefaultNetworkTierProjectRequest $reque * * @throws ApiException Thrown if the API call fails. */ - public function setUsageExportBucket(SetUsageExportBucketProjectRequest $request, array $callOptions = []): OperationResponse - { + public function setUsageExportBucket( + SetUsageExportBucketProjectRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('SetUsageExportBucket', $request, $callOptions)->wait(); } } diff --git a/Compute/src/V1/Client/PublicAdvertisedPrefixesClient.php b/Compute/src/V1/Client/PublicAdvertisedPrefixesClient.php index 658004beca59..80dcdc0eeb37 100644 --- a/Compute/src/V1/Client/PublicAdvertisedPrefixesClient.php +++ b/Compute/src/V1/Client/PublicAdvertisedPrefixesClient.php @@ -1,6 +1,6 @@ [ 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/public_advertised_prefixes_rest_client_config.php', + 'restClientConfigPath' => + __DIR__ . '/../resources/public_advertised_prefixes_rest_client_config.php', ], ], - 'operationsClientClass' => GlobalOperationsClient::class, ]; } @@ -119,9 +118,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -138,9 +135,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - ], + 'additionalArgumentMethods' => ['getProject'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -168,12 +163,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 GlobalOperationsClient + */ + 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 GlobalOperationsClient($options); + } + /** * Constructor. * @@ -273,8 +289,10 @@ public function __call($method, $args) * * @throws ApiException Thrown if the API call fails. */ - public function announce(AnnouncePublicAdvertisedPrefixeRequest $request, array $callOptions = []): OperationResponse - { + public function announce( + AnnouncePublicAdvertisedPrefixeRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('Announce', $request, $callOptions)->wait(); } @@ -429,8 +447,10 @@ public function patch(PatchPublicAdvertisedPrefixeRequest $request, array $callO * * @throws ApiException Thrown if the API call fails. */ - public function withdraw(WithdrawPublicAdvertisedPrefixeRequest $request, array $callOptions = []): OperationResponse - { + public function withdraw( + WithdrawPublicAdvertisedPrefixeRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('Withdraw', $request, $callOptions)->wait(); } } diff --git a/Compute/src/V1/Client/PublicDelegatedPrefixesClient.php b/Compute/src/V1/Client/PublicDelegatedPrefixesClient.php index eadd762491cc..d147a971015c 100644 --- a/Compute/src/V1/Client/PublicDelegatedPrefixesClient.php +++ b/Compute/src/V1/Client/PublicDelegatedPrefixesClient.php @@ -1,6 +1,6 @@ [ 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/public_delegated_prefixes_rest_client_config.php', + 'restClientConfigPath' => + __DIR__ . '/../resources/public_delegated_prefixes_rest_client_config.php', ], ], - 'operationsClientClass' => RegionOperationsClient::class, ]; } @@ -121,9 +120,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -140,10 +137,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], + 'additionalArgumentMethods' => ['getProject', 'getRegion'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -171,12 +165,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 RegionOperationsClient + */ + 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 RegionOperationsClient($options); + } + /** * Constructor. * @@ -277,8 +292,10 @@ public function __call($method, $args) * * @throws ApiException Thrown if the API call fails. */ - public function aggregatedList(AggregatedListPublicDelegatedPrefixesRequest $request, array $callOptions = []): PagedListResponse - { + public function aggregatedList( + AggregatedListPublicDelegatedPrefixesRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('AggregatedList', $request, $callOptions); } diff --git a/Compute/src/V1/Client/RegionAutoscalersClient.php b/Compute/src/V1/Client/RegionAutoscalersClient.php index a989649b0f2b..590f48d5634a 100644 --- a/Compute/src/V1/Client/RegionAutoscalersClient.php +++ b/Compute/src/V1/Client/RegionAutoscalersClient.php @@ -1,6 +1,6 @@ __DIR__ . '/../resources/region_autoscalers_rest_client_config.php', ], ], - 'operationsClientClass' => RegionOperationsClient::class, ]; } @@ -117,9 +115,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -136,10 +132,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], + 'additionalArgumentMethods' => ['getProject', 'getRegion'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -167,12 +160,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 RegionOperationsClient + */ + 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 RegionOperationsClient($options); + } + /** * Constructor. * diff --git a/Compute/src/V1/Client/RegionBackendServicesClient.php b/Compute/src/V1/Client/RegionBackendServicesClient.php index f3e78c2a18a0..8c8301f5d3ef 100644 --- a/Compute/src/V1/Client/RegionBackendServicesClient.php +++ b/Compute/src/V1/Client/RegionBackendServicesClient.php @@ -1,6 +1,6 @@ __DIR__ . '/../resources/region_backend_services_rest_client_config.php', ], ], - 'operationsClientClass' => RegionOperationsClient::class, ]; } @@ -132,9 +130,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -151,10 +147,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], + 'additionalArgumentMethods' => ['getProject', 'getRegion'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -182,12 +175,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 RegionOperationsClient + */ + 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 RegionOperationsClient($options); + } + /** * Constructor. * @@ -339,8 +353,10 @@ public function get(GetRegionBackendServiceRequest $request, array $callOptions * * @throws ApiException Thrown if the API call fails. */ - public function getHealth(GetHealthRegionBackendServiceRequest $request, array $callOptions = []): BackendServiceGroupHealth - { + public function getHealth( + GetHealthRegionBackendServiceRequest $request, + array $callOptions = [] + ): BackendServiceGroupHealth { return $this->startApiCall('GetHealth', $request, $callOptions)->wait(); } @@ -443,8 +459,10 @@ public function list(ListRegionBackendServicesRequest $request, array $callOptio * * @throws ApiException Thrown if the API call fails. */ - public function listUsable(ListUsableRegionBackendServicesRequest $request, array $callOptions = []): PagedListResponse - { + public function listUsable( + ListUsableRegionBackendServicesRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('ListUsable', $request, $callOptions); } @@ -522,8 +540,10 @@ public function setIamPolicy(SetIamPolicyRegionBackendServiceRequest $request, a * * @throws ApiException Thrown if the API call fails. */ - public function setSecurityPolicy(SetSecurityPolicyRegionBackendServiceRequest $request, array $callOptions = []): OperationResponse - { + public function setSecurityPolicy( + SetSecurityPolicyRegionBackendServiceRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('SetSecurityPolicy', $request, $callOptions)->wait(); } @@ -549,8 +569,10 @@ public function setSecurityPolicy(SetSecurityPolicyRegionBackendServiceRequest $ * * @throws ApiException Thrown if the API call fails. */ - public function testIamPermissions(TestIamPermissionsRegionBackendServiceRequest $request, array $callOptions = []): TestPermissionsResponse - { + public function testIamPermissions( + TestIamPermissionsRegionBackendServiceRequest $request, + array $callOptions = [] + ): TestPermissionsResponse { return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); } diff --git a/Compute/src/V1/Client/RegionCommitmentsClient.php b/Compute/src/V1/Client/RegionCommitmentsClient.php index 34571e7f3baf..52a28be8e08e 100644 --- a/Compute/src/V1/Client/RegionCommitmentsClient.php +++ b/Compute/src/V1/Client/RegionCommitmentsClient.php @@ -1,6 +1,6 @@ __DIR__ . '/../resources/region_commitments_rest_client_config.php', ], ], - 'operationsClientClass' => RegionOperationsClient::class, ]; } @@ -115,9 +113,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -134,10 +130,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], + 'additionalArgumentMethods' => ['getProject', 'getRegion'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -165,12 +158,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 RegionOperationsClient + */ + 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 RegionOperationsClient($options); + } + /** * Constructor. * @@ -270,8 +284,10 @@ public function __call($method, $args) * * @throws ApiException Thrown if the API call fails. */ - public function aggregatedList(AggregatedListRegionCommitmentsRequest $request, array $callOptions = []): PagedListResponse - { + public function aggregatedList( + AggregatedListRegionCommitmentsRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('AggregatedList', $request, $callOptions); } diff --git a/Compute/src/V1/Client/RegionDiskTypesClient.php b/Compute/src/V1/Client/RegionDiskTypesClient.php index 1cb3b152bdd4..1df8ef735cab 100644 --- a/Compute/src/V1/Client/RegionDiskTypesClient.php +++ b/Compute/src/V1/Client/RegionDiskTypesClient.php @@ -1,6 +1,6 @@ __DIR__ . '/../resources/region_disks_rest_client_config.php', ], ], - 'operationsClientClass' => RegionOperationsClient::class, ]; } @@ -141,9 +139,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -160,10 +156,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], + 'additionalArgumentMethods' => ['getProject', 'getRegion'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -191,12 +184,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 RegionOperationsClient + */ + 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 RegionOperationsClient($options); + } + /** * Constructor. * @@ -296,8 +310,10 @@ public function __call($method, $args) * * @throws ApiException Thrown if the API call fails. */ - public function addResourcePolicies(AddResourcePoliciesRegionDiskRequest $request, array $callOptions = []): OperationResponse - { + public function addResourcePolicies( + AddResourcePoliciesRegionDiskRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('AddResourcePolicies', $request, $callOptions)->wait(); } @@ -504,8 +520,10 @@ public function list(ListRegionDisksRequest $request, array $callOptions = []): * * @throws ApiException Thrown if the API call fails. */ - public function removeResourcePolicies(RemoveResourcePoliciesRegionDiskRequest $request, array $callOptions = []): OperationResponse - { + public function removeResourcePolicies( + RemoveResourcePoliciesRegionDiskRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('RemoveResourcePolicies', $request, $callOptions)->wait(); } @@ -608,8 +626,10 @@ public function setLabels(SetLabelsRegionDiskRequest $request, array $callOption * * @throws ApiException Thrown if the API call fails. */ - public function startAsyncReplication(StartAsyncReplicationRegionDiskRequest $request, array $callOptions = []): OperationResponse - { + public function startAsyncReplication( + StartAsyncReplicationRegionDiskRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('StartAsyncReplication', $request, $callOptions)->wait(); } @@ -634,8 +654,10 @@ public function startAsyncReplication(StartAsyncReplicationRegionDiskRequest $re * * @throws ApiException Thrown if the API call fails. */ - public function stopAsyncReplication(StopAsyncReplicationRegionDiskRequest $request, array $callOptions = []): OperationResponse - { + public function stopAsyncReplication( + StopAsyncReplicationRegionDiskRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('StopAsyncReplication', $request, $callOptions)->wait(); } @@ -661,8 +683,10 @@ public function stopAsyncReplication(StopAsyncReplicationRegionDiskRequest $requ * * @throws ApiException Thrown if the API call fails. */ - public function stopGroupAsyncReplication(StopGroupAsyncReplicationRegionDiskRequest $request, array $callOptions = []): OperationResponse - { + public function stopGroupAsyncReplication( + StopGroupAsyncReplicationRegionDiskRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('StopGroupAsyncReplication', $request, $callOptions)->wait(); } @@ -687,8 +711,10 @@ public function stopGroupAsyncReplication(StopGroupAsyncReplicationRegionDiskReq * * @throws ApiException Thrown if the API call fails. */ - public function testIamPermissions(TestIamPermissionsRegionDiskRequest $request, array $callOptions = []): TestPermissionsResponse - { + public function testIamPermissions( + TestIamPermissionsRegionDiskRequest $request, + array $callOptions = [] + ): TestPermissionsResponse { return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); } diff --git a/Compute/src/V1/Client/RegionHealthCheckServicesClient.php b/Compute/src/V1/Client/RegionHealthCheckServicesClient.php index aa72e226aa52..8c4459d6d7e7 100644 --- a/Compute/src/V1/Client/RegionHealthCheckServicesClient.php +++ b/Compute/src/V1/Client/RegionHealthCheckServicesClient.php @@ -1,6 +1,6 @@ [ 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/region_health_check_services_rest_client_config.php', + 'restClientConfigPath' => + __DIR__ . '/../resources/region_health_check_services_rest_client_config.php', ], ], - 'operationsClientClass' => RegionOperationsClient::class, ]; } @@ -115,9 +114,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -134,10 +131,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], + 'additionalArgumentMethods' => ['getProject', 'getRegion'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -165,12 +159,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 RegionOperationsClient + */ + 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 RegionOperationsClient($options); + } + /** * Constructor. * diff --git a/Compute/src/V1/Client/RegionHealthChecksClient.php b/Compute/src/V1/Client/RegionHealthChecksClient.php index 6860195b99e9..8a034084684d 100644 --- a/Compute/src/V1/Client/RegionHealthChecksClient.php +++ b/Compute/src/V1/Client/RegionHealthChecksClient.php @@ -1,6 +1,6 @@ __DIR__ . '/../resources/region_health_checks_rest_client_config.php', ], ], - 'operationsClientClass' => RegionOperationsClient::class, ]; } @@ -117,9 +115,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -136,10 +132,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], + 'additionalArgumentMethods' => ['getProject', 'getRegion'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -167,12 +160,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 RegionOperationsClient + */ + 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 RegionOperationsClient($options); + } + /** * Constructor. * diff --git a/Compute/src/V1/Client/RegionInstanceGroupManagersClient.php b/Compute/src/V1/Client/RegionInstanceGroupManagersClient.php index 8b2bfac7e138..9d2d73e4018d 100644 --- a/Compute/src/V1/Client/RegionInstanceGroupManagersClient.php +++ b/Compute/src/V1/Client/RegionInstanceGroupManagersClient.php @@ -1,6 +1,6 @@ [ 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/region_instance_group_managers_rest_client_config.php', + 'restClientConfigPath' => + __DIR__ . '/../resources/region_instance_group_managers_rest_client_config.php', ], ], - 'operationsClientClass' => RegionOperationsClient::class, ]; } @@ -151,9 +150,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -170,10 +167,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], + 'additionalArgumentMethods' => ['getProject', 'getRegion'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -201,12 +195,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 RegionOperationsClient + */ + 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 RegionOperationsClient($options); + } + /** * Constructor. * @@ -307,8 +322,10 @@ public function __call($method, $args) * * @throws ApiException Thrown if the API call fails. */ - public function abandonInstances(AbandonInstancesRegionInstanceGroupManagerRequest $request, array $callOptions = []): OperationResponse - { + public function abandonInstances( + AbandonInstancesRegionInstanceGroupManagerRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('AbandonInstances', $request, $callOptions)->wait(); } @@ -334,8 +351,10 @@ public function abandonInstances(AbandonInstancesRegionInstanceGroupManagerReque * * @throws ApiException Thrown if the API call fails. */ - public function applyUpdatesToInstances(ApplyUpdatesToInstancesRegionInstanceGroupManagerRequest $request, array $callOptions = []): OperationResponse - { + public function applyUpdatesToInstances( + ApplyUpdatesToInstancesRegionInstanceGroupManagerRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('ApplyUpdatesToInstances', $request, $callOptions)->wait(); } @@ -361,8 +380,10 @@ public function applyUpdatesToInstances(ApplyUpdatesToInstancesRegionInstanceGro * * @throws ApiException Thrown if the API call fails. */ - public function createInstances(CreateInstancesRegionInstanceGroupManagerRequest $request, array $callOptions = []): OperationResponse - { + public function createInstances( + CreateInstancesRegionInstanceGroupManagerRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('CreateInstances', $request, $callOptions)->wait(); } @@ -414,8 +435,10 @@ public function delete(DeleteRegionInstanceGroupManagerRequest $request, array $ * * @throws ApiException Thrown if the API call fails. */ - public function deleteInstances(DeleteInstancesRegionInstanceGroupManagerRequest $request, array $callOptions = []): OperationResponse - { + public function deleteInstances( + DeleteInstancesRegionInstanceGroupManagerRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('DeleteInstances', $request, $callOptions)->wait(); } @@ -441,8 +464,10 @@ public function deleteInstances(DeleteInstancesRegionInstanceGroupManagerRequest * * @throws ApiException Thrown if the API call fails. */ - public function deletePerInstanceConfigs(DeletePerInstanceConfigsRegionInstanceGroupManagerRequest $request, array $callOptions = []): OperationResponse - { + public function deletePerInstanceConfigs( + DeletePerInstanceConfigsRegionInstanceGroupManagerRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('DeletePerInstanceConfigs', $request, $callOptions)->wait(); } @@ -546,8 +571,10 @@ public function list(ListRegionInstanceGroupManagersRequest $request, array $cal * * @throws ApiException Thrown if the API call fails. */ - public function listErrors(ListErrorsRegionInstanceGroupManagersRequest $request, array $callOptions = []): PagedListResponse - { + public function listErrors( + ListErrorsRegionInstanceGroupManagersRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('ListErrors', $request, $callOptions); } @@ -573,8 +600,10 @@ public function listErrors(ListErrorsRegionInstanceGroupManagersRequest $request * * @throws ApiException Thrown if the API call fails. */ - public function listManagedInstances(ListManagedInstancesRegionInstanceGroupManagersRequest $request, array $callOptions = []): PagedListResponse - { + public function listManagedInstances( + ListManagedInstancesRegionInstanceGroupManagersRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('ListManagedInstances', $request, $callOptions); } @@ -600,8 +629,10 @@ public function listManagedInstances(ListManagedInstancesRegionInstanceGroupMana * * @throws ApiException Thrown if the API call fails. */ - public function listPerInstanceConfigs(ListPerInstanceConfigsRegionInstanceGroupManagersRequest $request, array $callOptions = []): PagedListResponse - { + public function listPerInstanceConfigs( + ListPerInstanceConfigsRegionInstanceGroupManagersRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('ListPerInstanceConfigs', $request, $callOptions); } @@ -653,8 +684,10 @@ public function patch(PatchRegionInstanceGroupManagerRequest $request, array $ca * * @throws ApiException Thrown if the API call fails. */ - public function patchPerInstanceConfigs(PatchPerInstanceConfigsRegionInstanceGroupManagerRequest $request, array $callOptions = []): OperationResponse - { + public function patchPerInstanceConfigs( + PatchPerInstanceConfigsRegionInstanceGroupManagerRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('PatchPerInstanceConfigs', $request, $callOptions)->wait(); } @@ -680,8 +713,10 @@ public function patchPerInstanceConfigs(PatchPerInstanceConfigsRegionInstanceGro * * @throws ApiException Thrown if the API call fails. */ - public function recreateInstances(RecreateInstancesRegionInstanceGroupManagerRequest $request, array $callOptions = []): OperationResponse - { + public function recreateInstances( + RecreateInstancesRegionInstanceGroupManagerRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('RecreateInstances', $request, $callOptions)->wait(); } @@ -733,8 +768,10 @@ public function resize(ResizeRegionInstanceGroupManagerRequest $request, array $ * * @throws ApiException Thrown if the API call fails. */ - public function resumeInstances(ResumeInstancesRegionInstanceGroupManagerRequest $request, array $callOptions = []): OperationResponse - { + public function resumeInstances( + ResumeInstancesRegionInstanceGroupManagerRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('ResumeInstances', $request, $callOptions)->wait(); } @@ -760,8 +797,10 @@ public function resumeInstances(ResumeInstancesRegionInstanceGroupManagerRequest * * @throws ApiException Thrown if the API call fails. */ - public function setInstanceTemplate(SetInstanceTemplateRegionInstanceGroupManagerRequest $request, array $callOptions = []): OperationResponse - { + public function setInstanceTemplate( + SetInstanceTemplateRegionInstanceGroupManagerRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('SetInstanceTemplate', $request, $callOptions)->wait(); } @@ -787,8 +826,10 @@ public function setInstanceTemplate(SetInstanceTemplateRegionInstanceGroupManage * * @throws ApiException Thrown if the API call fails. */ - public function setTargetPools(SetTargetPoolsRegionInstanceGroupManagerRequest $request, array $callOptions = []): OperationResponse - { + public function setTargetPools( + SetTargetPoolsRegionInstanceGroupManagerRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('SetTargetPools', $request, $callOptions)->wait(); } @@ -814,8 +855,10 @@ public function setTargetPools(SetTargetPoolsRegionInstanceGroupManagerRequest $ * * @throws ApiException Thrown if the API call fails. */ - public function startInstances(StartInstancesRegionInstanceGroupManagerRequest $request, array $callOptions = []): OperationResponse - { + public function startInstances( + StartInstancesRegionInstanceGroupManagerRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('StartInstances', $request, $callOptions)->wait(); } @@ -841,8 +884,10 @@ public function startInstances(StartInstancesRegionInstanceGroupManagerRequest $ * * @throws ApiException Thrown if the API call fails. */ - public function stopInstances(StopInstancesRegionInstanceGroupManagerRequest $request, array $callOptions = []): OperationResponse - { + public function stopInstances( + StopInstancesRegionInstanceGroupManagerRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('StopInstances', $request, $callOptions)->wait(); } @@ -868,8 +913,10 @@ public function stopInstances(StopInstancesRegionInstanceGroupManagerRequest $re * * @throws ApiException Thrown if the API call fails. */ - public function suspendInstances(SuspendInstancesRegionInstanceGroupManagerRequest $request, array $callOptions = []): OperationResponse - { + public function suspendInstances( + SuspendInstancesRegionInstanceGroupManagerRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('SuspendInstances', $request, $callOptions)->wait(); } @@ -895,8 +942,10 @@ public function suspendInstances(SuspendInstancesRegionInstanceGroupManagerReque * * @throws ApiException Thrown if the API call fails. */ - public function updatePerInstanceConfigs(UpdatePerInstanceConfigsRegionInstanceGroupManagerRequest $request, array $callOptions = []): OperationResponse - { + public function updatePerInstanceConfigs( + UpdatePerInstanceConfigsRegionInstanceGroupManagerRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('UpdatePerInstanceConfigs', $request, $callOptions)->wait(); } } diff --git a/Compute/src/V1/Client/RegionInstanceGroupsClient.php b/Compute/src/V1/Client/RegionInstanceGroupsClient.php index 0a0474664e64..64d08fdd2e3b 100644 --- a/Compute/src/V1/Client/RegionInstanceGroupsClient.php +++ b/Compute/src/V1/Client/RegionInstanceGroupsClient.php @@ -1,6 +1,6 @@ __DIR__ . '/../resources/region_instance_groups_rest_client_config.php', ], ], - 'operationsClientClass' => RegionOperationsClient::class, ]; } @@ -113,9 +111,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -132,10 +128,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], + 'additionalArgumentMethods' => ['getProject', 'getRegion'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -163,12 +156,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 RegionOperationsClient + */ + 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 RegionOperationsClient($options); + } + /** * Constructor. * @@ -320,8 +334,10 @@ public function list(ListRegionInstanceGroupsRequest $request, array $callOption * * @throws ApiException Thrown if the API call fails. */ - public function listInstances(ListInstancesRegionInstanceGroupsRequest $request, array $callOptions = []): PagedListResponse - { + public function listInstances( + ListInstancesRegionInstanceGroupsRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('ListInstances', $request, $callOptions); } @@ -346,8 +362,10 @@ public function listInstances(ListInstancesRegionInstanceGroupsRequest $request, * * @throws ApiException Thrown if the API call fails. */ - public function setNamedPorts(SetNamedPortsRegionInstanceGroupRequest $request, array $callOptions = []): OperationResponse - { + public function setNamedPorts( + SetNamedPortsRegionInstanceGroupRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('SetNamedPorts', $request, $callOptions)->wait(); } } diff --git a/Compute/src/V1/Client/RegionInstanceTemplatesClient.php b/Compute/src/V1/Client/RegionInstanceTemplatesClient.php index 02b301a72261..a8d945e0f357 100644 --- a/Compute/src/V1/Client/RegionInstanceTemplatesClient.php +++ b/Compute/src/V1/Client/RegionInstanceTemplatesClient.php @@ -1,6 +1,6 @@ [ 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/region_instance_templates_rest_client_config.php', + 'restClientConfigPath' => + __DIR__ . '/../resources/region_instance_templates_rest_client_config.php', ], ], - 'operationsClientClass' => RegionOperationsClient::class, ]; } @@ -113,9 +112,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -132,10 +129,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], + 'additionalArgumentMethods' => ['getProject', 'getRegion'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -163,12 +157,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 RegionOperationsClient + */ + 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 RegionOperationsClient($options); + } + /** * Constructor. * diff --git a/Compute/src/V1/Client/RegionInstancesClient.php b/Compute/src/V1/Client/RegionInstancesClient.php index c65eeba9c8dd..c14b89b795f2 100644 --- a/Compute/src/V1/Client/RegionInstancesClient.php +++ b/Compute/src/V1/Client/RegionInstancesClient.php @@ -1,6 +1,6 @@ __DIR__ . '/../resources/region_instances_rest_client_config.php', ], ], - 'operationsClientClass' => RegionOperationsClient::class, ]; } @@ -105,9 +103,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -124,10 +120,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], + 'additionalArgumentMethods' => ['getProject', 'getRegion'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -155,12 +148,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 RegionOperationsClient + */ + 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 RegionOperationsClient($options); + } + /** * Constructor. * diff --git a/Compute/src/V1/Client/RegionInstantSnapshotsClient.php b/Compute/src/V1/Client/RegionInstantSnapshotsClient.php index 66d2d9486bc7..12e24a0058d2 100644 --- a/Compute/src/V1/Client/RegionInstantSnapshotsClient.php +++ b/Compute/src/V1/Client/RegionInstantSnapshotsClient.php @@ -1,6 +1,6 @@ __DIR__ . '/../resources/region_instant_snapshots_rest_client_config.php', ], ], - 'operationsClientClass' => RegionOperationsClient::class, ]; } @@ -123,9 +121,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -142,10 +138,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], + 'additionalArgumentMethods' => ['getProject', 'getRegion'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -173,12 +166,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 RegionOperationsClient + */ + 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 RegionOperationsClient($options); + } + /** * Constructor. * @@ -434,8 +448,10 @@ public function setIamPolicy(SetIamPolicyRegionInstantSnapshotRequest $request, * * @throws ApiException Thrown if the API call fails. */ - public function setLabels(SetLabelsRegionInstantSnapshotRequest $request, array $callOptions = []): OperationResponse - { + public function setLabels( + SetLabelsRegionInstantSnapshotRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('SetLabels', $request, $callOptions)->wait(); } @@ -461,8 +477,10 @@ public function setLabels(SetLabelsRegionInstantSnapshotRequest $request, array * * @throws ApiException Thrown if the API call fails. */ - public function testIamPermissions(TestIamPermissionsRegionInstantSnapshotRequest $request, array $callOptions = []): TestPermissionsResponse - { + public function testIamPermissions( + TestIamPermissionsRegionInstantSnapshotRequest $request, + array $callOptions = [] + ): TestPermissionsResponse { return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); } } diff --git a/Compute/src/V1/Client/RegionNetworkEndpointGroupsClient.php b/Compute/src/V1/Client/RegionNetworkEndpointGroupsClient.php index 6c19d4dcadca..f9525789667d 100644 --- a/Compute/src/V1/Client/RegionNetworkEndpointGroupsClient.php +++ b/Compute/src/V1/Client/RegionNetworkEndpointGroupsClient.php @@ -1,6 +1,6 @@ [ 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/region_network_endpoint_groups_rest_client_config.php', + 'restClientConfigPath' => + __DIR__ . '/../resources/region_network_endpoint_groups_rest_client_config.php', ], ], - 'operationsClientClass' => RegionOperationsClient::class, ]; } @@ -119,9 +118,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -138,10 +135,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], + 'additionalArgumentMethods' => ['getProject', 'getRegion'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -169,12 +163,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 RegionOperationsClient + */ + 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 RegionOperationsClient($options); + } + /** * Constructor. * @@ -275,8 +290,10 @@ public function __call($method, $args) * * @throws ApiException Thrown if the API call fails. */ - public function attachNetworkEndpoints(AttachNetworkEndpointsRegionNetworkEndpointGroupRequest $request, array $callOptions = []): OperationResponse - { + public function attachNetworkEndpoints( + AttachNetworkEndpointsRegionNetworkEndpointGroupRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('AttachNetworkEndpoints', $request, $callOptions)->wait(); } @@ -328,8 +345,10 @@ public function delete(DeleteRegionNetworkEndpointGroupRequest $request, array $ * * @throws ApiException Thrown if the API call fails. */ - public function detachNetworkEndpoints(DetachNetworkEndpointsRegionNetworkEndpointGroupRequest $request, array $callOptions = []): OperationResponse - { + public function detachNetworkEndpoints( + DetachNetworkEndpointsRegionNetworkEndpointGroupRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('DetachNetworkEndpoints', $request, $callOptions)->wait(); } @@ -433,8 +452,10 @@ public function list(ListRegionNetworkEndpointGroupsRequest $request, array $cal * * @throws ApiException Thrown if the API call fails. */ - public function listNetworkEndpoints(ListNetworkEndpointsRegionNetworkEndpointGroupsRequest $request, array $callOptions = []): PagedListResponse - { + public function listNetworkEndpoints( + ListNetworkEndpointsRegionNetworkEndpointGroupsRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('ListNetworkEndpoints', $request, $callOptions); } } diff --git a/Compute/src/V1/Client/RegionNetworkFirewallPoliciesClient.php b/Compute/src/V1/Client/RegionNetworkFirewallPoliciesClient.php index fba6c3666472..824d9288dc5a 100644 --- a/Compute/src/V1/Client/RegionNetworkFirewallPoliciesClient.php +++ b/Compute/src/V1/Client/RegionNetworkFirewallPoliciesClient.php @@ -1,6 +1,6 @@ [ 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/region_network_firewall_policies_rest_client_config.php', + 'restClientConfigPath' => + __DIR__ . '/../resources/region_network_firewall_policies_rest_client_config.php', ], ], - 'operationsClientClass' => RegionOperationsClient::class, ]; } @@ -144,9 +143,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -163,10 +160,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], + 'additionalArgumentMethods' => ['getProject', 'getRegion'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -194,12 +188,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 RegionOperationsClient + */ + 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 RegionOperationsClient($options); + } + /** * Constructor. * @@ -300,8 +315,10 @@ public function __call($method, $args) * * @throws ApiException Thrown if the API call fails. */ - public function addAssociation(AddAssociationRegionNetworkFirewallPolicyRequest $request, array $callOptions = []): OperationResponse - { + public function addAssociation( + AddAssociationRegionNetworkFirewallPolicyRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('AddAssociation', $request, $callOptions)->wait(); } @@ -327,8 +344,10 @@ public function addAssociation(AddAssociationRegionNetworkFirewallPolicyRequest * * @throws ApiException Thrown if the API call fails. */ - public function addRule(AddRuleRegionNetworkFirewallPolicyRequest $request, array $callOptions = []): OperationResponse - { + public function addRule( + AddRuleRegionNetworkFirewallPolicyRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('AddRule', $request, $callOptions)->wait(); } @@ -354,8 +373,10 @@ public function addRule(AddRuleRegionNetworkFirewallPolicyRequest $request, arra * * @throws ApiException Thrown if the API call fails. */ - public function cloneRules(CloneRulesRegionNetworkFirewallPolicyRequest $request, array $callOptions = []): OperationResponse - { + public function cloneRules( + CloneRulesRegionNetworkFirewallPolicyRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('CloneRules', $request, $callOptions)->wait(); } @@ -380,8 +401,10 @@ public function cloneRules(CloneRulesRegionNetworkFirewallPolicyRequest $request * * @throws ApiException Thrown if the API call fails. */ - public function delete(DeleteRegionNetworkFirewallPolicyRequest $request, array $callOptions = []): OperationResponse - { + public function delete( + DeleteRegionNetworkFirewallPolicyRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('Delete', $request, $callOptions)->wait(); } @@ -433,8 +456,10 @@ public function get(GetRegionNetworkFirewallPolicyRequest $request, array $callO * * @throws ApiException Thrown if the API call fails. */ - public function getAssociation(GetAssociationRegionNetworkFirewallPolicyRequest $request, array $callOptions = []): FirewallPolicyAssociation - { + public function getAssociation( + GetAssociationRegionNetworkFirewallPolicyRequest $request, + array $callOptions = [] + ): FirewallPolicyAssociation { return $this->startApiCall('GetAssociation', $request, $callOptions)->wait(); } @@ -460,8 +485,10 @@ public function getAssociation(GetAssociationRegionNetworkFirewallPolicyRequest * * @throws ApiException Thrown if the API call fails. */ - public function getEffectiveFirewalls(GetEffectiveFirewallsRegionNetworkFirewallPolicyRequest $request, array $callOptions = []): RegionNetworkFirewallPoliciesGetEffectiveFirewallsResponse - { + public function getEffectiveFirewalls( + GetEffectiveFirewallsRegionNetworkFirewallPolicyRequest $request, + array $callOptions = [] + ): RegionNetworkFirewallPoliciesGetEffectiveFirewallsResponse { return $this->startApiCall('GetEffectiveFirewalls', $request, $callOptions)->wait(); } @@ -487,8 +514,10 @@ public function getEffectiveFirewalls(GetEffectiveFirewallsRegionNetworkFirewall * * @throws ApiException Thrown if the API call fails. */ - public function getIamPolicy(GetIamPolicyRegionNetworkFirewallPolicyRequest $request, array $callOptions = []): Policy - { + public function getIamPolicy( + GetIamPolicyRegionNetworkFirewallPolicyRequest $request, + array $callOptions = [] + ): Policy { return $this->startApiCall('GetIamPolicy', $request, $callOptions)->wait(); } @@ -514,8 +543,10 @@ public function getIamPolicy(GetIamPolicyRegionNetworkFirewallPolicyRequest $req * * @throws ApiException Thrown if the API call fails. */ - public function getRule(GetRuleRegionNetworkFirewallPolicyRequest $request, array $callOptions = []): FirewallPolicyRule - { + public function getRule( + GetRuleRegionNetworkFirewallPolicyRequest $request, + array $callOptions = [] + ): FirewallPolicyRule { return $this->startApiCall('GetRule', $request, $callOptions)->wait(); } @@ -540,8 +571,10 @@ public function getRule(GetRuleRegionNetworkFirewallPolicyRequest $request, arra * * @throws ApiException Thrown if the API call fails. */ - public function insert(InsertRegionNetworkFirewallPolicyRequest $request, array $callOptions = []): OperationResponse - { + public function insert( + InsertRegionNetworkFirewallPolicyRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('Insert', $request, $callOptions)->wait(); } @@ -619,8 +652,10 @@ public function patch(PatchRegionNetworkFirewallPolicyRequest $request, array $c * * @throws ApiException Thrown if the API call fails. */ - public function patchRule(PatchRuleRegionNetworkFirewallPolicyRequest $request, array $callOptions = []): OperationResponse - { + public function patchRule( + PatchRuleRegionNetworkFirewallPolicyRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('PatchRule', $request, $callOptions)->wait(); } @@ -646,8 +681,10 @@ public function patchRule(PatchRuleRegionNetworkFirewallPolicyRequest $request, * * @throws ApiException Thrown if the API call fails. */ - public function removeAssociation(RemoveAssociationRegionNetworkFirewallPolicyRequest $request, array $callOptions = []): OperationResponse - { + public function removeAssociation( + RemoveAssociationRegionNetworkFirewallPolicyRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('RemoveAssociation', $request, $callOptions)->wait(); } @@ -673,8 +710,10 @@ public function removeAssociation(RemoveAssociationRegionNetworkFirewallPolicyRe * * @throws ApiException Thrown if the API call fails. */ - public function removeRule(RemoveRuleRegionNetworkFirewallPolicyRequest $request, array $callOptions = []): OperationResponse - { + public function removeRule( + RemoveRuleRegionNetworkFirewallPolicyRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('RemoveRule', $request, $callOptions)->wait(); } @@ -700,8 +739,10 @@ public function removeRule(RemoveRuleRegionNetworkFirewallPolicyRequest $request * * @throws ApiException Thrown if the API call fails. */ - public function setIamPolicy(SetIamPolicyRegionNetworkFirewallPolicyRequest $request, array $callOptions = []): Policy - { + public function setIamPolicy( + SetIamPolicyRegionNetworkFirewallPolicyRequest $request, + array $callOptions = [] + ): Policy { return $this->startApiCall('SetIamPolicy', $request, $callOptions)->wait(); } @@ -727,8 +768,10 @@ public function setIamPolicy(SetIamPolicyRegionNetworkFirewallPolicyRequest $req * * @throws ApiException Thrown if the API call fails. */ - public function testIamPermissions(TestIamPermissionsRegionNetworkFirewallPolicyRequest $request, array $callOptions = []): TestPermissionsResponse - { + public function testIamPermissions( + TestIamPermissionsRegionNetworkFirewallPolicyRequest $request, + array $callOptions = [] + ): TestPermissionsResponse { return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); } } diff --git a/Compute/src/V1/Client/RegionNotificationEndpointsClient.php b/Compute/src/V1/Client/RegionNotificationEndpointsClient.php index b31e0684c6b2..a7b7f78e58bb 100644 --- a/Compute/src/V1/Client/RegionNotificationEndpointsClient.php +++ b/Compute/src/V1/Client/RegionNotificationEndpointsClient.php @@ -1,6 +1,6 @@ [ 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/region_notification_endpoints_rest_client_config.php', + 'restClientConfigPath' => + __DIR__ . '/../resources/region_notification_endpoints_rest_client_config.php', ], ], - 'operationsClientClass' => RegionOperationsClient::class, ]; } @@ -113,9 +112,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -132,10 +129,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], + 'additionalArgumentMethods' => ['getProject', 'getRegion'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -163,12 +157,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 RegionOperationsClient + */ + 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 RegionOperationsClient($options); + } + /** * Constructor. * diff --git a/Compute/src/V1/Client/RegionOperationsClient.php b/Compute/src/V1/Client/RegionOperationsClient.php index 8227e3723117..84e92755d61b 100644 --- a/Compute/src/V1/Client/RegionOperationsClient.php +++ b/Compute/src/V1/Client/RegionOperationsClient.php @@ -1,6 +1,6 @@ startApiCall('Delete', $request, $callOptions)->wait(); } diff --git a/Compute/src/V1/Client/RegionSecurityPoliciesClient.php b/Compute/src/V1/Client/RegionSecurityPoliciesClient.php index e2972a158ce6..b52c8fc6effa 100644 --- a/Compute/src/V1/Client/RegionSecurityPoliciesClient.php +++ b/Compute/src/V1/Client/RegionSecurityPoliciesClient.php @@ -1,6 +1,6 @@ __DIR__ . '/../resources/region_security_policies_rest_client_config.php', ], ], - 'operationsClientClass' => RegionOperationsClient::class, ]; } @@ -126,9 +124,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -145,10 +141,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], + 'additionalArgumentMethods' => ['getProject', 'getRegion'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -176,12 +169,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 RegionOperationsClient + */ + 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 RegionOperationsClient($options); + } + /** * Constructor. * @@ -489,8 +503,10 @@ public function patchRule(PatchRuleRegionSecurityPolicyRequest $request, array $ * * @throws ApiException Thrown if the API call fails. */ - public function removeRule(RemoveRuleRegionSecurityPolicyRequest $request, array $callOptions = []): OperationResponse - { + public function removeRule( + RemoveRuleRegionSecurityPolicyRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('RemoveRule', $request, $callOptions)->wait(); } diff --git a/Compute/src/V1/Client/RegionSslCertificatesClient.php b/Compute/src/V1/Client/RegionSslCertificatesClient.php index df30134cd991..21cd3ff4e212 100644 --- a/Compute/src/V1/Client/RegionSslCertificatesClient.php +++ b/Compute/src/V1/Client/RegionSslCertificatesClient.php @@ -1,6 +1,6 @@ __DIR__ . '/../resources/region_ssl_certificates_rest_client_config.php', ], ], - 'operationsClientClass' => RegionOperationsClient::class, ]; } @@ -113,9 +111,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -132,10 +128,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], + 'additionalArgumentMethods' => ['getProject', 'getRegion'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -163,12 +156,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 RegionOperationsClient + */ + 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 RegionOperationsClient($options); + } + /** * Constructor. * diff --git a/Compute/src/V1/Client/RegionSslPoliciesClient.php b/Compute/src/V1/Client/RegionSslPoliciesClient.php index f04b3564bb25..0ad7b773c8a3 100644 --- a/Compute/src/V1/Client/RegionSslPoliciesClient.php +++ b/Compute/src/V1/Client/RegionSslPoliciesClient.php @@ -1,6 +1,6 @@ __DIR__ . '/../resources/region_ssl_policies_rest_client_config.php', ], ], - 'operationsClientClass' => RegionOperationsClient::class, ]; } @@ -118,9 +116,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -137,10 +133,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], + 'additionalArgumentMethods' => ['getProject', 'getRegion'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -168,12 +161,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 RegionOperationsClient + */ + 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 RegionOperationsClient($options); + } + /** * Constructor. * @@ -378,8 +392,10 @@ public function list(ListRegionSslPoliciesRequest $request, array $callOptions = * * @throws ApiException Thrown if the API call fails. */ - public function listAvailableFeatures(ListAvailableFeaturesRegionSslPoliciesRequest $request, array $callOptions = []): SslPoliciesListAvailableFeaturesResponse - { + public function listAvailableFeatures( + ListAvailableFeaturesRegionSslPoliciesRequest $request, + array $callOptions = [] + ): SslPoliciesListAvailableFeaturesResponse { return $this->startApiCall('ListAvailableFeatures', $request, $callOptions)->wait(); } diff --git a/Compute/src/V1/Client/RegionTargetHttpProxiesClient.php b/Compute/src/V1/Client/RegionTargetHttpProxiesClient.php index d11317bf0b30..f0f088c055a1 100644 --- a/Compute/src/V1/Client/RegionTargetHttpProxiesClient.php +++ b/Compute/src/V1/Client/RegionTargetHttpProxiesClient.php @@ -1,6 +1,6 @@ [ 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/region_target_http_proxies_rest_client_config.php', + 'restClientConfigPath' => + __DIR__ . '/../resources/region_target_http_proxies_rest_client_config.php', ], ], - 'operationsClientClass' => RegionOperationsClient::class, ]; } @@ -115,9 +114,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -134,10 +131,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], + 'additionalArgumentMethods' => ['getProject', 'getRegion'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -165,12 +159,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 RegionOperationsClient + */ + 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 RegionOperationsClient($options); + } + /** * Constructor. * @@ -374,8 +389,10 @@ public function list(ListRegionTargetHttpProxiesRequest $request, array $callOpt * * @throws ApiException Thrown if the API call fails. */ - public function setUrlMap(SetUrlMapRegionTargetHttpProxyRequest $request, array $callOptions = []): OperationResponse - { + public function setUrlMap( + SetUrlMapRegionTargetHttpProxyRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('SetUrlMap', $request, $callOptions)->wait(); } } diff --git a/Compute/src/V1/Client/RegionTargetHttpsProxiesClient.php b/Compute/src/V1/Client/RegionTargetHttpsProxiesClient.php index dbdd3c7e9f58..343e186a1a33 100644 --- a/Compute/src/V1/Client/RegionTargetHttpsProxiesClient.php +++ b/Compute/src/V1/Client/RegionTargetHttpsProxiesClient.php @@ -1,6 +1,6 @@ [ 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/region_target_https_proxies_rest_client_config.php', + 'restClientConfigPath' => + __DIR__ . '/../resources/region_target_https_proxies_rest_client_config.php', ], ], - 'operationsClientClass' => RegionOperationsClient::class, ]; } @@ -119,9 +118,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -138,10 +135,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], + 'additionalArgumentMethods' => ['getProject', 'getRegion'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -169,12 +163,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 RegionOperationsClient + */ + 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 RegionOperationsClient($options); + } + /** * Constructor. * @@ -405,8 +420,10 @@ public function patch(PatchRegionTargetHttpsProxyRequest $request, array $callOp * * @throws ApiException Thrown if the API call fails. */ - public function setSslCertificates(SetSslCertificatesRegionTargetHttpsProxyRequest $request, array $callOptions = []): OperationResponse - { + public function setSslCertificates( + SetSslCertificatesRegionTargetHttpsProxyRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('SetSslCertificates', $request, $callOptions)->wait(); } @@ -431,8 +448,10 @@ public function setSslCertificates(SetSslCertificatesRegionTargetHttpsProxyReque * * @throws ApiException Thrown if the API call fails. */ - public function setUrlMap(SetUrlMapRegionTargetHttpsProxyRequest $request, array $callOptions = []): OperationResponse - { + public function setUrlMap( + SetUrlMapRegionTargetHttpsProxyRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('SetUrlMap', $request, $callOptions)->wait(); } } diff --git a/Compute/src/V1/Client/RegionTargetTcpProxiesClient.php b/Compute/src/V1/Client/RegionTargetTcpProxiesClient.php index 1ee94b0b124f..edcbdc96b21f 100644 --- a/Compute/src/V1/Client/RegionTargetTcpProxiesClient.php +++ b/Compute/src/V1/Client/RegionTargetTcpProxiesClient.php @@ -1,6 +1,6 @@ [ 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/region_target_tcp_proxies_rest_client_config.php', + 'restClientConfigPath' => + __DIR__ . '/../resources/region_target_tcp_proxies_rest_client_config.php', ], ], - 'operationsClientClass' => RegionOperationsClient::class, ]; } @@ -113,9 +112,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -132,10 +129,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], + 'additionalArgumentMethods' => ['getProject', 'getRegion'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -163,12 +157,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 RegionOperationsClient + */ + 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 RegionOperationsClient($options); + } + /** * Constructor. * diff --git a/Compute/src/V1/Client/RegionUrlMapsClient.php b/Compute/src/V1/Client/RegionUrlMapsClient.php index bc05668e2738..802b754f9b68 100644 --- a/Compute/src/V1/Client/RegionUrlMapsClient.php +++ b/Compute/src/V1/Client/RegionUrlMapsClient.php @@ -1,6 +1,6 @@ __DIR__ . '/../resources/region_url_maps_rest_client_config.php', ], ], - 'operationsClientClass' => RegionOperationsClient::class, ]; } @@ -120,9 +118,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -139,10 +135,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], + 'additionalArgumentMethods' => ['getProject', 'getRegion'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -170,12 +163,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 RegionOperationsClient + */ + 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 RegionOperationsClient($options); + } + /** * Constructor. * diff --git a/Compute/src/V1/Client/RegionZonesClient.php b/Compute/src/V1/Client/RegionZonesClient.php index 25596bf7a249..430d119e4ed9 100644 --- a/Compute/src/V1/Client/RegionZonesClient.php +++ b/Compute/src/V1/Client/RegionZonesClient.php @@ -1,6 +1,6 @@ __DIR__ . '/../resources/reservation_blocks_rest_client_config.php', ], ], - 'operationsClientClass' => ZoneOperationsClient::class, ]; } @@ -111,9 +109,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -130,10 +126,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getZone', - ], + 'additionalArgumentMethods' => ['getProject', 'getZone'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -161,12 +154,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 ZoneOperationsClient + */ + 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 ZoneOperationsClient($options); + } + /** * Constructor. * @@ -318,8 +332,10 @@ public function list(ListReservationBlocksRequest $request, array $callOptions = * * @throws ApiException Thrown if the API call fails. */ - public function performMaintenance(PerformMaintenanceReservationBlockRequest $request, array $callOptions = []): OperationResponse - { + public function performMaintenance( + PerformMaintenanceReservationBlockRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('PerformMaintenance', $request, $callOptions)->wait(); } } diff --git a/Compute/src/V1/Client/ReservationSubBlocksClient.php b/Compute/src/V1/Client/ReservationSubBlocksClient.php index 113519b57ca8..874e776e8ccc 100644 --- a/Compute/src/V1/Client/ReservationSubBlocksClient.php +++ b/Compute/src/V1/Client/ReservationSubBlocksClient.php @@ -37,7 +37,6 @@ use Google\Cloud\Compute\V1\ListReservationSubBlocksRequest; use Google\Cloud\Compute\V1\PerformMaintenanceReservationSubBlockRequest; use Google\Cloud\Compute\V1\ReservationSubBlocksGetResponse; -use Google\Cloud\Compute\V1\ZoneOperationsClient; use GuzzleHttp\Promise\PromiseInterface; use Psr\Log\LoggerInterface; @@ -98,7 +97,6 @@ private static function getClientDefaults() 'restClientConfigPath' => __DIR__ . '/../resources/reservation_sub_blocks_rest_client_config.php', ], ], - 'operationsClientClass' => ZoneOperationsClient::class, ]; } @@ -111,9 +109,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -130,10 +126,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getZone', - ], + 'additionalArgumentMethods' => ['getProject', 'getZone'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -161,12 +154,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 ZoneOperationsClient + */ + 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 ZoneOperationsClient($options); + } + /** * Constructor. * @@ -266,8 +280,10 @@ public function __call($method, $args) * * @throws ApiException Thrown if the API call fails. */ - public function get(GetReservationSubBlockRequest $request, array $callOptions = []): ReservationSubBlocksGetResponse - { + public function get( + GetReservationSubBlockRequest $request, + array $callOptions = [] + ): ReservationSubBlocksGetResponse { return $this->startApiCall('Get', $request, $callOptions)->wait(); } @@ -319,8 +335,10 @@ public function list(ListReservationSubBlocksRequest $request, array $callOption * * @throws ApiException Thrown if the API call fails. */ - public function performMaintenance(PerformMaintenanceReservationSubBlockRequest $request, array $callOptions = []): OperationResponse - { + public function performMaintenance( + PerformMaintenanceReservationSubBlockRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('PerformMaintenance', $request, $callOptions)->wait(); } } diff --git a/Compute/src/V1/Client/ReservationsClient.php b/Compute/src/V1/Client/ReservationsClient.php index 7d0165b3125d..69a672fcdf31 100644 --- a/Compute/src/V1/Client/ReservationsClient.php +++ b/Compute/src/V1/Client/ReservationsClient.php @@ -1,6 +1,6 @@ __DIR__ . '/../resources/reservations_rest_client_config.php', ], ], - 'operationsClientClass' => ZoneOperationsClient::class, ]; } @@ -129,9 +127,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -148,10 +144,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getZone', - ], + 'additionalArgumentMethods' => ['getProject', 'getZone'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -179,12 +172,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 ZoneOperationsClient + */ + 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 ZoneOperationsClient($options); + } + /** * Constructor. * @@ -284,8 +298,10 @@ public function __call($method, $args) * * @throws ApiException Thrown if the API call fails. */ - public function aggregatedList(AggregatedListReservationsRequest $request, array $callOptions = []): PagedListResponse - { + public function aggregatedList( + AggregatedListReservationsRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('AggregatedList', $request, $callOptions); } @@ -440,8 +456,10 @@ public function list(ListReservationsRequest $request, array $callOptions = []): * * @throws ApiException Thrown if the API call fails. */ - public function performMaintenance(PerformMaintenanceReservationRequest $request, array $callOptions = []): OperationResponse - { + public function performMaintenance( + PerformMaintenanceReservationRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('PerformMaintenance', $request, $callOptions)->wait(); } @@ -518,8 +536,10 @@ public function setIamPolicy(SetIamPolicyReservationRequest $request, array $cal * * @throws ApiException Thrown if the API call fails. */ - public function testIamPermissions(TestIamPermissionsReservationRequest $request, array $callOptions = []): TestPermissionsResponse - { + public function testIamPermissions( + TestIamPermissionsReservationRequest $request, + array $callOptions = [] + ): TestPermissionsResponse { return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); } diff --git a/Compute/src/V1/Client/ResourcePoliciesClient.php b/Compute/src/V1/Client/ResourcePoliciesClient.php index c46fe4708e98..263a98ed8bde 100644 --- a/Compute/src/V1/Client/ResourcePoliciesClient.php +++ b/Compute/src/V1/Client/ResourcePoliciesClient.php @@ -1,6 +1,6 @@ __DIR__ . '/../resources/resource_policies_rest_client_config.php', ], ], - 'operationsClientClass' => RegionOperationsClient::class, ]; } @@ -125,9 +123,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -144,10 +140,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], + 'additionalArgumentMethods' => ['getProject', 'getRegion'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -175,12 +168,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 RegionOperationsClient + */ + 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 RegionOperationsClient($options); + } + /** * Constructor. * @@ -280,8 +294,10 @@ public function __call($method, $args) * * @throws ApiException Thrown if the API call fails. */ - public function aggregatedList(AggregatedListResourcePoliciesRequest $request, array $callOptions = []): PagedListResponse - { + public function aggregatedList( + AggregatedListResourcePoliciesRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('AggregatedList', $request, $callOptions); } @@ -488,8 +504,10 @@ public function setIamPolicy(SetIamPolicyResourcePolicyRequest $request, array $ * * @throws ApiException Thrown if the API call fails. */ - public function testIamPermissions(TestIamPermissionsResourcePolicyRequest $request, array $callOptions = []): TestPermissionsResponse - { + public function testIamPermissions( + TestIamPermissionsResourcePolicyRequest $request, + array $callOptions = [] + ): TestPermissionsResponse { return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); } } diff --git a/Compute/src/V1/Client/RoutersClient.php b/Compute/src/V1/Client/RoutersClient.php index cdb6aac1c55f..28ccc6b5ecf1 100644 --- a/Compute/src/V1/Client/RoutersClient.php +++ b/Compute/src/V1/Client/RoutersClient.php @@ -1,6 +1,6 @@ __DIR__ . '/../resources/routers_rest_client_config.php', ], ], - 'operationsClientClass' => RegionOperationsClient::class, ]; } @@ -145,9 +143,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -164,10 +160,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], + 'additionalArgumentMethods' => ['getProject', 'getRegion'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -195,12 +188,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 RegionOperationsClient + */ + 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 RegionOperationsClient($options); + } + /** * Constructor. * @@ -352,8 +366,10 @@ public function delete(DeleteRouterRequest $request, array $callOptions = []): O * * @throws ApiException Thrown if the API call fails. */ - public function deleteRoutePolicy(DeleteRoutePolicyRouterRequest $request, array $callOptions = []): OperationResponse - { + public function deleteRoutePolicy( + DeleteRoutePolicyRouterRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('DeleteRoutePolicy', $request, $callOptions)->wait(); } @@ -430,8 +446,10 @@ public function getNatIpInfo(GetNatIpInfoRouterRequest $request, array $callOpti * * @throws ApiException Thrown if the API call fails. */ - public function getNatMappingInfo(GetNatMappingInfoRoutersRequest $request, array $callOptions = []): PagedListResponse - { + public function getNatMappingInfo( + GetNatMappingInfoRoutersRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('GetNatMappingInfo', $request, $callOptions); } @@ -456,8 +474,10 @@ public function getNatMappingInfo(GetNatMappingInfoRoutersRequest $request, arra * * @throws ApiException Thrown if the API call fails. */ - public function getRoutePolicy(GetRoutePolicyRouterRequest $request, array $callOptions = []): RoutersGetRoutePolicyResponse - { + public function getRoutePolicy( + GetRoutePolicyRouterRequest $request, + array $callOptions = [] + ): RoutersGetRoutePolicyResponse { return $this->startApiCall('GetRoutePolicy', $request, $callOptions)->wait(); } @@ -482,8 +502,10 @@ public function getRoutePolicy(GetRoutePolicyRouterRequest $request, array $call * * @throws ApiException Thrown if the API call fails. */ - public function getRouterStatus(GetRouterStatusRouterRequest $request, array $callOptions = []): RouterStatusResponse - { + public function getRouterStatus( + GetRouterStatusRouterRequest $request, + array $callOptions = [] + ): RouterStatusResponse { return $this->startApiCall('GetRouterStatus', $request, $callOptions)->wait(); } @@ -586,8 +608,10 @@ public function listBgpRoutes(ListBgpRoutesRoutersRequest $request, array $callO * * @throws ApiException Thrown if the API call fails. */ - public function listRoutePolicies(ListRoutePoliciesRoutersRequest $request, array $callOptions = []): RoutersListRoutePolicies - { + public function listRoutePolicies( + ListRoutePoliciesRoutersRequest $request, + array $callOptions = [] + ): RoutersListRoutePolicies { return $this->startApiCall('ListRoutePolicies', $request, $callOptions)->wait(); } @@ -716,8 +740,10 @@ public function update(UpdateRouterRequest $request, array $callOptions = []): O * * @throws ApiException Thrown if the API call fails. */ - public function updateRoutePolicy(UpdateRoutePolicyRouterRequest $request, array $callOptions = []): OperationResponse - { + public function updateRoutePolicy( + UpdateRoutePolicyRouterRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('UpdateRoutePolicy', $request, $callOptions)->wait(); } } diff --git a/Compute/src/V1/Client/RoutesClient.php b/Compute/src/V1/Client/RoutesClient.php index 59a563c83149..8eb48e9f0536 100644 --- a/Compute/src/V1/Client/RoutesClient.php +++ b/Compute/src/V1/Client/RoutesClient.php @@ -1,6 +1,6 @@ __DIR__ . '/../resources/routes_rest_client_config.php', ], ], - 'operationsClientClass' => GlobalOperationsClient::class, ]; } @@ -113,9 +111,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -132,9 +128,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - ], + 'additionalArgumentMethods' => ['getProject'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -162,12 +156,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 GlobalOperationsClient + */ + 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 GlobalOperationsClient($options); + } + /** * Constructor. * diff --git a/Compute/src/V1/Client/SecurityPoliciesClient.php b/Compute/src/V1/Client/SecurityPoliciesClient.php index 826b729a1a13..d8d794106f17 100644 --- a/Compute/src/V1/Client/SecurityPoliciesClient.php +++ b/Compute/src/V1/Client/SecurityPoliciesClient.php @@ -1,6 +1,6 @@ __DIR__ . '/../resources/security_policies_rest_client_config.php', ], ], - 'operationsClientClass' => GlobalOperationsClient::class, ]; } @@ -131,9 +129,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -150,9 +146,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - ], + 'additionalArgumentMethods' => ['getProject'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -180,12 +174,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 GlobalOperationsClient + */ + 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 GlobalOperationsClient($options); + } + /** * Constructor. * @@ -311,8 +326,10 @@ public function addRule(AddRuleSecurityPolicyRequest $request, array $callOption * * @throws ApiException Thrown if the API call fails. */ - public function aggregatedList(AggregatedListSecurityPoliciesRequest $request, array $callOptions = []): PagedListResponse - { + public function aggregatedList( + AggregatedListSecurityPoliciesRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('AggregatedList', $request, $callOptions); } @@ -468,8 +485,10 @@ public function list(ListSecurityPoliciesRequest $request, array $callOptions = * * @throws ApiException Thrown if the API call fails. */ - public function listPreconfiguredExpressionSets(ListPreconfiguredExpressionSetsSecurityPoliciesRequest $request, array $callOptions = []): SecurityPoliciesListPreconfiguredExpressionSetsResponse - { + public function listPreconfiguredExpressionSets( + ListPreconfiguredExpressionSetsSecurityPoliciesRequest $request, + array $callOptions = [] + ): SecurityPoliciesListPreconfiguredExpressionSetsResponse { return $this->startApiCall('ListPreconfiguredExpressionSets', $request, $callOptions)->wait(); } diff --git a/Compute/src/V1/Client/ServiceAttachmentsClient.php b/Compute/src/V1/Client/ServiceAttachmentsClient.php index 4b87fdba7b92..21dbcd70d33b 100644 --- a/Compute/src/V1/Client/ServiceAttachmentsClient.php +++ b/Compute/src/V1/Client/ServiceAttachmentsClient.php @@ -1,6 +1,6 @@ __DIR__ . '/../resources/service_attachments_rest_client_config.php', ], ], - 'operationsClientClass' => RegionOperationsClient::class, ]; } @@ -125,9 +123,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -144,10 +140,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], + 'additionalArgumentMethods' => ['getProject', 'getRegion'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -175,12 +168,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 RegionOperationsClient + */ + 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 RegionOperationsClient($options); + } + /** * Constructor. * @@ -280,8 +294,10 @@ public function __call($method, $args) * * @throws ApiException Thrown if the API call fails. */ - public function aggregatedList(AggregatedListServiceAttachmentsRequest $request, array $callOptions = []): PagedListResponse - { + public function aggregatedList( + AggregatedListServiceAttachmentsRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('AggregatedList', $request, $callOptions); } @@ -489,8 +505,10 @@ public function setIamPolicy(SetIamPolicyServiceAttachmentRequest $request, arra * * @throws ApiException Thrown if the API call fails. */ - public function testIamPermissions(TestIamPermissionsServiceAttachmentRequest $request, array $callOptions = []): TestPermissionsResponse - { + public function testIamPermissions( + TestIamPermissionsServiceAttachmentRequest $request, + array $callOptions = [] + ): TestPermissionsResponse { return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); } } diff --git a/Compute/src/V1/Client/SnapshotSettingsServiceClient.php b/Compute/src/V1/Client/SnapshotSettingsServiceClient.php index 5644a081cba4..91d9d256ec07 100644 --- a/Compute/src/V1/Client/SnapshotSettingsServiceClient.php +++ b/Compute/src/V1/Client/SnapshotSettingsServiceClient.php @@ -1,6 +1,6 @@ [ 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/snapshot_settings_service_rest_client_config.php', + 'restClientConfigPath' => + __DIR__ . '/../resources/snapshot_settings_service_rest_client_config.php', ], ], - 'operationsClientClass' => GlobalOperationsClient::class, ]; } @@ -108,9 +107,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -127,9 +124,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - ], + 'additionalArgumentMethods' => ['getProject'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -157,12 +152,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 GlobalOperationsClient + */ + 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 GlobalOperationsClient($options); + } + /** * Constructor. * diff --git a/Compute/src/V1/Client/SnapshotsClient.php b/Compute/src/V1/Client/SnapshotsClient.php index 93c626b4f105..c40986f597f1 100644 --- a/Compute/src/V1/Client/SnapshotsClient.php +++ b/Compute/src/V1/Client/SnapshotsClient.php @@ -1,6 +1,6 @@ __DIR__ . '/../resources/snapshots_rest_client_config.php', ], ], - 'operationsClientClass' => GlobalOperationsClient::class, ]; } @@ -123,9 +121,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -142,9 +138,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - ], + 'additionalArgumentMethods' => ['getProject'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -172,12 +166,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 GlobalOperationsClient + */ + 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 GlobalOperationsClient($options); + } + /** * Constructor. * @@ -459,8 +474,10 @@ public function setLabels(SetLabelsSnapshotRequest $request, array $callOptions * * @throws ApiException Thrown if the API call fails. */ - public function testIamPermissions(TestIamPermissionsSnapshotRequest $request, array $callOptions = []): TestPermissionsResponse - { + public function testIamPermissions( + TestIamPermissionsSnapshotRequest $request, + array $callOptions = [] + ): TestPermissionsResponse { return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); } } diff --git a/Compute/src/V1/Client/SslCertificatesClient.php b/Compute/src/V1/Client/SslCertificatesClient.php index a8f7b5a78c9d..33d8e327005d 100644 --- a/Compute/src/V1/Client/SslCertificatesClient.php +++ b/Compute/src/V1/Client/SslCertificatesClient.php @@ -1,6 +1,6 @@ __DIR__ . '/../resources/ssl_certificates_rest_client_config.php', ], ], - 'operationsClientClass' => GlobalOperationsClient::class, ]; } @@ -115,9 +113,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -134,9 +130,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - ], + 'additionalArgumentMethods' => ['getProject'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -164,12 +158,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 GlobalOperationsClient + */ + 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 GlobalOperationsClient($options); + } + /** * Constructor. * @@ -269,8 +284,10 @@ public function __call($method, $args) * * @throws ApiException Thrown if the API call fails. */ - public function aggregatedList(AggregatedListSslCertificatesRequest $request, array $callOptions = []): PagedListResponse - { + public function aggregatedList( + AggregatedListSslCertificatesRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('AggregatedList', $request, $callOptions); } diff --git a/Compute/src/V1/Client/SslPoliciesClient.php b/Compute/src/V1/Client/SslPoliciesClient.php index caf65cb830e0..b8be9d276570 100644 --- a/Compute/src/V1/Client/SslPoliciesClient.php +++ b/Compute/src/V1/Client/SslPoliciesClient.php @@ -1,6 +1,6 @@ __DIR__ . '/../resources/ssl_policies_rest_client_config.php', ], ], - 'operationsClientClass' => GlobalOperationsClient::class, ]; } @@ -120,9 +118,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -139,9 +135,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - ], + 'additionalArgumentMethods' => ['getProject'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -169,12 +163,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 GlobalOperationsClient + */ + 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 GlobalOperationsClient($options); + } + /** * Constructor. * @@ -274,8 +289,10 @@ public function __call($method, $args) * * @throws ApiException Thrown if the API call fails. */ - public function aggregatedList(AggregatedListSslPoliciesRequest $request, array $callOptions = []): PagedListResponse - { + public function aggregatedList( + AggregatedListSslPoliciesRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('AggregatedList', $request, $callOptions); } @@ -404,8 +421,10 @@ public function list(ListSslPoliciesRequest $request, array $callOptions = []): * * @throws ApiException Thrown if the API call fails. */ - public function listAvailableFeatures(ListAvailableFeaturesSslPoliciesRequest $request, array $callOptions = []): SslPoliciesListAvailableFeaturesResponse - { + public function listAvailableFeatures( + ListAvailableFeaturesSslPoliciesRequest $request, + array $callOptions = [] + ): SslPoliciesListAvailableFeaturesResponse { return $this->startApiCall('ListAvailableFeatures', $request, $callOptions)->wait(); } diff --git a/Compute/src/V1/Client/StoragePoolTypesClient.php b/Compute/src/V1/Client/StoragePoolTypesClient.php index 12b0449be523..d6f1ef30882b 100644 --- a/Compute/src/V1/Client/StoragePoolTypesClient.php +++ b/Compute/src/V1/Client/StoragePoolTypesClient.php @@ -1,6 +1,6 @@ startApiCall('AggregatedList', $request, $callOptions); } diff --git a/Compute/src/V1/Client/StoragePoolsClient.php b/Compute/src/V1/Client/StoragePoolsClient.php index 58c14797a9aa..1afbe093c24c 100644 --- a/Compute/src/V1/Client/StoragePoolsClient.php +++ b/Compute/src/V1/Client/StoragePoolsClient.php @@ -1,6 +1,6 @@ __DIR__ . '/../resources/storage_pools_rest_client_config.php', ], ], - 'operationsClientClass' => ZoneOperationsClient::class, ]; } @@ -129,9 +127,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -148,10 +144,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getZone', - ], + 'additionalArgumentMethods' => ['getProject', 'getZone'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -179,12 +172,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 ZoneOperationsClient + */ + 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 ZoneOperationsClient($options); + } + /** * Constructor. * @@ -284,8 +298,10 @@ public function __call($method, $args) * * @throws ApiException Thrown if the API call fails. */ - public function aggregatedList(AggregatedListStoragePoolsRequest $request, array $callOptions = []): PagedListResponse - { + public function aggregatedList( + AggregatedListStoragePoolsRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('AggregatedList', $request, $callOptions); } @@ -492,8 +508,10 @@ public function setIamPolicy(SetIamPolicyStoragePoolRequest $request, array $cal * * @throws ApiException Thrown if the API call fails. */ - public function testIamPermissions(TestIamPermissionsStoragePoolRequest $request, array $callOptions = []): TestPermissionsResponse - { + public function testIamPermissions( + TestIamPermissionsStoragePoolRequest $request, + array $callOptions = [] + ): TestPermissionsResponse { return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); } diff --git a/Compute/src/V1/Client/SubnetworksClient.php b/Compute/src/V1/Client/SubnetworksClient.php index 2763fe50b179..6839eb704520 100644 --- a/Compute/src/V1/Client/SubnetworksClient.php +++ b/Compute/src/V1/Client/SubnetworksClient.php @@ -1,6 +1,6 @@ __DIR__ . '/../resources/subnetworks_rest_client_config.php', ], ], - 'operationsClientClass' => RegionOperationsClient::class, ]; } @@ -131,9 +129,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -150,10 +146,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], + 'additionalArgumentMethods' => ['getProject', 'getRegion'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -181,12 +174,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 RegionOperationsClient + */ + 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 RegionOperationsClient($options); + } + /** * Constructor. * @@ -286,8 +300,10 @@ public function __call($method, $args) * * @throws ApiException Thrown if the API call fails. */ - public function aggregatedList(AggregatedListSubnetworksRequest $request, array $callOptions = []): PagedListResponse - { + public function aggregatedList( + AggregatedListSubnetworksRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('AggregatedList', $request, $callOptions); } @@ -338,8 +354,10 @@ public function delete(DeleteSubnetworkRequest $request, array $callOptions = [] * * @throws ApiException Thrown if the API call fails. */ - public function expandIpCidrRange(ExpandIpCidrRangeSubnetworkRequest $request, array $callOptions = []): OperationResponse - { + public function expandIpCidrRange( + ExpandIpCidrRangeSubnetworkRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('ExpandIpCidrRange', $request, $callOptions)->wait(); } @@ -546,8 +564,10 @@ public function setIamPolicy(SetIamPolicySubnetworkRequest $request, array $call * * @throws ApiException Thrown if the API call fails. */ - public function setPrivateIpGoogleAccess(SetPrivateIpGoogleAccessSubnetworkRequest $request, array $callOptions = []): OperationResponse - { + public function setPrivateIpGoogleAccess( + SetPrivateIpGoogleAccessSubnetworkRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('SetPrivateIpGoogleAccess', $request, $callOptions)->wait(); } @@ -572,8 +592,10 @@ public function setPrivateIpGoogleAccess(SetPrivateIpGoogleAccessSubnetworkReque * * @throws ApiException Thrown if the API call fails. */ - public function testIamPermissions(TestIamPermissionsSubnetworkRequest $request, array $callOptions = []): TestPermissionsResponse - { + public function testIamPermissions( + TestIamPermissionsSubnetworkRequest $request, + array $callOptions = [] + ): TestPermissionsResponse { return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); } } diff --git a/Compute/src/V1/Client/TargetGrpcProxiesClient.php b/Compute/src/V1/Client/TargetGrpcProxiesClient.php index ff4c7601f6de..43d8fc738202 100644 --- a/Compute/src/V1/Client/TargetGrpcProxiesClient.php +++ b/Compute/src/V1/Client/TargetGrpcProxiesClient.php @@ -1,6 +1,6 @@ __DIR__ . '/../resources/target_grpc_proxies_rest_client_config.php', ], ], - 'operationsClientClass' => GlobalOperationsClient::class, ]; } @@ -115,9 +113,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -134,9 +130,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - ], + 'additionalArgumentMethods' => ['getProject'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -164,12 +158,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 GlobalOperationsClient + */ + 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 GlobalOperationsClient($options); + } + /** * Constructor. * diff --git a/Compute/src/V1/Client/TargetHttpProxiesClient.php b/Compute/src/V1/Client/TargetHttpProxiesClient.php index c89687202e0d..563503ee8bbc 100644 --- a/Compute/src/V1/Client/TargetHttpProxiesClient.php +++ b/Compute/src/V1/Client/TargetHttpProxiesClient.php @@ -1,6 +1,6 @@ __DIR__ . '/../resources/target_http_proxies_rest_client_config.php', ], ], - 'operationsClientClass' => GlobalOperationsClient::class, ]; } @@ -119,9 +117,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -138,9 +134,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - ], + 'additionalArgumentMethods' => ['getProject'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -168,12 +162,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 GlobalOperationsClient + */ + 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 GlobalOperationsClient($options); + } + /** * Constructor. * @@ -273,8 +288,10 @@ public function __call($method, $args) * * @throws ApiException Thrown if the API call fails. */ - public function aggregatedList(AggregatedListTargetHttpProxiesRequest $request, array $callOptions = []): PagedListResponse - { + public function aggregatedList( + AggregatedListTargetHttpProxiesRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('AggregatedList', $request, $callOptions); } diff --git a/Compute/src/V1/Client/TargetHttpsProxiesClient.php b/Compute/src/V1/Client/TargetHttpsProxiesClient.php index f0e29fdf6187..a91c9074376c 100644 --- a/Compute/src/V1/Client/TargetHttpsProxiesClient.php +++ b/Compute/src/V1/Client/TargetHttpsProxiesClient.php @@ -1,6 +1,6 @@ __DIR__ . '/../resources/target_https_proxies_rest_client_config.php', ], ], - 'operationsClientClass' => GlobalOperationsClient::class, ]; } @@ -127,9 +125,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -146,9 +142,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - ], + 'additionalArgumentMethods' => ['getProject'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -176,12 +170,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 GlobalOperationsClient + */ + 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 GlobalOperationsClient($options); + } + /** * Constructor. * @@ -281,8 +296,10 @@ public function __call($method, $args) * * @throws ApiException Thrown if the API call fails. */ - public function aggregatedList(AggregatedListTargetHttpsProxiesRequest $request, array $callOptions = []): PagedListResponse - { + public function aggregatedList( + AggregatedListTargetHttpsProxiesRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('AggregatedList', $request, $callOptions); } @@ -437,8 +454,10 @@ public function patch(PatchTargetHttpsProxyRequest $request, array $callOptions * * @throws ApiException Thrown if the API call fails. */ - public function setCertificateMap(SetCertificateMapTargetHttpsProxyRequest $request, array $callOptions = []): OperationResponse - { + public function setCertificateMap( + SetCertificateMapTargetHttpsProxyRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('SetCertificateMap', $request, $callOptions)->wait(); } @@ -463,8 +482,10 @@ public function setCertificateMap(SetCertificateMapTargetHttpsProxyRequest $requ * * @throws ApiException Thrown if the API call fails. */ - public function setQuicOverride(SetQuicOverrideTargetHttpsProxyRequest $request, array $callOptions = []): OperationResponse - { + public function setQuicOverride( + SetQuicOverrideTargetHttpsProxyRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('SetQuicOverride', $request, $callOptions)->wait(); } @@ -490,8 +511,10 @@ public function setQuicOverride(SetQuicOverrideTargetHttpsProxyRequest $request, * * @throws ApiException Thrown if the API call fails. */ - public function setSslCertificates(SetSslCertificatesTargetHttpsProxyRequest $request, array $callOptions = []): OperationResponse - { + public function setSslCertificates( + SetSslCertificatesTargetHttpsProxyRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('SetSslCertificates', $request, $callOptions)->wait(); } @@ -516,8 +539,10 @@ public function setSslCertificates(SetSslCertificatesTargetHttpsProxyRequest $re * * @throws ApiException Thrown if the API call fails. */ - public function setSslPolicy(SetSslPolicyTargetHttpsProxyRequest $request, array $callOptions = []): OperationResponse - { + public function setSslPolicy( + SetSslPolicyTargetHttpsProxyRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('SetSslPolicy', $request, $callOptions)->wait(); } diff --git a/Compute/src/V1/Client/TargetInstancesClient.php b/Compute/src/V1/Client/TargetInstancesClient.php index 06969ef2c1e8..6784dcca4266 100644 --- a/Compute/src/V1/Client/TargetInstancesClient.php +++ b/Compute/src/V1/Client/TargetInstancesClient.php @@ -1,6 +1,6 @@ __DIR__ . '/../resources/target_instances_rest_client_config.php', ], ], - 'operationsClientClass' => ZoneOperationsClient::class, ]; } @@ -117,9 +115,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -136,10 +132,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getZone', - ], + 'additionalArgumentMethods' => ['getProject', 'getZone'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -167,12 +160,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 ZoneOperationsClient + */ + 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 ZoneOperationsClient($options); + } + /** * Constructor. * @@ -272,8 +286,10 @@ public function __call($method, $args) * * @throws ApiException Thrown if the API call fails. */ - public function aggregatedList(AggregatedListTargetInstancesRequest $request, array $callOptions = []): PagedListResponse - { + public function aggregatedList( + AggregatedListTargetInstancesRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('AggregatedList', $request, $callOptions); } @@ -402,8 +418,10 @@ public function list(ListTargetInstancesRequest $request, array $callOptions = [ * * @throws ApiException Thrown if the API call fails. */ - public function setSecurityPolicy(SetSecurityPolicyTargetInstanceRequest $request, array $callOptions = []): OperationResponse - { + public function setSecurityPolicy( + SetSecurityPolicyTargetInstanceRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('SetSecurityPolicy', $request, $callOptions)->wait(); } } diff --git a/Compute/src/V1/Client/TargetPoolsClient.php b/Compute/src/V1/Client/TargetPoolsClient.php index df980e7cd2a2..c53f8cea8a52 100644 --- a/Compute/src/V1/Client/TargetPoolsClient.php +++ b/Compute/src/V1/Client/TargetPoolsClient.php @@ -1,6 +1,6 @@ __DIR__ . '/../resources/target_pools_rest_client_config.php', ], ], - 'operationsClientClass' => RegionOperationsClient::class, ]; } @@ -130,9 +128,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -149,10 +145,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], + 'additionalArgumentMethods' => ['getProject', 'getRegion'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -180,12 +173,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 RegionOperationsClient + */ + 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 RegionOperationsClient($options); + } + /** * Constructor. * @@ -337,8 +351,10 @@ public function addInstance(AddInstanceTargetPoolRequest $request, array $callOp * * @throws ApiException Thrown if the API call fails. */ - public function aggregatedList(AggregatedListTargetPoolsRequest $request, array $callOptions = []): PagedListResponse - { + public function aggregatedList( + AggregatedListTargetPoolsRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('AggregatedList', $request, $callOptions); } @@ -493,8 +509,10 @@ public function list(ListTargetPoolsRequest $request, array $callOptions = []): * * @throws ApiException Thrown if the API call fails. */ - public function removeHealthCheck(RemoveHealthCheckTargetPoolRequest $request, array $callOptions = []): OperationResponse - { + public function removeHealthCheck( + RemoveHealthCheckTargetPoolRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('RemoveHealthCheck', $request, $callOptions)->wait(); } @@ -571,8 +589,10 @@ public function setBackup(SetBackupTargetPoolRequest $request, array $callOption * * @throws ApiException Thrown if the API call fails. */ - public function setSecurityPolicy(SetSecurityPolicyTargetPoolRequest $request, array $callOptions = []): OperationResponse - { + public function setSecurityPolicy( + SetSecurityPolicyTargetPoolRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('SetSecurityPolicy', $request, $callOptions)->wait(); } } diff --git a/Compute/src/V1/Client/TargetSslProxiesClient.php b/Compute/src/V1/Client/TargetSslProxiesClient.php index 892cc0e7ae21..3c81dd722fb1 100644 --- a/Compute/src/V1/Client/TargetSslProxiesClient.php +++ b/Compute/src/V1/Client/TargetSslProxiesClient.php @@ -1,6 +1,6 @@ __DIR__ . '/../resources/target_ssl_proxies_rest_client_config.php', ], ], - 'operationsClientClass' => GlobalOperationsClient::class, ]; } @@ -123,9 +121,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -142,9 +138,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - ], + 'additionalArgumentMethods' => ['getProject'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -172,12 +166,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 GlobalOperationsClient + */ + 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 GlobalOperationsClient($options); + } + /** * Constructor. * @@ -381,8 +396,10 @@ public function list(ListTargetSslProxiesRequest $request, array $callOptions = * * @throws ApiException Thrown if the API call fails. */ - public function setBackendService(SetBackendServiceTargetSslProxyRequest $request, array $callOptions = []): OperationResponse - { + public function setBackendService( + SetBackendServiceTargetSslProxyRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('SetBackendService', $request, $callOptions)->wait(); } @@ -407,8 +424,10 @@ public function setBackendService(SetBackendServiceTargetSslProxyRequest $reques * * @throws ApiException Thrown if the API call fails. */ - public function setCertificateMap(SetCertificateMapTargetSslProxyRequest $request, array $callOptions = []): OperationResponse - { + public function setCertificateMap( + SetCertificateMapTargetSslProxyRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('SetCertificateMap', $request, $callOptions)->wait(); } @@ -433,8 +452,10 @@ public function setCertificateMap(SetCertificateMapTargetSslProxyRequest $reques * * @throws ApiException Thrown if the API call fails. */ - public function setProxyHeader(SetProxyHeaderTargetSslProxyRequest $request, array $callOptions = []): OperationResponse - { + public function setProxyHeader( + SetProxyHeaderTargetSslProxyRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('SetProxyHeader', $request, $callOptions)->wait(); } @@ -459,8 +480,10 @@ public function setProxyHeader(SetProxyHeaderTargetSslProxyRequest $request, arr * * @throws ApiException Thrown if the API call fails. */ - public function setSslCertificates(SetSslCertificatesTargetSslProxyRequest $request, array $callOptions = []): OperationResponse - { + public function setSslCertificates( + SetSslCertificatesTargetSslProxyRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('SetSslCertificates', $request, $callOptions)->wait(); } diff --git a/Compute/src/V1/Client/TargetTcpProxiesClient.php b/Compute/src/V1/Client/TargetTcpProxiesClient.php index 542ccf404118..1ce42d94c639 100644 --- a/Compute/src/V1/Client/TargetTcpProxiesClient.php +++ b/Compute/src/V1/Client/TargetTcpProxiesClient.php @@ -1,6 +1,6 @@ __DIR__ . '/../resources/target_tcp_proxies_rest_client_config.php', ], ], - 'operationsClientClass' => GlobalOperationsClient::class, ]; } @@ -119,9 +117,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -138,9 +134,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - ], + 'additionalArgumentMethods' => ['getProject'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -168,12 +162,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 GlobalOperationsClient + */ + 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 GlobalOperationsClient($options); + } + /** * Constructor. * @@ -273,8 +288,10 @@ public function __call($method, $args) * * @throws ApiException Thrown if the API call fails. */ - public function aggregatedList(AggregatedListTargetTcpProxiesRequest $request, array $callOptions = []): PagedListResponse - { + public function aggregatedList( + AggregatedListTargetTcpProxiesRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('AggregatedList', $request, $callOptions); } @@ -403,8 +420,10 @@ public function list(ListTargetTcpProxiesRequest $request, array $callOptions = * * @throws ApiException Thrown if the API call fails. */ - public function setBackendService(SetBackendServiceTargetTcpProxyRequest $request, array $callOptions = []): OperationResponse - { + public function setBackendService( + SetBackendServiceTargetTcpProxyRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('SetBackendService', $request, $callOptions)->wait(); } @@ -429,8 +448,10 @@ public function setBackendService(SetBackendServiceTargetTcpProxyRequest $reques * * @throws ApiException Thrown if the API call fails. */ - public function setProxyHeader(SetProxyHeaderTargetTcpProxyRequest $request, array $callOptions = []): OperationResponse - { + public function setProxyHeader( + SetProxyHeaderTargetTcpProxyRequest $request, + array $callOptions = [] + ): OperationResponse { return $this->startApiCall('SetProxyHeader', $request, $callOptions)->wait(); } } diff --git a/Compute/src/V1/Client/TargetVpnGatewaysClient.php b/Compute/src/V1/Client/TargetVpnGatewaysClient.php index 62e41781af33..18d74a1f5f9b 100644 --- a/Compute/src/V1/Client/TargetVpnGatewaysClient.php +++ b/Compute/src/V1/Client/TargetVpnGatewaysClient.php @@ -1,6 +1,6 @@ __DIR__ . '/../resources/target_vpn_gateways_rest_client_config.php', ], ], - 'operationsClientClass' => RegionOperationsClient::class, ]; } @@ -117,9 +115,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -136,10 +132,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], + 'additionalArgumentMethods' => ['getProject', 'getRegion'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -167,12 +160,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 RegionOperationsClient + */ + 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 RegionOperationsClient($options); + } + /** * Constructor. * @@ -272,8 +286,10 @@ public function __call($method, $args) * * @throws ApiException Thrown if the API call fails. */ - public function aggregatedList(AggregatedListTargetVpnGatewaysRequest $request, array $callOptions = []): PagedListResponse - { + public function aggregatedList( + AggregatedListTargetVpnGatewaysRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('AggregatedList', $request, $callOptions); } diff --git a/Compute/src/V1/Client/UrlMapsClient.php b/Compute/src/V1/Client/UrlMapsClient.php index de4de3ea552c..fee2501429b8 100644 --- a/Compute/src/V1/Client/UrlMapsClient.php +++ b/Compute/src/V1/Client/UrlMapsClient.php @@ -1,6 +1,6 @@ __DIR__ . '/../resources/url_maps_rest_client_config.php', ], ], - 'operationsClientClass' => GlobalOperationsClient::class, ]; } @@ -124,9 +122,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -143,9 +139,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - ], + 'additionalArgumentMethods' => ['getProject'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -173,12 +167,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 GlobalOperationsClient + */ + 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 GlobalOperationsClient($options); + } + /** * Constructor. * @@ -362,7 +377,7 @@ public function insert(InsertUrlMapRequest $request, array $callOptions = []): O } /** - * Initiates a cache invalidation operation, invalidating the specified path, scoped to the specified UrlMap. For more information, see [Invalidating cached content](https://cloud.google.com/cdn/docs/invalidating-cached-content). + * Initiates a cache invalidation operation, invalidating the specified path, scoped to the specified UrlMap. For more information, see [Invalidating cached content](/cdn/docs/invalidating-cached-content). * * The async variant is {@see UrlMapsClient::invalidateCacheAsync()} . * diff --git a/Compute/src/V1/Client/VpnGatewaysClient.php b/Compute/src/V1/Client/VpnGatewaysClient.php index 819a0e75c286..04594b18ba2c 100644 --- a/Compute/src/V1/Client/VpnGatewaysClient.php +++ b/Compute/src/V1/Client/VpnGatewaysClient.php @@ -1,6 +1,6 @@ __DIR__ . '/../resources/vpn_gateways_rest_client_config.php', ], ], - 'operationsClientClass' => RegionOperationsClient::class, ]; } @@ -123,9 +121,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -142,10 +138,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], + 'additionalArgumentMethods' => ['getProject', 'getRegion'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -173,12 +166,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 RegionOperationsClient + */ + 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 RegionOperationsClient($options); + } + /** * Constructor. * @@ -278,8 +292,10 @@ public function __call($method, $args) * * @throws ApiException Thrown if the API call fails. */ - public function aggregatedList(AggregatedListVpnGatewaysRequest $request, array $callOptions = []): PagedListResponse - { + public function aggregatedList( + AggregatedListVpnGatewaysRequest $request, + array $callOptions = [] + ): PagedListResponse { return $this->startApiCall('AggregatedList', $request, $callOptions); } @@ -356,8 +372,10 @@ public function get(GetVpnGatewayRequest $request, array $callOptions = []): Vpn * * @throws ApiException Thrown if the API call fails. */ - public function getStatus(GetStatusVpnGatewayRequest $request, array $callOptions = []): VpnGatewaysGetStatusResponse - { + public function getStatus( + GetStatusVpnGatewayRequest $request, + array $callOptions = [] + ): VpnGatewaysGetStatusResponse { return $this->startApiCall('GetStatus', $request, $callOptions)->wait(); } @@ -460,8 +478,10 @@ public function setLabels(SetLabelsVpnGatewayRequest $request, array $callOption * * @throws ApiException Thrown if the API call fails. */ - public function testIamPermissions(TestIamPermissionsVpnGatewayRequest $request, array $callOptions = []): TestPermissionsResponse - { + public function testIamPermissions( + TestIamPermissionsVpnGatewayRequest $request, + array $callOptions = [] + ): TestPermissionsResponse { return $this->startApiCall('TestIamPermissions', $request, $callOptions)->wait(); } } diff --git a/Compute/src/V1/Client/VpnTunnelsClient.php b/Compute/src/V1/Client/VpnTunnelsClient.php index adcdffc9abfc..56d4fe29e3f2 100644 --- a/Compute/src/V1/Client/VpnTunnelsClient.php +++ b/Compute/src/V1/Client/VpnTunnelsClient.php @@ -1,6 +1,6 @@ __DIR__ . '/../resources/vpn_tunnels_rest_client_config.php', ], ], - 'operationsClientClass' => RegionOperationsClient::class, ]; } @@ -117,9 +115,7 @@ private static function defaultTransport() /** Implements ClientOptionsTrait::supportedTransports. */ private static function supportedTransports() { - return [ - 'rest', - ]; + return ['rest']; } /** @@ -136,10 +132,7 @@ public function getOperationsClient() private function getDefaultOperationDescriptor() { return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], + 'additionalArgumentMethods' => ['getProject', 'getRegion'], 'getOperationMethod' => 'get', 'cancelOperationMethod' => null, 'deleteOperationMethod' => 'delete', @@ -167,12 +160,33 @@ private function getDefaultOperationDescriptor() */ public function resumeOperation($operationName, $methodName = null) { - $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : $this->getDefaultOperationDescriptor(); + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : $this->getDefaultOperationDescriptor(); $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 RegionOperationsClient + */ + 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 RegionOperationsClient($options); + } + /** * Constructor. * diff --git a/Compute/src/V1/Client/ZoneOperationsClient.php b/Compute/src/V1/Client/ZoneOperationsClient.php index 5a4d98fb98f1..3323c6b76dd7 100644 --- a/Compute/src/V1/Client/ZoneOperationsClient.php +++ b/Compute/src/V1/Client/ZoneOperationsClient.php @@ -1,6 +1,6 @@ string firewall_policy = 498173265 [(.google.api.field_behavior) = REQUIRED]; */ - private $firewall_policy = ''; + protected $firewall_policy = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The firewall policy from which to copy rules. * * Generated from protobuf field optional string source_firewall_policy = 25013549; */ - private $source_firewall_policy = null; + protected $source_firewall_policy = null; /** * @param string $firewallPolicy Name of the firewall policy to update. diff --git a/Compute/src/V1/CloneRulesNetworkFirewallPolicyRequest.php b/Compute/src/V1/CloneRulesNetworkFirewallPolicyRequest.php index f763453c3d50..393414f16d35 100644 --- a/Compute/src/V1/CloneRulesNetworkFirewallPolicyRequest.php +++ b/Compute/src/V1/CloneRulesNetworkFirewallPolicyRequest.php @@ -20,25 +20,25 @@ class CloneRulesNetworkFirewallPolicyRequest extends \Google\Protobuf\Internal\M * * Generated from protobuf field string firewall_policy = 498173265 [(.google.api.field_behavior) = REQUIRED]; */ - private $firewall_policy = ''; + protected $firewall_policy = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The firewall policy from which to copy rules. * * Generated from protobuf field optional string source_firewall_policy = 25013549; */ - private $source_firewall_policy = null; + protected $source_firewall_policy = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/CloneRulesRegionNetworkFirewallPolicyRequest.php b/Compute/src/V1/CloneRulesRegionNetworkFirewallPolicyRequest.php index 778242b62372..3a812a3eddab 100644 --- a/Compute/src/V1/CloneRulesRegionNetworkFirewallPolicyRequest.php +++ b/Compute/src/V1/CloneRulesRegionNetworkFirewallPolicyRequest.php @@ -20,31 +20,31 @@ class CloneRulesRegionNetworkFirewallPolicyRequest extends \Google\Protobuf\Inte * * Generated from protobuf field string firewall_policy = 498173265 [(.google.api.field_behavior) = REQUIRED]; */ - private $firewall_policy = ''; + protected $firewall_policy = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The firewall policy from which to copy rules. * * Generated from protobuf field optional string source_firewall_policy = 25013549; */ - private $source_firewall_policy = null; + protected $source_firewall_policy = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/Commitment.php b/Compute/src/V1/Commitment.php index 190279088a5f..d06b32fed988 100644 --- a/Compute/src/V1/Commitment.php +++ b/Compute/src/V1/Commitment.php @@ -20,38 +20,38 @@ class Commitment extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional bool auto_renew = 495520765; */ - private $auto_renew = null; + protected $auto_renew = null; /** * The category of the commitment; specifies whether the commitment is for hardware or software resources. Category MACHINE specifies that you are committing to hardware machine resources such as VCPU or MEMORY, listed in resources. Category LICENSE specifies that you are committing to software licenses, listed in licenseResources. Note that if you specify MACHINE commitments, then you must also specify a type to indicate the machine series of the hardware resource that you are committing to. * Check the Category enum for the list of possible values. * * Generated from protobuf field optional string category = 50511102; */ - private $category = null; + protected $category = null; /** * [Output Only] Creation timestamp in RFC3339 text format. * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * [Input Only] Optional, specifies the requested commitment end time in RFC3339 text format. Use this option when the desired commitment's end date is later than the start date + term duration. * * Generated from protobuf field optional string custom_end_timestamp = 181770852; */ - private $custom_end_timestamp = null; + protected $custom_end_timestamp = null; /** * An optional description of the commitment. You can provide this property when you create the resource. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * [Output Only] Commitment end time in RFC3339 text format. * * Generated from protobuf field optional string end_timestamp = 468096690; */ - private $end_timestamp = null; + protected $end_timestamp = null; /** * Generated from protobuf field repeated string existing_reservations = 493028443; */ @@ -61,19 +61,19 @@ class Commitment extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * [Output Only] Type of the resource. Always compute#commitment for commitments. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * The license specification required as part of a license commitment. * * Generated from protobuf field optional .google.cloud.compute.v1.LicenseResourceCommitment license_resource = 437955148; */ - private $license_resource = null; + protected $license_resource = null; /** * The list of source commitments that you are merging to create the new merged commitment. For more information, see Merging commitments. * @@ -85,20 +85,20 @@ class Commitment extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * The minimum time duration that you commit to purchasing resources. The plan that you choose determines the preset term length of the commitment (which is 1 year or 3 years) and affects the discount rate that you receive for your resources. Committing to a longer time duration typically gives you a higher discount rate. The supported values for this field are TWELVE_MONTH (1 year), and THIRTY_SIX_MONTH (3 years). * Check the Plan enum for the list of possible values. * * Generated from protobuf field optional string plan = 3443497; */ - private $plan = null; + protected $plan = null; /** * [Output Only] URL of the region where the commitment and committed resources are located. * * Generated from protobuf field optional string region = 138946292; */ - private $region = null; + protected $region = null; /** * The list of new reservations that you want to create and attach to this commitment. You must attach reservations to your commitment if your commitment specifies any GPUs or Local SSD disks. For more information, see Attach reservations to resource-based commitments. Specify this property only if you want to create new reservations to attach. To attach existing reservations, specify the existingReservations property instead. * @@ -110,7 +110,7 @@ class Commitment extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.CommitmentResourceStatus resource_status = 249429315; */ - private $resource_status = null; + protected $resource_status = null; /** * The list of all the hardware resources, with their types and amounts, that you want to commit to. Specify as a separate entry in the list for each individual resource type. * @@ -122,39 +122,39 @@ class Commitment extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * The source commitment from which you are transferring resources to create the new split commitment. For more information, see Split commitments. * * Generated from protobuf field optional string split_source_commitment = 402611156; */ - private $split_source_commitment = null; + protected $split_source_commitment = null; /** * [Output Only] Commitment start time in RFC3339 text format. * * Generated from protobuf field optional string start_timestamp = 83645817; */ - private $start_timestamp = null; + protected $start_timestamp = null; /** * [Output Only] Status of the commitment with regards to eventual expiration (each commitment has an end date defined). Status can be one of the following values: NOT_YET_ACTIVE, ACTIVE, or EXPIRED. * Check the Status enum for the list of possible values. * * Generated from protobuf field optional string status = 181260274; */ - private $status = null; + protected $status = null; /** * [Output Only] An optional, human-readable explanation of the status. * * Generated from protobuf field optional string status_message = 297428154; */ - private $status_message = null; + protected $status_message = null; /** * The type of commitment; specifies the machine series for which you want to commit to purchasing resources. The choice of machine series affects the discount rate and the eligible resource types. The type must be one of the following: ACCELERATOR_OPTIMIZED, ACCELERATOR_OPTIMIZED_A3, ACCELERATOR_OPTIMIZED_A3_MEGA, COMPUTE_OPTIMIZED, COMPUTE_OPTIMIZED_C2D, COMPUTE_OPTIMIZED_C3, COMPUTE_OPTIMIZED_C3D, COMPUTE_OPTIMIZED_H3, GENERAL_PURPOSE, GENERAL_PURPOSE_C4, GENERAL_PURPOSE_E2, GENERAL_PURPOSE_N2, GENERAL_PURPOSE_N2D, GENERAL_PURPOSE_N4, GENERAL_PURPOSE_T2D, GRAPHICS_OPTIMIZED, MEMORY_OPTIMIZED, MEMORY_OPTIMIZED_M3, MEMORY_OPTIMIZED_X4, STORAGE_OPTIMIZED_Z3. For example, type MEMORY_OPTIMIZED specifies a commitment that applies only to eligible resources of memory optimized M1 and M2 machine series. Type GENERAL_PURPOSE specifies a commitment that applies only to eligible resources of general purpose N1 machine series. * Check the Type enum for the list of possible values. * * Generated from protobuf field optional string type = 3575610; */ - private $type = null; + protected $type = null; /** * Constructor. diff --git a/Compute/src/V1/CommitmentAggregatedList.php b/Compute/src/V1/CommitmentAggregatedList.php index 330a55eee99c..b1a63b295e64 100644 --- a/Compute/src/V1/CommitmentAggregatedList.php +++ b/Compute/src/V1/CommitmentAggregatedList.php @@ -19,7 +19,7 @@ class CommitmentAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of CommitmentsScopedList resources. * @@ -31,19 +31,19 @@ class CommitmentAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Unreachable resources. * @@ -55,7 +55,7 @@ class CommitmentAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/CommitmentList.php b/Compute/src/V1/CommitmentList.php index cf7354e3d4f8..0452101976dc 100644 --- a/Compute/src/V1/CommitmentList.php +++ b/Compute/src/V1/CommitmentList.php @@ -20,7 +20,7 @@ class CommitmentList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of Commitment resources. * @@ -32,25 +32,25 @@ class CommitmentList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/CommitmentResourceStatus.php b/Compute/src/V1/CommitmentResourceStatus.php index 8c40ab7f6b16..9803184c5f75 100644 --- a/Compute/src/V1/CommitmentResourceStatus.php +++ b/Compute/src/V1/CommitmentResourceStatus.php @@ -20,7 +20,7 @@ class CommitmentResourceStatus extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string custom_term_eligibility_end_timestamp = 363976187; */ - private $custom_term_eligibility_end_timestamp = null; + protected $custom_term_eligibility_end_timestamp = null; /** * Constructor. diff --git a/Compute/src/V1/CommitmentsScopedList.php b/Compute/src/V1/CommitmentsScopedList.php index 8a5de7bd5c1a..d6b84033f228 100644 --- a/Compute/src/V1/CommitmentsScopedList.php +++ b/Compute/src/V1/CommitmentsScopedList.php @@ -25,7 +25,7 @@ class CommitmentsScopedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/Condition.php b/Compute/src/V1/Condition.php deleted file mode 100644 index b8ce7b6eb729..000000000000 --- a/Compute/src/V1/Condition.php +++ /dev/null @@ -1,255 +0,0 @@ -google.cloud.compute.v1.Condition - */ -class Condition extends \Google\Protobuf\Internal\Message -{ - /** - * This is deprecated and has no effect. Do not use. - * Check the Iam enum for the list of possible values. - * - * Generated from protobuf field optional string iam = 104021; - */ - private $iam = null; - /** - * This is deprecated and has no effect. Do not use. - * Check the Op enum for the list of possible values. - * - * Generated from protobuf field optional string op = 3553; - */ - private $op = null; - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf field optional string svc = 114272; - */ - private $svc = null; - /** - * This is deprecated and has no effect. Do not use. - * Check the Sys enum for the list of possible values. - * - * Generated from protobuf field optional string sys = 114381; - */ - private $sys = null; - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf field repeated string values = 249928994; - */ - private $values; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $iam - * This is deprecated and has no effect. Do not use. - * Check the Iam enum for the list of possible values. - * @type string $op - * This is deprecated and has no effect. Do not use. - * Check the Op enum for the list of possible values. - * @type string $svc - * This is deprecated and has no effect. Do not use. - * @type string $sys - * This is deprecated and has no effect. Do not use. - * Check the Sys enum for the list of possible values. - * @type array|\Google\Protobuf\Internal\RepeatedField $values - * This is deprecated and has no effect. Do not use. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Compute\V1\Compute::initOnce(); - parent::__construct($data); - } - - /** - * This is deprecated and has no effect. Do not use. - * Check the Iam enum for the list of possible values. - * - * Generated from protobuf field optional string iam = 104021; - * @return string - */ - public function getIam() - { - return isset($this->iam) ? $this->iam : ''; - } - - public function hasIam() - { - return isset($this->iam); - } - - public function clearIam() - { - unset($this->iam); - } - - /** - * This is deprecated and has no effect. Do not use. - * Check the Iam enum for the list of possible values. - * - * Generated from protobuf field optional string iam = 104021; - * @param string $var - * @return $this - */ - public function setIam($var) - { - GPBUtil::checkString($var, True); - $this->iam = $var; - - return $this; - } - - /** - * This is deprecated and has no effect. Do not use. - * Check the Op enum for the list of possible values. - * - * Generated from protobuf field optional string op = 3553; - * @return string - */ - public function getOp() - { - return isset($this->op) ? $this->op : ''; - } - - public function hasOp() - { - return isset($this->op); - } - - public function clearOp() - { - unset($this->op); - } - - /** - * This is deprecated and has no effect. Do not use. - * Check the Op enum for the list of possible values. - * - * Generated from protobuf field optional string op = 3553; - * @param string $var - * @return $this - */ - public function setOp($var) - { - GPBUtil::checkString($var, True); - $this->op = $var; - - return $this; - } - - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf field optional string svc = 114272; - * @return string - */ - public function getSvc() - { - return isset($this->svc) ? $this->svc : ''; - } - - public function hasSvc() - { - return isset($this->svc); - } - - public function clearSvc() - { - unset($this->svc); - } - - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf field optional string svc = 114272; - * @param string $var - * @return $this - */ - public function setSvc($var) - { - GPBUtil::checkString($var, True); - $this->svc = $var; - - return $this; - } - - /** - * This is deprecated and has no effect. Do not use. - * Check the Sys enum for the list of possible values. - * - * Generated from protobuf field optional string sys = 114381; - * @return string - */ - public function getSys() - { - return isset($this->sys) ? $this->sys : ''; - } - - public function hasSys() - { - return isset($this->sys); - } - - public function clearSys() - { - unset($this->sys); - } - - /** - * This is deprecated and has no effect. Do not use. - * Check the Sys enum for the list of possible values. - * - * Generated from protobuf field optional string sys = 114381; - * @param string $var - * @return $this - */ - public function setSys($var) - { - GPBUtil::checkString($var, True); - $this->sys = $var; - - return $this; - } - - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf field repeated string values = 249928994; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getValues() - { - return $this->values; - } - - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf field repeated string values = 249928994; - * @param array|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setValues($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); - $this->values = $arr; - - return $this; - } - -} - diff --git a/Compute/src/V1/Condition/Iam.php b/Compute/src/V1/Condition/Iam.php deleted file mode 100644 index 6b42a85692c1..000000000000 --- a/Compute/src/V1/Condition/Iam.php +++ /dev/null @@ -1,99 +0,0 @@ -google.cloud.compute.v1.Condition.Iam - */ -class Iam -{ - /** - * A value indicating that the enum field is not set. - * - * Generated from protobuf enum UNDEFINED_IAM = 0; - */ - const UNDEFINED_IAM = 0; - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf enum APPROVER = 357258949; - */ - const APPROVER = 357258949; - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf enum ATTRIBUTION = 232465503; - */ - const ATTRIBUTION = 232465503; - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf enum AUTHORITY = 504108835; - */ - const AUTHORITY = 504108835; - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf enum CREDENTIALS_TYPE = 348222141; - */ - const CREDENTIALS_TYPE = 348222141; - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf enum CREDS_ASSERTION = 332343272; - */ - const CREDS_ASSERTION = 332343272; - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf enum JUSTIFICATION_TYPE = 206147719; - */ - const JUSTIFICATION_TYPE = 206147719; - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf enum SECURITY_REALM = 526269616; - */ - const SECURITY_REALM = 526269616; - - private static $valueToName = [ - self::UNDEFINED_IAM => 'UNDEFINED_IAM', - self::APPROVER => 'APPROVER', - self::ATTRIBUTION => 'ATTRIBUTION', - self::AUTHORITY => 'AUTHORITY', - self::CREDENTIALS_TYPE => 'CREDENTIALS_TYPE', - self::CREDS_ASSERTION => 'CREDS_ASSERTION', - self::JUSTIFICATION_TYPE => 'JUSTIFICATION_TYPE', - self::SECURITY_REALM => 'SECURITY_REALM', - ]; - - 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/Compute/src/V1/Condition/Op.php b/Compute/src/V1/Condition/Op.php deleted file mode 100644 index 6b9bdca6ae3f..000000000000 --- a/Compute/src/V1/Condition/Op.php +++ /dev/null @@ -1,90 +0,0 @@ -google.cloud.compute.v1.Condition.Op - */ -class Op -{ - /** - * A value indicating that the enum field is not set. - * - * Generated from protobuf enum UNDEFINED_OP = 0; - */ - const UNDEFINED_OP = 0; - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf enum DISCHARGED = 266338274; - */ - const DISCHARGED = 266338274; - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf enum EQUALS = 442201023; - */ - const EQUALS = 442201023; - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf enum IN = 2341; - */ - const IN = 2341; - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf enum NOT_EQUALS = 19718859; - */ - const NOT_EQUALS = 19718859; - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf enum NOT_IN = 161144369; - */ - const NOT_IN = 161144369; - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf enum NO_OP = 74481951; - */ - const NO_OP = 74481951; - - private static $valueToName = [ - self::UNDEFINED_OP => 'UNDEFINED_OP', - self::DISCHARGED => 'DISCHARGED', - self::EQUALS => 'EQUALS', - self::IN => 'IN', - self::NOT_EQUALS => 'NOT_EQUALS', - self::NOT_IN => 'NOT_IN', - self::NO_OP => 'NO_OP', - ]; - - 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/Compute/src/V1/Condition/Sys.php b/Compute/src/V1/Condition/Sys.php deleted file mode 100644 index 598a72380b0d..000000000000 --- a/Compute/src/V1/Condition/Sys.php +++ /dev/null @@ -1,78 +0,0 @@ -google.cloud.compute.v1.Condition.Sys - */ -class Sys -{ - /** - * A value indicating that the enum field is not set. - * - * Generated from protobuf enum UNDEFINED_SYS = 0; - */ - const UNDEFINED_SYS = 0; - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf enum IP = 2343; - */ - const IP = 2343; - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf enum NAME = 2388619; - */ - const NAME = 2388619; - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf enum REGION = 266017524; - */ - const REGION = 266017524; - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf enum SERVICE = 17781397; - */ - const SERVICE = 17781397; - - private static $valueToName = [ - self::UNDEFINED_SYS => 'UNDEFINED_SYS', - self::IP => 'IP', - self::NAME => 'NAME', - self::REGION => 'REGION', - self::SERVICE => 'SERVICE', - ]; - - 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/Compute/src/V1/ConfidentialInstanceConfig.php b/Compute/src/V1/ConfidentialInstanceConfig.php index da315589680e..2e33e1d9eada 100644 --- a/Compute/src/V1/ConfidentialInstanceConfig.php +++ b/Compute/src/V1/ConfidentialInstanceConfig.php @@ -21,13 +21,13 @@ class ConfidentialInstanceConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string confidential_instance_type = 43484717; */ - private $confidential_instance_type = null; + protected $confidential_instance_type = null; /** * Defines whether the instance should have confidential compute enabled. * * Generated from protobuf field optional bool enable_confidential_compute = 102135228; */ - private $enable_confidential_compute = null; + protected $enable_confidential_compute = null; /** * Constructor. diff --git a/Compute/src/V1/ConnectionDraining.php b/Compute/src/V1/ConnectionDraining.php index 1972f69e84ac..18e70071893a 100644 --- a/Compute/src/V1/ConnectionDraining.php +++ b/Compute/src/V1/ConnectionDraining.php @@ -20,7 +20,7 @@ class ConnectionDraining extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int32 draining_timeout_sec = 225127070; */ - private $draining_timeout_sec = null; + protected $draining_timeout_sec = null; /** * Constructor. diff --git a/Compute/src/V1/ConsistentHashLoadBalancerSettings.php b/Compute/src/V1/ConsistentHashLoadBalancerSettings.php index 4642fd85cf4f..c1f481293536 100644 --- a/Compute/src/V1/ConsistentHashLoadBalancerSettings.php +++ b/Compute/src/V1/ConsistentHashLoadBalancerSettings.php @@ -20,19 +20,19 @@ class ConsistentHashLoadBalancerSettings extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field optional .google.cloud.compute.v1.ConsistentHashLoadBalancerSettingsHttpCookie http_cookie = 6673915; */ - private $http_cookie = null; + protected $http_cookie = null; /** * The hash based on the value of the specified header field. This field is applicable if the sessionAffinity is set to HEADER_FIELD. * * Generated from protobuf field optional string http_header_name = 234798022; */ - private $http_header_name = null; + protected $http_header_name = null; /** * The minimum number of virtual nodes to use for the hash ring. Defaults to 1024. Larger ring sizes result in more granular load distributions. If the number of hosts in the load balancing pool is larger than the ring size, each host will be assigned a single virtual node. * * Generated from protobuf field optional int64 minimum_ring_size = 234380735; */ - private $minimum_ring_size = null; + protected $minimum_ring_size = null; /** * Constructor. diff --git a/Compute/src/V1/ConsistentHashLoadBalancerSettingsHttpCookie.php b/Compute/src/V1/ConsistentHashLoadBalancerSettingsHttpCookie.php index c545e97b89eb..964b87a9026c 100644 --- a/Compute/src/V1/ConsistentHashLoadBalancerSettingsHttpCookie.php +++ b/Compute/src/V1/ConsistentHashLoadBalancerSettingsHttpCookie.php @@ -20,19 +20,19 @@ class ConsistentHashLoadBalancerSettingsHttpCookie extends \Google\Protobuf\Inte * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * Path to set for the cookie. * * Generated from protobuf field optional string path = 3433509; */ - private $path = null; + protected $path = null; /** * Lifetime of the cookie. * * Generated from protobuf field optional .google.cloud.compute.v1.Duration ttl = 115180; */ - private $ttl = null; + protected $ttl = null; /** * Constructor. diff --git a/Compute/src/V1/CorsPolicy.php b/Compute/src/V1/CorsPolicy.php index ce35bedbf30f..fda854a647c1 100644 --- a/Compute/src/V1/CorsPolicy.php +++ b/Compute/src/V1/CorsPolicy.php @@ -20,7 +20,7 @@ class CorsPolicy extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional bool allow_credentials = 481263366; */ - private $allow_credentials = null; + protected $allow_credentials = null; /** * Specifies the content for the Access-Control-Allow-Headers header. * @@ -50,7 +50,7 @@ class CorsPolicy extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional bool disabled = 270940796; */ - private $disabled = null; + protected $disabled = null; /** * Specifies the content for the Access-Control-Expose-Headers header. * @@ -62,7 +62,7 @@ class CorsPolicy extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int32 max_age = 307559332; */ - private $max_age = null; + protected $max_age = null; /** * Constructor. diff --git a/Compute/src/V1/CreateInstancesInstanceGroupManagerRequest.php b/Compute/src/V1/CreateInstancesInstanceGroupManagerRequest.php index 85d78b63ae21..d51a8dabea87 100644 --- a/Compute/src/V1/CreateInstancesInstanceGroupManagerRequest.php +++ b/Compute/src/V1/CreateInstancesInstanceGroupManagerRequest.php @@ -20,31 +20,31 @@ class CreateInstancesInstanceGroupManagerRequest extends \Google\Protobuf\Intern * * Generated from protobuf field string instance_group_manager = 249363395 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group_manager = ''; + protected $instance_group_manager = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.InstanceGroupManagersCreateInstancesRequest instance_group_managers_create_instances_request_resource = 24558867 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group_managers_create_instances_request_resource = null; + protected $instance_group_managers_create_instances_request_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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. 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 optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone where the managed instance group is located. It should conform to RFC1035. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/CreateInstancesRegionInstanceGroupManagerRequest.php b/Compute/src/V1/CreateInstancesRegionInstanceGroupManagerRequest.php index a2a23842804b..799663b8e322 100644 --- a/Compute/src/V1/CreateInstancesRegionInstanceGroupManagerRequest.php +++ b/Compute/src/V1/CreateInstancesRegionInstanceGroupManagerRequest.php @@ -20,31 +20,31 @@ class CreateInstancesRegionInstanceGroupManagerRequest extends \Google\Protobuf\ * * Generated from protobuf field string instance_group_manager = 249363395 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group_manager = ''; + protected $instance_group_manager = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * The name of the region where the managed instance group is located. It should conform to RFC1035. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.RegionInstanceGroupManagersCreateInstancesRequest region_instance_group_managers_create_instances_request_resource = 359014280 [(.google.api.field_behavior) = REQUIRED]; */ - private $region_instance_group_managers_create_instances_request_resource = null; + protected $region_instance_group_managers_create_instances_request_resource = null; /** * 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. 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. 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 optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/CreateMembersInterconnectGroupRequest.php b/Compute/src/V1/CreateMembersInterconnectGroupRequest.php index 4473dd76e75c..2969fbef219d 100644 --- a/Compute/src/V1/CreateMembersInterconnectGroupRequest.php +++ b/Compute/src/V1/CreateMembersInterconnectGroupRequest.php @@ -20,19 +20,19 @@ class CreateMembersInterconnectGroupRequest extends \Google\Protobuf\Internal\Me * * Generated from protobuf field string interconnect_group = 388651918 [(.google.api.field_behavior) = REQUIRED]; */ - private $interconnect_group = ''; + protected $interconnect_group = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.InterconnectGroupsCreateMembersRequest interconnect_groups_create_members_request_resource = 348323437 [(.google.api.field_behavior) = REQUIRED]; */ - private $interconnect_groups_create_members_request_resource = null; + protected $interconnect_groups_create_members_request_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/CreateSnapshotDiskRequest.php b/Compute/src/V1/CreateSnapshotDiskRequest.php index 40e72ff6e4ae..3f2f81645bb9 100644 --- a/Compute/src/V1/CreateSnapshotDiskRequest.php +++ b/Compute/src/V1/CreateSnapshotDiskRequest.php @@ -20,37 +20,37 @@ class CreateSnapshotDiskRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string disk = 3083677 [(.google.api.field_behavior) = REQUIRED]; */ - private $disk = ''; + protected $disk = ''; /** * [Input Only] Whether to attempt an application consistent snapshot by informing the OS to prepare for the snapshot process. * * Generated from protobuf field optional bool guest_flush = 385550813; */ - private $guest_flush = null; + protected $guest_flush = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.Snapshot snapshot_resource = 481319977 [(.google.api.field_behavior) = REQUIRED]; */ - private $snapshot_resource = null; + protected $snapshot_resource = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/CreateSnapshotRegionDiskRequest.php b/Compute/src/V1/CreateSnapshotRegionDiskRequest.php index 8eda42de5afa..e4586e901089 100644 --- a/Compute/src/V1/CreateSnapshotRegionDiskRequest.php +++ b/Compute/src/V1/CreateSnapshotRegionDiskRequest.php @@ -20,31 +20,31 @@ class CreateSnapshotRegionDiskRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string disk = 3083677 [(.google.api.field_behavior) = REQUIRED]; */ - private $disk = ''; + protected $disk = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.Snapshot snapshot_resource = 481319977 [(.google.api.field_behavior) = REQUIRED]; */ - private $snapshot_resource = null; + protected $snapshot_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/CustomErrorResponsePolicy.php b/Compute/src/V1/CustomErrorResponsePolicy.php index eb63b50c6624..25a44acdc4e4 100644 --- a/Compute/src/V1/CustomErrorResponsePolicy.php +++ b/Compute/src/V1/CustomErrorResponsePolicy.php @@ -26,7 +26,7 @@ class CustomErrorResponsePolicy extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string error_service = 164214654; */ - private $error_service = null; + protected $error_service = null; /** * Constructor. diff --git a/Compute/src/V1/CustomErrorResponsePolicyCustomErrorResponseRule.php b/Compute/src/V1/CustomErrorResponsePolicyCustomErrorResponseRule.php index 4a17fd4f579b..4c1a744e7d3b 100644 --- a/Compute/src/V1/CustomErrorResponsePolicyCustomErrorResponseRule.php +++ b/Compute/src/V1/CustomErrorResponsePolicyCustomErrorResponseRule.php @@ -26,13 +26,13 @@ class CustomErrorResponsePolicyCustomErrorResponseRule extends \Google\Protobuf\ * * Generated from protobuf field optional int32 override_response_code = 530328568; */ - private $override_response_code = null; + protected $override_response_code = null; /** * The full path to a file within backendBucket . For example: /errors/defaultError.html path must start with a leading slash. path cannot have trailing slashes. If the file is not available in backendBucket or the load balancer cannot reach the BackendBucket, a simple Not Found Error is returned to the client. The value must be from 1 to 1024 characters * * Generated from protobuf field optional string path = 3433509; */ - private $path = null; + protected $path = null; /** * Constructor. diff --git a/Compute/src/V1/CustomerEncryptionKey.php b/Compute/src/V1/CustomerEncryptionKey.php index ead9e8a9519c..668e43d26db7 100644 --- a/Compute/src/V1/CustomerEncryptionKey.php +++ b/Compute/src/V1/CustomerEncryptionKey.php @@ -19,31 +19,31 @@ class CustomerEncryptionKey extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kms_key_name = 484373913; */ - private $kms_key_name = null; + protected $kms_key_name = null; /** * The service account being used for the encryption request for the given KMS key. If absent, the Compute Engine default service account is used. For example: "kmsKeyServiceAccount": "name@project_id.iam.gserviceaccount.com/ * * Generated from protobuf field optional string kms_key_service_account = 209986261; */ - private $kms_key_service_account = null; + protected $kms_key_service_account = null; /** * Specifies a 256-bit customer-supplied encryption key, encoded in RFC 4648 base64 to either encrypt or decrypt this resource. You can provide either the rawKey or the rsaEncryptedKey. For example: "rawKey": "SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=" * * Generated from protobuf field optional string raw_key = 449196488; */ - private $raw_key = null; + protected $raw_key = null; /** * Specifies an RFC 4648 base64 encoded, RSA-wrapped 2048-bit customer-supplied encryption key to either encrypt or decrypt this resource. You can provide either the rawKey or the rsaEncryptedKey. For example: "rsaEncryptedKey": "ieCx/NcW06PcT7Ep1X6LUTc/hLvUDYyzSZPPVCVPTVEohpeHASqC8uw5TzyO9U+Fka9JFH z0mBibXUInrC/jEk014kCK/NPjYgEMOyssZ4ZINPKxlUh2zn1bV+MCaTICrdmuSBTWlUUiFoD D6PYznLwh8ZNdaheCeZ8ewEXgFQ8V+sDroLaN3Xs3MDTXQEMMoNUXMCZEIpg9Vtp9x2oe==" The key must meet the following requirements before you can provide it to Compute Engine: 1. The key is wrapped using a RSA public key certificate provided by Google. 2. After being wrapped, the key must be encoded in RFC 4648 base64 encoding. Gets the RSA public key certificate provided by Google at: https://cloud-certs.storage.googleapis.com/google-cloud-csek-ingress.pem * * Generated from protobuf field optional string rsa_encrypted_key = 335487397; */ - private $rsa_encrypted_key = null; + protected $rsa_encrypted_key = null; /** * [Output only] The RFC 4648 base64 encoded SHA-256 hash of the customer-supplied encryption key that protects this resource. * * Generated from protobuf field optional string sha256 = 170112551; */ - private $sha256 = null; + protected $sha256 = null; /** * Constructor. diff --git a/Compute/src/V1/CustomerEncryptionKeyProtectedDisk.php b/Compute/src/V1/CustomerEncryptionKeyProtectedDisk.php index e2c40a707b79..cd4ca6141b55 100644 --- a/Compute/src/V1/CustomerEncryptionKeyProtectedDisk.php +++ b/Compute/src/V1/CustomerEncryptionKeyProtectedDisk.php @@ -19,13 +19,13 @@ class CustomerEncryptionKeyProtectedDisk extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field optional .google.cloud.compute.v1.CustomerEncryptionKey disk_encryption_key = 271660677; */ - private $disk_encryption_key = null; + protected $disk_encryption_key = null; /** * Specifies a valid partial or full URL to an existing Persistent Disk resource. This field is only applicable for persistent disks. For example: "source": "/compute/v1/projects/project_id/zones/zone/disks/ disk_name * * Generated from protobuf field optional string source = 177235995; */ - private $source = null; + protected $source = null; /** * Constructor. diff --git a/Compute/src/V1/Data.php b/Compute/src/V1/Data.php index 17ffc8b83761..182d0504db39 100644 --- a/Compute/src/V1/Data.php +++ b/Compute/src/V1/Data.php @@ -19,13 +19,13 @@ class Data extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string key = 106079; */ - private $key = null; + protected $key = null; /** * [Output Only] A warning data value corresponding to the key. * * Generated from protobuf field optional string value = 111972721; */ - private $value = null; + protected $value = null; /** * Constructor. diff --git a/Compute/src/V1/DeleteAccessConfigInstanceRequest.php b/Compute/src/V1/DeleteAccessConfigInstanceRequest.php index 6ceb2f2bfbc5..83808a46a0ac 100644 --- a/Compute/src/V1/DeleteAccessConfigInstanceRequest.php +++ b/Compute/src/V1/DeleteAccessConfigInstanceRequest.php @@ -20,37 +20,37 @@ class DeleteAccessConfigInstanceRequest extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field string access_config = 72856189 [(.google.api.field_behavior) = REQUIRED]; */ - private $access_config = ''; + protected $access_config = ''; /** * The instance name for this request. * * Generated from protobuf field string instance = 18257045 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance = ''; + protected $instance = ''; /** * The name of the network interface. * * Generated from protobuf field string network_interface = 365387880 [(.google.api.field_behavior) = REQUIRED]; */ - private $network_interface = ''; + protected $network_interface = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteAddressRequest.php b/Compute/src/V1/DeleteAddressRequest.php index b52fd0dd029e..a11c30051a82 100644 --- a/Compute/src/V1/DeleteAddressRequest.php +++ b/Compute/src/V1/DeleteAddressRequest.php @@ -20,25 +20,25 @@ class DeleteAddressRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string address = 462920692 [(.google.api.field_behavior) = REQUIRED]; */ - private $address = ''; + protected $address = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteAutoscalerRequest.php b/Compute/src/V1/DeleteAutoscalerRequest.php index 270b75d24139..c67c60b3b9f3 100644 --- a/Compute/src/V1/DeleteAutoscalerRequest.php +++ b/Compute/src/V1/DeleteAutoscalerRequest.php @@ -20,25 +20,25 @@ class DeleteAutoscalerRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string autoscaler = 517258967 [(.google.api.field_behavior) = REQUIRED]; */ - private $autoscaler = ''; + protected $autoscaler = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteBackendBucketRequest.php b/Compute/src/V1/DeleteBackendBucketRequest.php index ef35a2897b0c..4a24375dee05 100644 --- a/Compute/src/V1/DeleteBackendBucketRequest.php +++ b/Compute/src/V1/DeleteBackendBucketRequest.php @@ -20,19 +20,19 @@ class DeleteBackendBucketRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string backend_bucket = 91714037 [(.google.api.field_behavior) = REQUIRED]; */ - private $backend_bucket = ''; + protected $backend_bucket = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteBackendServiceRequest.php b/Compute/src/V1/DeleteBackendServiceRequest.php index 30bdefa71bb5..651a6177bf8c 100644 --- a/Compute/src/V1/DeleteBackendServiceRequest.php +++ b/Compute/src/V1/DeleteBackendServiceRequest.php @@ -20,19 +20,19 @@ class DeleteBackendServiceRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string backend_service = 306946058 [(.google.api.field_behavior) = REQUIRED]; */ - private $backend_service = ''; + protected $backend_service = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteDiskRequest.php b/Compute/src/V1/DeleteDiskRequest.php index 3215790bbd38..e63a19c54995 100644 --- a/Compute/src/V1/DeleteDiskRequest.php +++ b/Compute/src/V1/DeleteDiskRequest.php @@ -20,25 +20,25 @@ class DeleteDiskRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string disk = 3083677 [(.google.api.field_behavior) = REQUIRED]; */ - private $disk = ''; + protected $disk = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteExternalVpnGatewayRequest.php b/Compute/src/V1/DeleteExternalVpnGatewayRequest.php index 83af902b3749..55b4b2204962 100644 --- a/Compute/src/V1/DeleteExternalVpnGatewayRequest.php +++ b/Compute/src/V1/DeleteExternalVpnGatewayRequest.php @@ -20,19 +20,19 @@ class DeleteExternalVpnGatewayRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string external_vpn_gateway = 109898629 [(.google.api.field_behavior) = REQUIRED]; */ - private $external_vpn_gateway = ''; + protected $external_vpn_gateway = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteFirewallPolicyRequest.php b/Compute/src/V1/DeleteFirewallPolicyRequest.php index 0c4987a45057..5a92dc55f450 100644 --- a/Compute/src/V1/DeleteFirewallPolicyRequest.php +++ b/Compute/src/V1/DeleteFirewallPolicyRequest.php @@ -20,13 +20,13 @@ class DeleteFirewallPolicyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string firewall_policy = 498173265 [(.google.api.field_behavior) = REQUIRED]; */ - private $firewall_policy = ''; + protected $firewall_policy = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $firewallPolicy Name of the firewall policy to delete. diff --git a/Compute/src/V1/DeleteFirewallRequest.php b/Compute/src/V1/DeleteFirewallRequest.php index efb9d4a0c914..af6ab6708021 100644 --- a/Compute/src/V1/DeleteFirewallRequest.php +++ b/Compute/src/V1/DeleteFirewallRequest.php @@ -20,19 +20,19 @@ class DeleteFirewallRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string firewall = 511016192 [(.google.api.field_behavior) = REQUIRED]; */ - private $firewall = ''; + protected $firewall = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteForwardingRuleRequest.php b/Compute/src/V1/DeleteForwardingRuleRequest.php index 0a92007ba879..50054e9a73c7 100644 --- a/Compute/src/V1/DeleteForwardingRuleRequest.php +++ b/Compute/src/V1/DeleteForwardingRuleRequest.php @@ -20,25 +20,25 @@ class DeleteForwardingRuleRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string forwarding_rule = 269964030 [(.google.api.field_behavior) = REQUIRED]; */ - private $forwarding_rule = ''; + protected $forwarding_rule = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteGlobalAddressRequest.php b/Compute/src/V1/DeleteGlobalAddressRequest.php index 7a73f1c7e3b0..fd095f71804e 100644 --- a/Compute/src/V1/DeleteGlobalAddressRequest.php +++ b/Compute/src/V1/DeleteGlobalAddressRequest.php @@ -20,19 +20,19 @@ class DeleteGlobalAddressRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string address = 462920692 [(.google.api.field_behavior) = REQUIRED]; */ - private $address = ''; + protected $address = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteGlobalForwardingRuleRequest.php b/Compute/src/V1/DeleteGlobalForwardingRuleRequest.php index b6bd856588d8..6c4ba14f8ac7 100644 --- a/Compute/src/V1/DeleteGlobalForwardingRuleRequest.php +++ b/Compute/src/V1/DeleteGlobalForwardingRuleRequest.php @@ -20,19 +20,19 @@ class DeleteGlobalForwardingRuleRequest extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field string forwarding_rule = 269964030 [(.google.api.field_behavior) = REQUIRED]; */ - private $forwarding_rule = ''; + protected $forwarding_rule = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteGlobalNetworkEndpointGroupRequest.php b/Compute/src/V1/DeleteGlobalNetworkEndpointGroupRequest.php index 19e6157505ab..6ccd7f9280cd 100644 --- a/Compute/src/V1/DeleteGlobalNetworkEndpointGroupRequest.php +++ b/Compute/src/V1/DeleteGlobalNetworkEndpointGroupRequest.php @@ -20,19 +20,19 @@ class DeleteGlobalNetworkEndpointGroupRequest extends \Google\Protobuf\Internal\ * * Generated from protobuf field string network_endpoint_group = 433907078 [(.google.api.field_behavior) = REQUIRED]; */ - private $network_endpoint_group = ''; + protected $network_endpoint_group = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteGlobalOperationRequest.php b/Compute/src/V1/DeleteGlobalOperationRequest.php index 2235c555fe02..3dbc7cde41f3 100644 --- a/Compute/src/V1/DeleteGlobalOperationRequest.php +++ b/Compute/src/V1/DeleteGlobalOperationRequest.php @@ -20,13 +20,13 @@ class DeleteGlobalOperationRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string operation = 52090215 [(.google.api.field_behavior) = REQUIRED]; */ - private $operation = ''; + protected $operation = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteGlobalOrganizationOperationRequest.php b/Compute/src/V1/DeleteGlobalOrganizationOperationRequest.php index f10e27998eab..7df4dcdd349c 100644 --- a/Compute/src/V1/DeleteGlobalOrganizationOperationRequest.php +++ b/Compute/src/V1/DeleteGlobalOrganizationOperationRequest.php @@ -20,13 +20,13 @@ class DeleteGlobalOrganizationOperationRequest extends \Google\Protobuf\Internal * * Generated from protobuf field string operation = 52090215 [(.google.api.field_behavior) = REQUIRED]; */ - private $operation = ''; + protected $operation = ''; /** * Parent ID for this request. * * Generated from protobuf field optional string parent_id = 459714768; */ - private $parent_id = null; + protected $parent_id = null; /** * @param string $operation Name of the Operations resource to delete, or its unique numeric identifier. diff --git a/Compute/src/V1/DeleteGlobalPublicDelegatedPrefixeRequest.php b/Compute/src/V1/DeleteGlobalPublicDelegatedPrefixeRequest.php index a1142ab12205..7fc4b03a47d7 100644 --- a/Compute/src/V1/DeleteGlobalPublicDelegatedPrefixeRequest.php +++ b/Compute/src/V1/DeleteGlobalPublicDelegatedPrefixeRequest.php @@ -20,19 +20,19 @@ class DeleteGlobalPublicDelegatedPrefixeRequest extends \Google\Protobuf\Interna * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the PublicDelegatedPrefix resource to delete. * * Generated from protobuf field string public_delegated_prefix = 204238440 [(.google.api.field_behavior) = REQUIRED]; */ - private $public_delegated_prefix = ''; + protected $public_delegated_prefix = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteHealthCheckRequest.php b/Compute/src/V1/DeleteHealthCheckRequest.php index a98326dec0ee..d5f6ac1852f0 100644 --- a/Compute/src/V1/DeleteHealthCheckRequest.php +++ b/Compute/src/V1/DeleteHealthCheckRequest.php @@ -20,19 +20,19 @@ class DeleteHealthCheckRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string health_check = 308876645 [(.google.api.field_behavior) = REQUIRED]; */ - private $health_check = ''; + protected $health_check = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteImageRequest.php b/Compute/src/V1/DeleteImageRequest.php index 103e8f4f7a05..f74d6ebe5f1d 100644 --- a/Compute/src/V1/DeleteImageRequest.php +++ b/Compute/src/V1/DeleteImageRequest.php @@ -20,19 +20,19 @@ class DeleteImageRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string image = 100313435 [(.google.api.field_behavior) = REQUIRED]; */ - private $image = ''; + protected $image = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteInstanceGroupManagerRequest.php b/Compute/src/V1/DeleteInstanceGroupManagerRequest.php index 3efa8c36cc6e..b0dabaf711fc 100644 --- a/Compute/src/V1/DeleteInstanceGroupManagerRequest.php +++ b/Compute/src/V1/DeleteInstanceGroupManagerRequest.php @@ -20,25 +20,25 @@ class DeleteInstanceGroupManagerRequest extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field string instance_group_manager = 249363395 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group_manager = ''; + protected $instance_group_manager = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone where the managed instance group is located. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteInstanceGroupManagerResizeRequestRequest.php b/Compute/src/V1/DeleteInstanceGroupManagerResizeRequestRequest.php index 91e7c2604594..31433b7f5b72 100644 --- a/Compute/src/V1/DeleteInstanceGroupManagerResizeRequestRequest.php +++ b/Compute/src/V1/DeleteInstanceGroupManagerResizeRequestRequest.php @@ -20,31 +20,31 @@ class DeleteInstanceGroupManagerResizeRequestRequest extends \Google\Protobuf\In * * Generated from protobuf field string instance_group_manager = 249363395 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group_manager = ''; + protected $instance_group_manager = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the resize request to delete. The name should conform to RFC1035 or be a resource ID. * * Generated from protobuf field string resize_request = 216941060 [(.google.api.field_behavior) = REQUIRED]; */ - private $resize_request = ''; + protected $resize_request = ''; /** * The name of the zone where the managed instance group is located. The name should conform to RFC1035. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteInstanceGroupRequest.php b/Compute/src/V1/DeleteInstanceGroupRequest.php index 26a81dff12fd..85b64ebf23b2 100644 --- a/Compute/src/V1/DeleteInstanceGroupRequest.php +++ b/Compute/src/V1/DeleteInstanceGroupRequest.php @@ -20,25 +20,25 @@ class DeleteInstanceGroupRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string instance_group = 81095253 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group = ''; + protected $instance_group = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone where the instance group is located. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteInstanceRequest.php b/Compute/src/V1/DeleteInstanceRequest.php index 7c30a883e269..d80de01acdf8 100644 --- a/Compute/src/V1/DeleteInstanceRequest.php +++ b/Compute/src/V1/DeleteInstanceRequest.php @@ -20,25 +20,25 @@ class DeleteInstanceRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string instance = 18257045 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance = ''; + protected $instance = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteInstanceTemplateRequest.php b/Compute/src/V1/DeleteInstanceTemplateRequest.php index f07d1adc12f7..db0357032127 100644 --- a/Compute/src/V1/DeleteInstanceTemplateRequest.php +++ b/Compute/src/V1/DeleteInstanceTemplateRequest.php @@ -20,19 +20,19 @@ class DeleteInstanceTemplateRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string instance_template = 309248228 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_template = ''; + protected $instance_template = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteInstancesInstanceGroupManagerRequest.php b/Compute/src/V1/DeleteInstancesInstanceGroupManagerRequest.php index 08cf7a68acfc..2f718c34feb2 100644 --- a/Compute/src/V1/DeleteInstancesInstanceGroupManagerRequest.php +++ b/Compute/src/V1/DeleteInstancesInstanceGroupManagerRequest.php @@ -20,31 +20,31 @@ class DeleteInstancesInstanceGroupManagerRequest extends \Google\Protobuf\Intern * * Generated from protobuf field string instance_group_manager = 249363395 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group_manager = ''; + protected $instance_group_manager = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.InstanceGroupManagersDeleteInstancesRequest instance_group_managers_delete_instances_request_resource = 166421252 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group_managers_delete_instances_request_resource = null; + protected $instance_group_managers_delete_instances_request_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone where the managed instance group is located. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteInstancesRegionInstanceGroupManagerRequest.php b/Compute/src/V1/DeleteInstancesRegionInstanceGroupManagerRequest.php index 0f6b8ecc936e..3379183b9249 100644 --- a/Compute/src/V1/DeleteInstancesRegionInstanceGroupManagerRequest.php +++ b/Compute/src/V1/DeleteInstancesRegionInstanceGroupManagerRequest.php @@ -20,31 +20,31 @@ class DeleteInstancesRegionInstanceGroupManagerRequest extends \Google\Protobuf\ * * Generated from protobuf field string instance_group_manager = 249363395 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group_manager = ''; + protected $instance_group_manager = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.RegionInstanceGroupManagersDeleteInstancesRequest region_instance_group_managers_delete_instances_request_resource = 500876665 [(.google.api.field_behavior) = REQUIRED]; */ - private $region_instance_group_managers_delete_instances_request_resource = null; + protected $region_instance_group_managers_delete_instances_request_resource = null; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteInstantSnapshotRequest.php b/Compute/src/V1/DeleteInstantSnapshotRequest.php index b14bafe9243e..cfef609a04a4 100644 --- a/Compute/src/V1/DeleteInstantSnapshotRequest.php +++ b/Compute/src/V1/DeleteInstantSnapshotRequest.php @@ -20,25 +20,25 @@ class DeleteInstantSnapshotRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string instant_snapshot = 391638626 [(.google.api.field_behavior) = REQUIRED]; */ - private $instant_snapshot = ''; + protected $instant_snapshot = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteInterconnectAttachmentGroupRequest.php b/Compute/src/V1/DeleteInterconnectAttachmentGroupRequest.php index c689fb08d7b5..a97e1eac6a2f 100644 --- a/Compute/src/V1/DeleteInterconnectAttachmentGroupRequest.php +++ b/Compute/src/V1/DeleteInterconnectAttachmentGroupRequest.php @@ -20,19 +20,19 @@ class DeleteInterconnectAttachmentGroupRequest extends \Google\Protobuf\Internal * * Generated from protobuf field string interconnect_attachment_group = 75905012 [(.google.api.field_behavior) = REQUIRED]; */ - private $interconnect_attachment_group = ''; + protected $interconnect_attachment_group = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). end_interface: MixerMutationRequestBuilder * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteInterconnectAttachmentRequest.php b/Compute/src/V1/DeleteInterconnectAttachmentRequest.php index dc5726ca9085..9c12870fae06 100644 --- a/Compute/src/V1/DeleteInterconnectAttachmentRequest.php +++ b/Compute/src/V1/DeleteInterconnectAttachmentRequest.php @@ -20,25 +20,25 @@ class DeleteInterconnectAttachmentRequest extends \Google\Protobuf\Internal\Mess * * Generated from protobuf field string interconnect_attachment = 308135284 [(.google.api.field_behavior) = REQUIRED]; */ - private $interconnect_attachment = ''; + protected $interconnect_attachment = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteInterconnectGroupRequest.php b/Compute/src/V1/DeleteInterconnectGroupRequest.php index ae39ed217089..32e436379f23 100644 --- a/Compute/src/V1/DeleteInterconnectGroupRequest.php +++ b/Compute/src/V1/DeleteInterconnectGroupRequest.php @@ -20,19 +20,19 @@ class DeleteInterconnectGroupRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string interconnect_group = 388651918 [(.google.api.field_behavior) = REQUIRED]; */ - private $interconnect_group = ''; + protected $interconnect_group = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). end_interface: MixerMutationRequestBuilder * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteInterconnectRequest.php b/Compute/src/V1/DeleteInterconnectRequest.php index 29da7b732ef9..20d086f3e0d0 100644 --- a/Compute/src/V1/DeleteInterconnectRequest.php +++ b/Compute/src/V1/DeleteInterconnectRequest.php @@ -20,19 +20,19 @@ class DeleteInterconnectRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string interconnect = 224601230 [(.google.api.field_behavior) = REQUIRED]; */ - private $interconnect = ''; + protected $interconnect = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteLicenseRequest.php b/Compute/src/V1/DeleteLicenseRequest.php index 013c1f5c3610..ed8681ad2da3 100644 --- a/Compute/src/V1/DeleteLicenseRequest.php +++ b/Compute/src/V1/DeleteLicenseRequest.php @@ -20,19 +20,19 @@ class DeleteLicenseRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string license = 166757441 [(.google.api.field_behavior) = REQUIRED]; */ - private $license = ''; + protected $license = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteMachineImageRequest.php b/Compute/src/V1/DeleteMachineImageRequest.php index f60a513d17c1..ef53d66ddff0 100644 --- a/Compute/src/V1/DeleteMachineImageRequest.php +++ b/Compute/src/V1/DeleteMachineImageRequest.php @@ -20,19 +20,19 @@ class DeleteMachineImageRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string machine_image = 69189475 [(.google.api.field_behavior) = REQUIRED]; */ - private $machine_image = ''; + protected $machine_image = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteNetworkAttachmentRequest.php b/Compute/src/V1/DeleteNetworkAttachmentRequest.php index 796e286ba7b8..7bd52f26c713 100644 --- a/Compute/src/V1/DeleteNetworkAttachmentRequest.php +++ b/Compute/src/V1/DeleteNetworkAttachmentRequest.php @@ -20,25 +20,25 @@ class DeleteNetworkAttachmentRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string network_attachment = 224644052 [(.google.api.field_behavior) = REQUIRED]; */ - private $network_attachment = ''; + protected $network_attachment = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region of this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). end_interface: MixerMutationRequestBuilder * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteNetworkEdgeSecurityServiceRequest.php b/Compute/src/V1/DeleteNetworkEdgeSecurityServiceRequest.php index 8f22a9c9121e..02bfdc310fbe 100644 --- a/Compute/src/V1/DeleteNetworkEdgeSecurityServiceRequest.php +++ b/Compute/src/V1/DeleteNetworkEdgeSecurityServiceRequest.php @@ -20,25 +20,25 @@ class DeleteNetworkEdgeSecurityServiceRequest extends \Google\Protobuf\Internal\ * * Generated from protobuf field string network_edge_security_service = 157011879 [(.google.api.field_behavior) = REQUIRED]; */ - private $network_edge_security_service = ''; + protected $network_edge_security_service = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteNetworkEndpointGroupRequest.php b/Compute/src/V1/DeleteNetworkEndpointGroupRequest.php index df36411b3655..1a56a6fc4115 100644 --- a/Compute/src/V1/DeleteNetworkEndpointGroupRequest.php +++ b/Compute/src/V1/DeleteNetworkEndpointGroupRequest.php @@ -20,25 +20,25 @@ class DeleteNetworkEndpointGroupRequest extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field string network_endpoint_group = 433907078 [(.google.api.field_behavior) = REQUIRED]; */ - private $network_endpoint_group = ''; + protected $network_endpoint_group = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone where the network endpoint group is located. It should comply with RFC1035. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteNetworkFirewallPolicyRequest.php b/Compute/src/V1/DeleteNetworkFirewallPolicyRequest.php index bed893271df7..1c7e5b3d62a9 100644 --- a/Compute/src/V1/DeleteNetworkFirewallPolicyRequest.php +++ b/Compute/src/V1/DeleteNetworkFirewallPolicyRequest.php @@ -20,19 +20,19 @@ class DeleteNetworkFirewallPolicyRequest extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field string firewall_policy = 498173265 [(.google.api.field_behavior) = REQUIRED]; */ - private $firewall_policy = ''; + protected $firewall_policy = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteNetworkRequest.php b/Compute/src/V1/DeleteNetworkRequest.php index f4e054350bd2..8e51626cfbbb 100644 --- a/Compute/src/V1/DeleteNetworkRequest.php +++ b/Compute/src/V1/DeleteNetworkRequest.php @@ -20,19 +20,19 @@ class DeleteNetworkRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string network = 232872494 [(.google.api.field_behavior) = REQUIRED]; */ - private $network = ''; + protected $network = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteNodeGroupRequest.php b/Compute/src/V1/DeleteNodeGroupRequest.php index 7e2e878149db..2d813cd4ac3e 100644 --- a/Compute/src/V1/DeleteNodeGroupRequest.php +++ b/Compute/src/V1/DeleteNodeGroupRequest.php @@ -20,25 +20,25 @@ class DeleteNodeGroupRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string node_group = 469958146 [(.google.api.field_behavior) = REQUIRED]; */ - private $node_group = ''; + protected $node_group = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteNodeTemplateRequest.php b/Compute/src/V1/DeleteNodeTemplateRequest.php index 7bf12ccc047a..b298db1b7c4e 100644 --- a/Compute/src/V1/DeleteNodeTemplateRequest.php +++ b/Compute/src/V1/DeleteNodeTemplateRequest.php @@ -20,25 +20,25 @@ class DeleteNodeTemplateRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string node_template = 323154455 [(.google.api.field_behavior) = REQUIRED]; */ - private $node_template = ''; + protected $node_template = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * The name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteNodesNodeGroupRequest.php b/Compute/src/V1/DeleteNodesNodeGroupRequest.php index 596be2253993..9ca8acbf6332 100644 --- a/Compute/src/V1/DeleteNodesNodeGroupRequest.php +++ b/Compute/src/V1/DeleteNodesNodeGroupRequest.php @@ -20,31 +20,31 @@ class DeleteNodesNodeGroupRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string node_group = 469958146 [(.google.api.field_behavior) = REQUIRED]; */ - private $node_group = ''; + protected $node_group = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.NodeGroupsDeleteNodesRequest node_groups_delete_nodes_request_resource = 183298962 [(.google.api.field_behavior) = REQUIRED]; */ - private $node_groups_delete_nodes_request_resource = null; + protected $node_groups_delete_nodes_request_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeletePacketMirroringRequest.php b/Compute/src/V1/DeletePacketMirroringRequest.php index b8cd70dddeba..946ddac2188d 100644 --- a/Compute/src/V1/DeletePacketMirroringRequest.php +++ b/Compute/src/V1/DeletePacketMirroringRequest.php @@ -20,25 +20,25 @@ class DeletePacketMirroringRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string packet_mirroring = 22305996 [(.google.api.field_behavior) = REQUIRED]; */ - private $packet_mirroring = ''; + protected $packet_mirroring = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeletePerInstanceConfigsInstanceGroupManagerRequest.php b/Compute/src/V1/DeletePerInstanceConfigsInstanceGroupManagerRequest.php index 28324d39024f..ef0a7993a104 100644 --- a/Compute/src/V1/DeletePerInstanceConfigsInstanceGroupManagerRequest.php +++ b/Compute/src/V1/DeletePerInstanceConfigsInstanceGroupManagerRequest.php @@ -20,25 +20,25 @@ class DeletePerInstanceConfigsInstanceGroupManagerRequest extends \Google\Protob * * Generated from protobuf field string instance_group_manager = 249363395 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group_manager = ''; + protected $instance_group_manager = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.InstanceGroupManagersDeletePerInstanceConfigsReq instance_group_managers_delete_per_instance_configs_req_resource = 362427680 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group_managers_delete_per_instance_configs_req_resource = null; + protected $instance_group_managers_delete_per_instance_configs_req_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * The name of the zone where the managed instance group is located. It should conform to RFC1035. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeletePerInstanceConfigsRegionInstanceGroupManagerRequest.php b/Compute/src/V1/DeletePerInstanceConfigsRegionInstanceGroupManagerRequest.php index e0eaa6b83588..c8cd755f17c9 100644 --- a/Compute/src/V1/DeletePerInstanceConfigsRegionInstanceGroupManagerRequest.php +++ b/Compute/src/V1/DeletePerInstanceConfigsRegionInstanceGroupManagerRequest.php @@ -20,25 +20,25 @@ class DeletePerInstanceConfigsRegionInstanceGroupManagerRequest extends \Google\ * * Generated from protobuf field string instance_group_manager = 249363395 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group_manager = ''; + protected $instance_group_manager = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request, should conform to RFC1035. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.RegionInstanceGroupManagerDeleteInstanceConfigReq region_instance_group_manager_delete_instance_config_req_resource = 740741 [(.google.api.field_behavior) = REQUIRED]; */ - private $region_instance_group_manager_delete_instance_config_req_resource = null; + protected $region_instance_group_manager_delete_instance_config_req_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeletePublicAdvertisedPrefixeRequest.php b/Compute/src/V1/DeletePublicAdvertisedPrefixeRequest.php index ea215393fa2d..924eda03a58b 100644 --- a/Compute/src/V1/DeletePublicAdvertisedPrefixeRequest.php +++ b/Compute/src/V1/DeletePublicAdvertisedPrefixeRequest.php @@ -20,19 +20,19 @@ class DeletePublicAdvertisedPrefixeRequest extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the PublicAdvertisedPrefix resource to delete. * * Generated from protobuf field string public_advertised_prefix = 101874590 [(.google.api.field_behavior) = REQUIRED]; */ - private $public_advertised_prefix = ''; + protected $public_advertised_prefix = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeletePublicDelegatedPrefixeRequest.php b/Compute/src/V1/DeletePublicDelegatedPrefixeRequest.php index 5508e8ea9335..a2c01a9ac080 100644 --- a/Compute/src/V1/DeletePublicDelegatedPrefixeRequest.php +++ b/Compute/src/V1/DeletePublicDelegatedPrefixeRequest.php @@ -20,25 +20,25 @@ class DeletePublicDelegatedPrefixeRequest extends \Google\Protobuf\Internal\Mess * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the PublicDelegatedPrefix resource to delete. * * Generated from protobuf field string public_delegated_prefix = 204238440 [(.google.api.field_behavior) = REQUIRED]; */ - private $public_delegated_prefix = ''; + protected $public_delegated_prefix = ''; /** * Name of the region of this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteRegionAutoscalerRequest.php b/Compute/src/V1/DeleteRegionAutoscalerRequest.php index 7dcf2ccffb77..604f0c38eab7 100644 --- a/Compute/src/V1/DeleteRegionAutoscalerRequest.php +++ b/Compute/src/V1/DeleteRegionAutoscalerRequest.php @@ -20,25 +20,25 @@ class DeleteRegionAutoscalerRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string autoscaler = 517258967 [(.google.api.field_behavior) = REQUIRED]; */ - private $autoscaler = ''; + protected $autoscaler = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteRegionBackendServiceRequest.php b/Compute/src/V1/DeleteRegionBackendServiceRequest.php index 7090cce399bf..afd66b4c47ac 100644 --- a/Compute/src/V1/DeleteRegionBackendServiceRequest.php +++ b/Compute/src/V1/DeleteRegionBackendServiceRequest.php @@ -20,25 +20,25 @@ class DeleteRegionBackendServiceRequest extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field string backend_service = 306946058 [(.google.api.field_behavior) = REQUIRED]; */ - private $backend_service = ''; + protected $backend_service = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteRegionDiskRequest.php b/Compute/src/V1/DeleteRegionDiskRequest.php index 4a402ca481d2..072f6a3b0ac6 100644 --- a/Compute/src/V1/DeleteRegionDiskRequest.php +++ b/Compute/src/V1/DeleteRegionDiskRequest.php @@ -20,25 +20,25 @@ class DeleteRegionDiskRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string disk = 3083677 [(.google.api.field_behavior) = REQUIRED]; */ - private $disk = ''; + protected $disk = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteRegionHealthCheckRequest.php b/Compute/src/V1/DeleteRegionHealthCheckRequest.php index 890ab5c05200..9cc2dac5f584 100644 --- a/Compute/src/V1/DeleteRegionHealthCheckRequest.php +++ b/Compute/src/V1/DeleteRegionHealthCheckRequest.php @@ -20,25 +20,25 @@ class DeleteRegionHealthCheckRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string health_check = 308876645 [(.google.api.field_behavior) = REQUIRED]; */ - private $health_check = ''; + protected $health_check = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteRegionHealthCheckServiceRequest.php b/Compute/src/V1/DeleteRegionHealthCheckServiceRequest.php index 37605df8c26c..814ea05db8ba 100644 --- a/Compute/src/V1/DeleteRegionHealthCheckServiceRequest.php +++ b/Compute/src/V1/DeleteRegionHealthCheckServiceRequest.php @@ -20,25 +20,25 @@ class DeleteRegionHealthCheckServiceRequest extends \Google\Protobuf\Internal\Me * * Generated from protobuf field string health_check_service = 408374747 [(.google.api.field_behavior) = REQUIRED]; */ - private $health_check_service = ''; + protected $health_check_service = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteRegionInstanceGroupManagerRequest.php b/Compute/src/V1/DeleteRegionInstanceGroupManagerRequest.php index 255979d0ae05..440c7660b4eb 100644 --- a/Compute/src/V1/DeleteRegionInstanceGroupManagerRequest.php +++ b/Compute/src/V1/DeleteRegionInstanceGroupManagerRequest.php @@ -20,25 +20,25 @@ class DeleteRegionInstanceGroupManagerRequest extends \Google\Protobuf\Internal\ * * Generated from protobuf field string instance_group_manager = 249363395 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group_manager = ''; + protected $instance_group_manager = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteRegionInstanceTemplateRequest.php b/Compute/src/V1/DeleteRegionInstanceTemplateRequest.php index 5b0cb20d95f4..7086be486330 100644 --- a/Compute/src/V1/DeleteRegionInstanceTemplateRequest.php +++ b/Compute/src/V1/DeleteRegionInstanceTemplateRequest.php @@ -20,25 +20,25 @@ class DeleteRegionInstanceTemplateRequest extends \Google\Protobuf\Internal\Mess * * Generated from protobuf field string instance_template = 309248228 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_template = ''; + protected $instance_template = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * The name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteRegionInstantSnapshotRequest.php b/Compute/src/V1/DeleteRegionInstantSnapshotRequest.php index 86ad4ace94a2..d51beda56198 100644 --- a/Compute/src/V1/DeleteRegionInstantSnapshotRequest.php +++ b/Compute/src/V1/DeleteRegionInstantSnapshotRequest.php @@ -20,25 +20,25 @@ class DeleteRegionInstantSnapshotRequest extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field string instant_snapshot = 391638626 [(.google.api.field_behavior) = REQUIRED]; */ - private $instant_snapshot = ''; + protected $instant_snapshot = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * The name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteRegionNetworkEndpointGroupRequest.php b/Compute/src/V1/DeleteRegionNetworkEndpointGroupRequest.php index 29d58f2ca6ac..cd7825917c03 100644 --- a/Compute/src/V1/DeleteRegionNetworkEndpointGroupRequest.php +++ b/Compute/src/V1/DeleteRegionNetworkEndpointGroupRequest.php @@ -20,25 +20,25 @@ class DeleteRegionNetworkEndpointGroupRequest extends \Google\Protobuf\Internal\ * * Generated from protobuf field string network_endpoint_group = 433907078 [(.google.api.field_behavior) = REQUIRED]; */ - private $network_endpoint_group = ''; + protected $network_endpoint_group = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * The name of the region where the network endpoint group is located. It should comply with RFC1035. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteRegionNetworkFirewallPolicyRequest.php b/Compute/src/V1/DeleteRegionNetworkFirewallPolicyRequest.php index b26f8b952966..523493331572 100644 --- a/Compute/src/V1/DeleteRegionNetworkFirewallPolicyRequest.php +++ b/Compute/src/V1/DeleteRegionNetworkFirewallPolicyRequest.php @@ -20,25 +20,25 @@ class DeleteRegionNetworkFirewallPolicyRequest extends \Google\Protobuf\Internal * * Generated from protobuf field string firewall_policy = 498173265 [(.google.api.field_behavior) = REQUIRED]; */ - private $firewall_policy = ''; + protected $firewall_policy = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteRegionNotificationEndpointRequest.php b/Compute/src/V1/DeleteRegionNotificationEndpointRequest.php index 9efcec34c3bb..22d00a7512ba 100644 --- a/Compute/src/V1/DeleteRegionNotificationEndpointRequest.php +++ b/Compute/src/V1/DeleteRegionNotificationEndpointRequest.php @@ -20,25 +20,25 @@ class DeleteRegionNotificationEndpointRequest extends \Google\Protobuf\Internal\ * * Generated from protobuf field string notification_endpoint = 376807017 [(.google.api.field_behavior) = REQUIRED]; */ - private $notification_endpoint = ''; + protected $notification_endpoint = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteRegionOperationRequest.php b/Compute/src/V1/DeleteRegionOperationRequest.php index cff37a72b2cb..e96f80d5c5ed 100644 --- a/Compute/src/V1/DeleteRegionOperationRequest.php +++ b/Compute/src/V1/DeleteRegionOperationRequest.php @@ -20,19 +20,19 @@ class DeleteRegionOperationRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string operation = 52090215 [(.google.api.field_behavior) = REQUIRED]; */ - private $operation = ''; + protected $operation = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteRegionSecurityPolicyRequest.php b/Compute/src/V1/DeleteRegionSecurityPolicyRequest.php index c46272715952..c52c83418a55 100644 --- a/Compute/src/V1/DeleteRegionSecurityPolicyRequest.php +++ b/Compute/src/V1/DeleteRegionSecurityPolicyRequest.php @@ -20,25 +20,25 @@ class DeleteRegionSecurityPolicyRequest extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name of the security policy to delete. * * Generated from protobuf field string security_policy = 171082513 [(.google.api.field_behavior) = REQUIRED]; */ - private $security_policy = ''; + protected $security_policy = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteRegionSslCertificateRequest.php b/Compute/src/V1/DeleteRegionSslCertificateRequest.php index 3469be68159c..76f186fe84e0 100644 --- a/Compute/src/V1/DeleteRegionSslCertificateRequest.php +++ b/Compute/src/V1/DeleteRegionSslCertificateRequest.php @@ -20,25 +20,25 @@ class DeleteRegionSslCertificateRequest extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name of the SslCertificate resource to delete. * * Generated from protobuf field string ssl_certificate = 46443492 [(.google.api.field_behavior) = REQUIRED]; */ - private $ssl_certificate = ''; + protected $ssl_certificate = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteRegionSslPolicyRequest.php b/Compute/src/V1/DeleteRegionSslPolicyRequest.php index fecda0d084fc..14c9e6262a7e 100644 --- a/Compute/src/V1/DeleteRegionSslPolicyRequest.php +++ b/Compute/src/V1/DeleteRegionSslPolicyRequest.php @@ -20,25 +20,25 @@ class DeleteRegionSslPolicyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name of the SSL policy to delete. The name must be 1-63 characters long, and comply with RFC1035. * * Generated from protobuf field string ssl_policy = 295190213 [(.google.api.field_behavior) = REQUIRED]; */ - private $ssl_policy = ''; + protected $ssl_policy = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteRegionTargetHttpProxyRequest.php b/Compute/src/V1/DeleteRegionTargetHttpProxyRequest.php index b43e98f84dd7..fec987d6a913 100644 --- a/Compute/src/V1/DeleteRegionTargetHttpProxyRequest.php +++ b/Compute/src/V1/DeleteRegionTargetHttpProxyRequest.php @@ -20,25 +20,25 @@ class DeleteRegionTargetHttpProxyRequest extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name of the TargetHttpProxy resource to delete. * * Generated from protobuf field string target_http_proxy = 206872421 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_http_proxy = ''; + protected $target_http_proxy = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteRegionTargetHttpsProxyRequest.php b/Compute/src/V1/DeleteRegionTargetHttpsProxyRequest.php index 51aea020dafd..5b1b71cf7320 100644 --- a/Compute/src/V1/DeleteRegionTargetHttpsProxyRequest.php +++ b/Compute/src/V1/DeleteRegionTargetHttpsProxyRequest.php @@ -20,25 +20,25 @@ class DeleteRegionTargetHttpsProxyRequest extends \Google\Protobuf\Internal\Mess * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name of the TargetHttpsProxy resource to delete. * * Generated from protobuf field string target_https_proxy = 52336748 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_https_proxy = ''; + protected $target_https_proxy = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteRegionTargetTcpProxyRequest.php b/Compute/src/V1/DeleteRegionTargetTcpProxyRequest.php index 6e28b7af9b1d..7f8c10f25370 100644 --- a/Compute/src/V1/DeleteRegionTargetTcpProxyRequest.php +++ b/Compute/src/V1/DeleteRegionTargetTcpProxyRequest.php @@ -20,25 +20,25 @@ class DeleteRegionTargetTcpProxyRequest extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name of the TargetTcpProxy resource to delete. * * Generated from protobuf field string target_tcp_proxy = 503065442 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_tcp_proxy = ''; + protected $target_tcp_proxy = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteRegionUrlMapRequest.php b/Compute/src/V1/DeleteRegionUrlMapRequest.php index 89e8515455db..a2ded264c587 100644 --- a/Compute/src/V1/DeleteRegionUrlMapRequest.php +++ b/Compute/src/V1/DeleteRegionUrlMapRequest.php @@ -20,25 +20,25 @@ class DeleteRegionUrlMapRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * begin_interface: MixerMutationRequestBuilder Request ID to support idempotency. * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name of the UrlMap resource to delete. * * Generated from protobuf field string url_map = 367020684 [(.google.api.field_behavior) = REQUIRED]; */ - private $url_map = ''; + protected $url_map = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteReservationRequest.php b/Compute/src/V1/DeleteReservationRequest.php index f8c563f33e8c..00511e3d303a 100644 --- a/Compute/src/V1/DeleteReservationRequest.php +++ b/Compute/src/V1/DeleteReservationRequest.php @@ -20,25 +20,25 @@ class DeleteReservationRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name of the reservation to delete. * * Generated from protobuf field string reservation = 47530956 [(.google.api.field_behavior) = REQUIRED]; */ - private $reservation = ''; + protected $reservation = ''; /** * Name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteResourcePolicyRequest.php b/Compute/src/V1/DeleteResourcePolicyRequest.php index 7efbfd922b58..270a46a67665 100644 --- a/Compute/src/V1/DeleteResourcePolicyRequest.php +++ b/Compute/src/V1/DeleteResourcePolicyRequest.php @@ -20,25 +20,25 @@ class DeleteResourcePolicyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name of the resource policy to delete. * * Generated from protobuf field string resource_policy = 159240835 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource_policy = ''; + protected $resource_policy = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteRoutePolicyRouterRequest.php b/Compute/src/V1/DeleteRoutePolicyRouterRequest.php index d0640cad63b8..fffae84e2cf1 100644 --- a/Compute/src/V1/DeleteRoutePolicyRouterRequest.php +++ b/Compute/src/V1/DeleteRoutePolicyRouterRequest.php @@ -20,31 +20,31 @@ class DeleteRoutePolicyRouterRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string policy = 91071794; */ - private $policy = null; + protected $policy = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name of the Router resource where Route Policy is defined. * * Generated from protobuf field string router = 148608841 [(.google.api.field_behavior) = REQUIRED]; */ - private $router = ''; + protected $router = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteRouteRequest.php b/Compute/src/V1/DeleteRouteRequest.php index 9fa18e736fac..cad8da12a967 100644 --- a/Compute/src/V1/DeleteRouteRequest.php +++ b/Compute/src/V1/DeleteRouteRequest.php @@ -20,19 +20,19 @@ class DeleteRouteRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name of the Route resource to delete. * * Generated from protobuf field string route = 108704329 [(.google.api.field_behavior) = REQUIRED]; */ - private $route = ''; + protected $route = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteRouterRequest.php b/Compute/src/V1/DeleteRouterRequest.php index 526bed676abb..bcc52268c573 100644 --- a/Compute/src/V1/DeleteRouterRequest.php +++ b/Compute/src/V1/DeleteRouterRequest.php @@ -20,25 +20,25 @@ class DeleteRouterRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name of the Router resource to delete. * * Generated from protobuf field string router = 148608841 [(.google.api.field_behavior) = REQUIRED]; */ - private $router = ''; + protected $router = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteSecurityPolicyRequest.php b/Compute/src/V1/DeleteSecurityPolicyRequest.php index 40371ddc8738..a365299ada2e 100644 --- a/Compute/src/V1/DeleteSecurityPolicyRequest.php +++ b/Compute/src/V1/DeleteSecurityPolicyRequest.php @@ -20,19 +20,19 @@ class DeleteSecurityPolicyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name of the security policy to delete. * * Generated from protobuf field string security_policy = 171082513 [(.google.api.field_behavior) = REQUIRED]; */ - private $security_policy = ''; + protected $security_policy = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteServiceAttachmentRequest.php b/Compute/src/V1/DeleteServiceAttachmentRequest.php index 1d590f63dd0d..1df40c90e65f 100644 --- a/Compute/src/V1/DeleteServiceAttachmentRequest.php +++ b/Compute/src/V1/DeleteServiceAttachmentRequest.php @@ -20,25 +20,25 @@ class DeleteServiceAttachmentRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region of this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name of the ServiceAttachment resource to delete. * * Generated from protobuf field string service_attachment = 338957549 [(.google.api.field_behavior) = REQUIRED]; */ - private $service_attachment = ''; + protected $service_attachment = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteSignedUrlKeyBackendBucketRequest.php b/Compute/src/V1/DeleteSignedUrlKeyBackendBucketRequest.php index f335171eb216..f4933a4b70d6 100644 --- a/Compute/src/V1/DeleteSignedUrlKeyBackendBucketRequest.php +++ b/Compute/src/V1/DeleteSignedUrlKeyBackendBucketRequest.php @@ -20,25 +20,25 @@ class DeleteSignedUrlKeyBackendBucketRequest extends \Google\Protobuf\Internal\M * * Generated from protobuf field string backend_bucket = 91714037 [(.google.api.field_behavior) = REQUIRED]; */ - private $backend_bucket = ''; + protected $backend_bucket = ''; /** * The name of the Signed URL Key to delete. * * Generated from protobuf field string key_name = 500938859 [(.google.api.field_behavior) = REQUIRED]; */ - private $key_name = ''; + protected $key_name = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteSignedUrlKeyBackendServiceRequest.php b/Compute/src/V1/DeleteSignedUrlKeyBackendServiceRequest.php index ffb7d2ccf8d8..c0178f9f0405 100644 --- a/Compute/src/V1/DeleteSignedUrlKeyBackendServiceRequest.php +++ b/Compute/src/V1/DeleteSignedUrlKeyBackendServiceRequest.php @@ -20,25 +20,25 @@ class DeleteSignedUrlKeyBackendServiceRequest extends \Google\Protobuf\Internal\ * * Generated from protobuf field string backend_service = 306946058 [(.google.api.field_behavior) = REQUIRED]; */ - private $backend_service = ''; + protected $backend_service = ''; /** * The name of the Signed URL Key to delete. * * Generated from protobuf field string key_name = 500938859 [(.google.api.field_behavior) = REQUIRED]; */ - private $key_name = ''; + protected $key_name = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteSnapshotRequest.php b/Compute/src/V1/DeleteSnapshotRequest.php index f1cd2b3342c0..f9c364f4bfaf 100644 --- a/Compute/src/V1/DeleteSnapshotRequest.php +++ b/Compute/src/V1/DeleteSnapshotRequest.php @@ -20,19 +20,19 @@ class DeleteSnapshotRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name of the Snapshot resource to delete. * * Generated from protobuf field string snapshot = 284874180 [(.google.api.field_behavior) = REQUIRED]; */ - private $snapshot = ''; + protected $snapshot = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteSslCertificateRequest.php b/Compute/src/V1/DeleteSslCertificateRequest.php index 0aa7a7e93694..41860141b225 100644 --- a/Compute/src/V1/DeleteSslCertificateRequest.php +++ b/Compute/src/V1/DeleteSslCertificateRequest.php @@ -20,19 +20,19 @@ class DeleteSslCertificateRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name of the SslCertificate resource to delete. * * Generated from protobuf field string ssl_certificate = 46443492 [(.google.api.field_behavior) = REQUIRED]; */ - private $ssl_certificate = ''; + protected $ssl_certificate = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteSslPolicyRequest.php b/Compute/src/V1/DeleteSslPolicyRequest.php index 5f9e092d65d1..43358777bbd1 100644 --- a/Compute/src/V1/DeleteSslPolicyRequest.php +++ b/Compute/src/V1/DeleteSslPolicyRequest.php @@ -20,19 +20,19 @@ class DeleteSslPolicyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name of the SSL policy to delete. The name must be 1-63 characters long, and comply with RFC1035. * * Generated from protobuf field string ssl_policy = 295190213 [(.google.api.field_behavior) = REQUIRED]; */ - private $ssl_policy = ''; + protected $ssl_policy = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteStoragePoolRequest.php b/Compute/src/V1/DeleteStoragePoolRequest.php index 159aae37c794..88e6be1f22c4 100644 --- a/Compute/src/V1/DeleteStoragePoolRequest.php +++ b/Compute/src/V1/DeleteStoragePoolRequest.php @@ -20,25 +20,25 @@ class DeleteStoragePoolRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name of the storage pool to delete. * * Generated from protobuf field string storage_pool = 360473440 [(.google.api.field_behavior) = REQUIRED]; */ - private $storage_pool = ''; + protected $storage_pool = ''; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteSubnetworkRequest.php b/Compute/src/V1/DeleteSubnetworkRequest.php index bea0aba9df06..d11748215191 100644 --- a/Compute/src/V1/DeleteSubnetworkRequest.php +++ b/Compute/src/V1/DeleteSubnetworkRequest.php @@ -20,25 +20,25 @@ class DeleteSubnetworkRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name of the Subnetwork resource to delete. * * Generated from protobuf field string subnetwork = 307827694 [(.google.api.field_behavior) = REQUIRED]; */ - private $subnetwork = ''; + protected $subnetwork = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteTargetGrpcProxyRequest.php b/Compute/src/V1/DeleteTargetGrpcProxyRequest.php index 9078a2112e70..ee031595bb0e 100644 --- a/Compute/src/V1/DeleteTargetGrpcProxyRequest.php +++ b/Compute/src/V1/DeleteTargetGrpcProxyRequest.php @@ -20,19 +20,19 @@ class DeleteTargetGrpcProxyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name of the TargetGrpcProxy resource to delete. * * Generated from protobuf field string target_grpc_proxy = 5020283 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_grpc_proxy = ''; + protected $target_grpc_proxy = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteTargetHttpProxyRequest.php b/Compute/src/V1/DeleteTargetHttpProxyRequest.php index ec1751c20f52..4c471adbb5be 100644 --- a/Compute/src/V1/DeleteTargetHttpProxyRequest.php +++ b/Compute/src/V1/DeleteTargetHttpProxyRequest.php @@ -20,19 +20,19 @@ class DeleteTargetHttpProxyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name of the TargetHttpProxy resource to delete. * * Generated from protobuf field string target_http_proxy = 206872421 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_http_proxy = ''; + protected $target_http_proxy = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteTargetHttpsProxyRequest.php b/Compute/src/V1/DeleteTargetHttpsProxyRequest.php index 74719333e82e..c7bb6d404f32 100644 --- a/Compute/src/V1/DeleteTargetHttpsProxyRequest.php +++ b/Compute/src/V1/DeleteTargetHttpsProxyRequest.php @@ -20,19 +20,19 @@ class DeleteTargetHttpsProxyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name of the TargetHttpsProxy resource to delete. * * Generated from protobuf field string target_https_proxy = 52336748 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_https_proxy = ''; + protected $target_https_proxy = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteTargetInstanceRequest.php b/Compute/src/V1/DeleteTargetInstanceRequest.php index 20e9bf088f20..7f53264b7ca7 100644 --- a/Compute/src/V1/DeleteTargetInstanceRequest.php +++ b/Compute/src/V1/DeleteTargetInstanceRequest.php @@ -20,25 +20,25 @@ class DeleteTargetInstanceRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name of the TargetInstance resource to delete. * * Generated from protobuf field string target_instance = 289769347 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_instance = ''; + protected $target_instance = ''; /** * Name of the zone scoping this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteTargetPoolRequest.php b/Compute/src/V1/DeleteTargetPoolRequest.php index 24cf6c69727b..846aa41f799e 100644 --- a/Compute/src/V1/DeleteTargetPoolRequest.php +++ b/Compute/src/V1/DeleteTargetPoolRequest.php @@ -20,25 +20,25 @@ class DeleteTargetPoolRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name of the TargetPool resource to delete. * * Generated from protobuf field string target_pool = 62796298 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_pool = ''; + protected $target_pool = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteTargetSslProxyRequest.php b/Compute/src/V1/DeleteTargetSslProxyRequest.php index a8263b71df02..c78a98106373 100644 --- a/Compute/src/V1/DeleteTargetSslProxyRequest.php +++ b/Compute/src/V1/DeleteTargetSslProxyRequest.php @@ -20,19 +20,19 @@ class DeleteTargetSslProxyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name of the TargetSslProxy resource to delete. * * Generated from protobuf field string target_ssl_proxy = 338795853 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_ssl_proxy = ''; + protected $target_ssl_proxy = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteTargetTcpProxyRequest.php b/Compute/src/V1/DeleteTargetTcpProxyRequest.php index 66de6ff69bb7..5c2e8195c735 100644 --- a/Compute/src/V1/DeleteTargetTcpProxyRequest.php +++ b/Compute/src/V1/DeleteTargetTcpProxyRequest.php @@ -20,19 +20,19 @@ class DeleteTargetTcpProxyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name of the TargetTcpProxy resource to delete. * * Generated from protobuf field string target_tcp_proxy = 503065442 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_tcp_proxy = ''; + protected $target_tcp_proxy = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteTargetVpnGatewayRequest.php b/Compute/src/V1/DeleteTargetVpnGatewayRequest.php index 78800af61ae5..f5364a433bad 100644 --- a/Compute/src/V1/DeleteTargetVpnGatewayRequest.php +++ b/Compute/src/V1/DeleteTargetVpnGatewayRequest.php @@ -20,25 +20,25 @@ class DeleteTargetVpnGatewayRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name of the target VPN gateway to delete. * * Generated from protobuf field string target_vpn_gateway = 532512843 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_vpn_gateway = ''; + protected $target_vpn_gateway = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteUrlMapRequest.php b/Compute/src/V1/DeleteUrlMapRequest.php index dd348c64d0d2..7af276966097 100644 --- a/Compute/src/V1/DeleteUrlMapRequest.php +++ b/Compute/src/V1/DeleteUrlMapRequest.php @@ -20,19 +20,19 @@ class DeleteUrlMapRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name of the UrlMap resource to delete. * * Generated from protobuf field string url_map = 367020684 [(.google.api.field_behavior) = REQUIRED]; */ - private $url_map = ''; + protected $url_map = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteVpnGatewayRequest.php b/Compute/src/V1/DeleteVpnGatewayRequest.php index c25219e0fdbd..ae66d648f27a 100644 --- a/Compute/src/V1/DeleteVpnGatewayRequest.php +++ b/Compute/src/V1/DeleteVpnGatewayRequest.php @@ -20,25 +20,25 @@ class DeleteVpnGatewayRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name of the VPN gateway to delete. * * Generated from protobuf field string vpn_gateway = 406684153 [(.google.api.field_behavior) = REQUIRED]; */ - private $vpn_gateway = ''; + protected $vpn_gateway = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteVpnTunnelRequest.php b/Compute/src/V1/DeleteVpnTunnelRequest.php index 49058cc6accc..9912f05ffd4f 100644 --- a/Compute/src/V1/DeleteVpnTunnelRequest.php +++ b/Compute/src/V1/DeleteVpnTunnelRequest.php @@ -20,25 +20,25 @@ class DeleteVpnTunnelRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name of the VpnTunnel resource to delete. * * Generated from protobuf field string vpn_tunnel = 143821331 [(.google.api.field_behavior) = REQUIRED]; */ - private $vpn_tunnel = ''; + protected $vpn_tunnel = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeleteZoneOperationRequest.php b/Compute/src/V1/DeleteZoneOperationRequest.php index 7ca7c2cb5411..648e8e45b66b 100644 --- a/Compute/src/V1/DeleteZoneOperationRequest.php +++ b/Compute/src/V1/DeleteZoneOperationRequest.php @@ -20,19 +20,19 @@ class DeleteZoneOperationRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string operation = 52090215 [(.google.api.field_behavior) = REQUIRED]; */ - private $operation = ''; + protected $operation = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/Denied.php b/Compute/src/V1/Denied.php index cbbff65afd70..a34c497c0238 100644 --- a/Compute/src/V1/Denied.php +++ b/Compute/src/V1/Denied.php @@ -19,7 +19,7 @@ class Denied extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string I_p_protocol = 488094525; */ - private $I_p_protocol = null; + protected $I_p_protocol = null; /** * An optional list of ports to which this rule applies. This field is only applicable for the UDP or TCP protocol. Each entry must be either an integer or a range. If not specified, this rule applies to connections through any port. Example inputs include: ["22"], ["80","443"], and ["12345-12349"]. * diff --git a/Compute/src/V1/DeprecateImageRequest.php b/Compute/src/V1/DeprecateImageRequest.php index 7493e5f3e34a..5e1fea3b3ce8 100644 --- a/Compute/src/V1/DeprecateImageRequest.php +++ b/Compute/src/V1/DeprecateImageRequest.php @@ -20,25 +20,25 @@ class DeprecateImageRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.compute.v1.DeprecationStatus deprecation_status_resource = 333006064 [(.google.api.field_behavior) = REQUIRED]; */ - private $deprecation_status_resource = null; + protected $deprecation_status_resource = null; /** * Image name. * * Generated from protobuf field string image = 100313435 [(.google.api.field_behavior) = REQUIRED]; */ - private $image = ''; + protected $image = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DeprecationStatus.php b/Compute/src/V1/DeprecationStatus.php index aae216da7f09..72a0b9bc2324 100644 --- a/Compute/src/V1/DeprecationStatus.php +++ b/Compute/src/V1/DeprecationStatus.php @@ -20,32 +20,32 @@ class DeprecationStatus extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string deleted = 476721177; */ - private $deleted = null; + protected $deleted = null; /** * An optional RFC3339 timestamp on or after which the state of this resource is intended to change to DEPRECATED. This is only informational and the status will not change unless the client explicitly changes it. * * Generated from protobuf field optional string deprecated = 515138995; */ - private $deprecated = null; + protected $deprecated = null; /** * An optional RFC3339 timestamp on or after which the state of this resource is intended to change to OBSOLETE. This is only informational and the status will not change unless the client explicitly changes it. * * Generated from protobuf field optional string obsolete = 357647769; */ - private $obsolete = null; + protected $obsolete = null; /** * The URL of the suggested replacement for a deprecated resource. The suggested replacement resource must be the same kind of resource as the deprecated resource. * * Generated from protobuf field optional string replacement = 430919186; */ - private $replacement = null; + protected $replacement = null; /** * The deprecation state of this resource. This can be ACTIVE, DEPRECATED, OBSOLETE, or DELETED. Operations which communicate the end of life date for an image, can use ACTIVE. Operations which create a new resource using a DEPRECATED resource will return successfully, but with a warning indicating the deprecated resource and recommending its replacement. Operations which use OBSOLETE or DELETED resources will be rejected and result in an error. * Check the State enum for the list of possible values. * * Generated from protobuf field optional string state = 109757585; */ - private $state = null; + protected $state = null; /** * Constructor. diff --git a/Compute/src/V1/DetachDiskInstanceRequest.php b/Compute/src/V1/DetachDiskInstanceRequest.php index 6037f1935b86..cdaeaf8cf24b 100644 --- a/Compute/src/V1/DetachDiskInstanceRequest.php +++ b/Compute/src/V1/DetachDiskInstanceRequest.php @@ -20,31 +20,31 @@ class DetachDiskInstanceRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string device_name = 67541716 [(.google.api.field_behavior) = REQUIRED]; */ - private $device_name = ''; + protected $device_name = ''; /** * Instance name for this request. * * Generated from protobuf field string instance = 18257045 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance = ''; + protected $instance = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DetachNetworkEndpointsGlobalNetworkEndpointGroupRequest.php b/Compute/src/V1/DetachNetworkEndpointsGlobalNetworkEndpointGroupRequest.php index e696e7cf4600..9a7434a18c47 100644 --- a/Compute/src/V1/DetachNetworkEndpointsGlobalNetworkEndpointGroupRequest.php +++ b/Compute/src/V1/DetachNetworkEndpointsGlobalNetworkEndpointGroupRequest.php @@ -20,25 +20,25 @@ class DetachNetworkEndpointsGlobalNetworkEndpointGroupRequest extends \Google\Pr * * Generated from protobuf field .google.cloud.compute.v1.GlobalNetworkEndpointGroupsDetachEndpointsRequest global_network_endpoint_groups_detach_endpoints_request_resource = 8898269 [(.google.api.field_behavior) = REQUIRED]; */ - private $global_network_endpoint_groups_detach_endpoints_request_resource = null; + protected $global_network_endpoint_groups_detach_endpoints_request_resource = null; /** * The name of the network endpoint group where you are removing network endpoints. It should comply with RFC1035. * * Generated from protobuf field string network_endpoint_group = 433907078 [(.google.api.field_behavior) = REQUIRED]; */ - private $network_endpoint_group = ''; + protected $network_endpoint_group = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DetachNetworkEndpointsNetworkEndpointGroupRequest.php b/Compute/src/V1/DetachNetworkEndpointsNetworkEndpointGroupRequest.php index 7ab3450fc1e4..f0575729ea85 100644 --- a/Compute/src/V1/DetachNetworkEndpointsNetworkEndpointGroupRequest.php +++ b/Compute/src/V1/DetachNetworkEndpointsNetworkEndpointGroupRequest.php @@ -20,31 +20,31 @@ class DetachNetworkEndpointsNetworkEndpointGroupRequest extends \Google\Protobuf * * Generated from protobuf field string network_endpoint_group = 433907078 [(.google.api.field_behavior) = REQUIRED]; */ - private $network_endpoint_group = ''; + protected $network_endpoint_group = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.NetworkEndpointGroupsDetachEndpointsRequest network_endpoint_groups_detach_endpoints_request_resource = 515608697 [(.google.api.field_behavior) = REQUIRED]; */ - private $network_endpoint_groups_detach_endpoints_request_resource = null; + protected $network_endpoint_groups_detach_endpoints_request_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone where the network endpoint group is located. It should comply with RFC1035. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DetachNetworkEndpointsRegionNetworkEndpointGroupRequest.php b/Compute/src/V1/DetachNetworkEndpointsRegionNetworkEndpointGroupRequest.php index 31da4d3e294c..ac33a492c615 100644 --- a/Compute/src/V1/DetachNetworkEndpointsRegionNetworkEndpointGroupRequest.php +++ b/Compute/src/V1/DetachNetworkEndpointsRegionNetworkEndpointGroupRequest.php @@ -20,31 +20,31 @@ class DetachNetworkEndpointsRegionNetworkEndpointGroupRequest extends \Google\Pr * * Generated from protobuf field string network_endpoint_group = 433907078 [(.google.api.field_behavior) = REQUIRED]; */ - private $network_endpoint_group = ''; + protected $network_endpoint_group = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * The name of the region where the network endpoint group is located. It should comply with RFC1035. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.RegionNetworkEndpointGroupsDetachEndpointsRequest region_network_endpoint_groups_detach_endpoints_request_resource = 313193198 [(.google.api.field_behavior) = REQUIRED]; */ - private $region_network_endpoint_groups_detach_endpoints_request_resource = null; + protected $region_network_endpoint_groups_detach_endpoints_request_resource = null; /** * 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. 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). end_interface: MixerMutationRequestBuilder * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DisableXpnHostProjectRequest.php b/Compute/src/V1/DisableXpnHostProjectRequest.php index 528fa439e3fb..a1b79ab98e4e 100644 --- a/Compute/src/V1/DisableXpnHostProjectRequest.php +++ b/Compute/src/V1/DisableXpnHostProjectRequest.php @@ -20,13 +20,13 @@ class DisableXpnHostProjectRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/DisableXpnResourceProjectRequest.php b/Compute/src/V1/DisableXpnResourceProjectRequest.php index 0f4ee135cab1..63675243e7ad 100644 --- a/Compute/src/V1/DisableXpnResourceProjectRequest.php +++ b/Compute/src/V1/DisableXpnResourceProjectRequest.php @@ -20,19 +20,19 @@ class DisableXpnResourceProjectRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.ProjectsDisableXpnResourceRequest projects_disable_xpn_resource_request_resource = 209136170 [(.google.api.field_behavior) = REQUIRED]; */ - private $projects_disable_xpn_resource_request_resource = null; + protected $projects_disable_xpn_resource_request_resource = null; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/Disk.php b/Compute/src/V1/Disk.php index d389ece0a50e..10d3af32a934 100644 --- a/Compute/src/V1/Disk.php +++ b/Compute/src/V1/Disk.php @@ -9,7 +9,7 @@ use Google\Protobuf\Internal\GPBUtil; /** - * Represents a Persistent Disk resource. Google Compute Engine has two Disk resources: * [Zonal](/compute/docs/reference/rest/v1/disks) * [Regional](https://cloud.google.com/compute/docs/reference/rest/v1/regionDisks) Persistent disks are required for running your VM instances. Create both boot and non-boot (data) persistent disks. For more information, read Persistent Disks. For more storage options, read Storage options. The disks resource represents a zonal persistent disk. For more information, read Zonal persistent disks. The regionDisks resource represents a regional persistent disk. For more information, read Regional resources. + * Represents a Persistent Disk resource. Google Compute Engine has two Disk resources: * [Zonal](/compute/docs/reference/rest/v1/disks) * [Regional](/compute/docs/reference/rest/v1/regionDisks) Persistent disks are required for running your VM instances. Create both boot and non-boot (data) persistent disks. For more information, read Persistent Disks. For more storage options, read Storage options. The disks resource represents a zonal persistent disk. For more information, read Zonal persistent disks. The regionDisks resource represents a regional persistent disk. For more information, read Regional resources. * * Generated from protobuf message google.cloud.compute.v1.Disk */ @@ -21,20 +21,20 @@ class Disk extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string access_mode = 41155486; */ - private $access_mode = null; + protected $access_mode = null; /** * The architecture of the disk. Valid values are ARM64 or X86_64. * Check the Architecture enum for the list of possible values. * * Generated from protobuf field optional string architecture = 302803283; */ - private $architecture = null; + protected $architecture = null; /** * Disk asynchronously replicated into this disk. * * Generated from protobuf field optional .google.cloud.compute.v1.DiskAsyncReplication async_primary_disk = 180517533; */ - private $async_primary_disk = null; + protected $async_primary_disk = null; /** * [Output Only] A list of disks this disk is asynchronously replicated to. * @@ -46,25 +46,25 @@ class Disk extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * An optional description of this resource. Provide this property when you create the resource. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * Encrypts the disk using a customer-supplied encryption key or a customer-managed encryption key. Encryption keys do not protect access to metadata of the disk. After you encrypt a disk with a customer-supplied key, you must provide the same key if you use the disk later. For example, to create a disk snapshot, to create a disk image, to create a machine image, or to attach the disk to a virtual machine. After you encrypt a disk with a customer-managed key, the diskEncryptionKey.kmsKeyName is set to a key *version* name once the disk is created. The disk is encrypted with this version of the key. In the response, diskEncryptionKey.kmsKeyName appears in the following format: "diskEncryptionKey.kmsKeyName": "projects/kms_project_id/locations/region/keyRings/ key_region/cryptoKeys/key /cryptoKeysVersions/version If you do not provide an encryption key when creating the disk, then the disk is encrypted using an automatically generated key and you don't need to provide a key to use the disk later. * * Generated from protobuf field optional .google.cloud.compute.v1.CustomerEncryptionKey disk_encryption_key = 271660677; */ - private $disk_encryption_key = null; + protected $disk_encryption_key = null; /** * Whether this disk is using confidential compute mode. * * Generated from protobuf field optional bool enable_confidential_compute = 102135228; */ - private $enable_confidential_compute = null; + protected $enable_confidential_compute = null; /** * A list of features to enable on the guest operating system. Applicable only for bootable images. Read Enabling guest operating system features to see a list of available options. * @@ -76,19 +76,19 @@ class Disk extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * [Output Only] Type of the resource. Always compute#disk for disks. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * A fingerprint for the labels being applied to this disk, which is essentially a hash of the labels set used for optimistic locking. The fingerprint is initially generated by Compute Engine and changes after every request to modify or update labels. You must always provide an up-to-date fingerprint hash in order to update or change labels, otherwise the request will fail with error 412 conditionNotMet. To see the latest fingerprint, make a get() request to retrieve a disk. * * Generated from protobuf field optional string label_fingerprint = 178124825; */ - private $label_fingerprint = null; + protected $label_fingerprint = null; /** * Labels to apply to this disk. These can be later modified by the setLabels method. * @@ -100,13 +100,13 @@ class Disk extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string last_attach_timestamp = 42159653; */ - private $last_attach_timestamp = null; + protected $last_attach_timestamp = null; /** * [Output Only] Last detach timestamp in RFC3339 text format. * * Generated from protobuf field optional string last_detach_timestamp = 56471027; */ - private $last_detach_timestamp = null; + protected $last_detach_timestamp = null; /** * Integer license codes indicating which licenses are attached to this disk. * @@ -124,49 +124,49 @@ class Disk extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string location_hint = 350519505; */ - private $location_hint = null; + protected $location_hint = null; /** * Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * Internal use only. * * Generated from protobuf field optional string options = 361137822; */ - private $options = null; + protected $options = null; /** * Input only. [Input Only] Additional params passed with the request, but not persisted as part of resource payload. * * Generated from protobuf field optional .google.cloud.compute.v1.DiskParams params = 78313862; */ - private $params = null; + protected $params = null; /** * Physical block size of the persistent disk, in bytes. If not present in a request, a default value is used. The currently supported size is 4096, other sizes may be added in the future. If an unsupported value is requested, the error message will list the supported values for the caller's project. * * Generated from protobuf field optional int64 physical_block_size_bytes = 420007943; */ - private $physical_block_size_bytes = null; + protected $physical_block_size_bytes = null; /** * Indicates how many IOPS to provision for the disk. This sets the number of I/O operations per second that the disk can handle. Values must be between 10,000 and 120,000. For more details, see the Extreme persistent disk documentation. * * Generated from protobuf field optional int64 provisioned_iops = 186769108; */ - private $provisioned_iops = null; + protected $provisioned_iops = null; /** * Indicates how much throughput to provision for the disk. This sets the number of throughput mb per second that the disk can handle. Values must be greater than or equal to 1. * * Generated from protobuf field optional int64 provisioned_throughput = 526524181; */ - private $provisioned_throughput = null; + protected $provisioned_throughput = null; /** * [Output Only] URL of the region where the disk resides. Only applicable for regional resources. You must specify this field as part of the HTTP request URL. It is not settable as a field in the request body. * * Generated from protobuf field optional string region = 138946292; */ - private $region = null; + protected $region = null; /** * URLs of the zones where the disk should be replicated to. Only applicable for regional resources. * @@ -184,128 +184,128 @@ class Disk extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.DiskResourceStatus resource_status = 249429315; */ - private $resource_status = null; + protected $resource_status = null; /** * Output only. Reserved for future use. * * Generated from protobuf field optional bool satisfies_pzi = 480964257; */ - private $satisfies_pzi = null; + protected $satisfies_pzi = null; /** * [Output Only] Reserved for future use. * * Generated from protobuf field optional bool satisfies_pzs = 480964267; */ - private $satisfies_pzs = null; + protected $satisfies_pzs = null; /** * [Output Only] Server-defined fully-qualified URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * Size, in GB, of the persistent disk. You can specify this field when creating a persistent disk using the sourceImage, sourceSnapshot, or sourceDisk parameter, or specify it alone to create an empty persistent disk. If you specify this field along with a source, the value of sizeGb must not be less than the size of the source. Acceptable values are greater than 0. * * Generated from protobuf field optional int64 size_gb = 494929369; */ - private $size_gb = null; + protected $size_gb = null; /** * [Output Only] URL of the DiskConsistencyGroupPolicy for a secondary disk that was created using a consistency group. * * Generated from protobuf field optional string source_consistency_group_policy = 19616093; */ - private $source_consistency_group_policy = null; + protected $source_consistency_group_policy = null; /** * [Output Only] ID of the DiskConsistencyGroupPolicy for a secondary disk that was created using a consistency group. * * Generated from protobuf field optional string source_consistency_group_policy_id = 267568957; */ - private $source_consistency_group_policy_id = null; + protected $source_consistency_group_policy_id = null; /** * The source disk used to create this disk. You can provide this as a partial or full URL to the resource. For example, the following are valid values: - https://www.googleapis.com/compute/v1/projects/project/zones/zone /disks/disk - https://www.googleapis.com/compute/v1/projects/project/regions/region /disks/disk - projects/project/zones/zone/disks/disk - projects/project/regions/region/disks/disk - zones/zone/disks/disk - regions/region/disks/disk * * Generated from protobuf field optional string source_disk = 451753793; */ - private $source_disk = null; + protected $source_disk = null; /** * [Output Only] The unique ID of the disk used to create this disk. This value identifies the exact disk that was used to create this persistent disk. For example, if you created the persistent disk from a disk that was later deleted and recreated under the same name, the source disk ID would identify the exact version of the disk that was used. * * Generated from protobuf field optional string source_disk_id = 454190809; */ - private $source_disk_id = null; + protected $source_disk_id = null; /** * The source image used to create this disk. If the source image is deleted, this field will not be set. To create a disk with one of the public operating system images, specify the image by its family name. For example, specify family/debian-9 to use the latest Debian 9 image: projects/debian-cloud/global/images/family/debian-9 Alternatively, use a specific version of a public operating system image: projects/debian-cloud/global/images/debian-9-stretch-vYYYYMMDD To create a disk with a custom image that you created, specify the image name in the following format: global/images/my-custom-image You can also specify a custom image by its image family, which returns the latest version of the image in that family. Replace the image name with family/family-name: global/images/family/my-image-family * * Generated from protobuf field optional string source_image = 50443319; */ - private $source_image = null; + protected $source_image = null; /** * The customer-supplied encryption key of the source image. Required if the source image is protected by a customer-supplied encryption key. * * Generated from protobuf field optional .google.cloud.compute.v1.CustomerEncryptionKey source_image_encryption_key = 381503659; */ - private $source_image_encryption_key = null; + protected $source_image_encryption_key = null; /** * [Output Only] The ID value of the image used to create this disk. This value identifies the exact image that was used to create this persistent disk. For example, if you created the persistent disk from an image that was later deleted and recreated under the same name, the source image ID would identify the exact version of the image that was used. * * Generated from protobuf field optional string source_image_id = 55328291; */ - private $source_image_id = null; + protected $source_image_id = null; /** * The source instant snapshot used to create this disk. You can provide this as a partial or full URL to the resource. For example, the following are valid values: - https://www.googleapis.com/compute/v1/projects/project/zones/zone /instantSnapshots/instantSnapshot - projects/project/zones/zone/instantSnapshots/instantSnapshot - zones/zone/instantSnapshots/instantSnapshot * * Generated from protobuf field optional string source_instant_snapshot = 219202054; */ - private $source_instant_snapshot = null; + protected $source_instant_snapshot = null; /** * [Output Only] The unique ID of the instant snapshot used to create this disk. This value identifies the exact instant snapshot that was used to create this persistent disk. For example, if you created the persistent disk from an instant snapshot that was later deleted and recreated under the same name, the source instant snapshot ID would identify the exact version of the instant snapshot that was used. * * Generated from protobuf field optional string source_instant_snapshot_id = 287582708; */ - private $source_instant_snapshot_id = null; + protected $source_instant_snapshot_id = null; /** * The source snapshot used to create this disk. You can provide this as a partial or full URL to the resource. For example, the following are valid values: - https://www.googleapis.com/compute/v1/projects/project /global/snapshots/snapshot - projects/project/global/snapshots/snapshot - global/snapshots/snapshot * * Generated from protobuf field optional string source_snapshot = 126061928; */ - private $source_snapshot = null; + protected $source_snapshot = null; /** * The customer-supplied encryption key of the source snapshot. Required if the source snapshot is protected by a customer-supplied encryption key. * * Generated from protobuf field optional .google.cloud.compute.v1.CustomerEncryptionKey source_snapshot_encryption_key = 303679322; */ - private $source_snapshot_encryption_key = null; + protected $source_snapshot_encryption_key = null; /** * [Output Only] The unique ID of the snapshot used to create this disk. This value identifies the exact snapshot that was used to create this persistent disk. For example, if you created the persistent disk from a snapshot that was later deleted and recreated under the same name, the source snapshot ID would identify the exact version of the snapshot that was used. * * Generated from protobuf field optional string source_snapshot_id = 98962258; */ - private $source_snapshot_id = null; + protected $source_snapshot_id = null; /** * The full Google Cloud Storage URI where the disk image is stored. This file must be a gzip-compressed tarball whose name ends in .tar.gz or virtual machine disk whose name ends in vmdk. Valid URIs may start with gs:// or https://storage.googleapis.com/. This flag is not optimized for creating multiple disks from a source storage object. To create many disks from a source storage object, use gcloud compute images import instead. * * Generated from protobuf field optional string source_storage_object = 233052711; */ - private $source_storage_object = null; + protected $source_storage_object = null; /** * [Output Only] The status of disk creation. - CREATING: Disk is provisioning. - RESTORING: Source data is being copied into the disk. - FAILED: Disk creation failed. - READY: Disk is ready for use. - DELETING: Disk is deleting. * Check the Status enum for the list of possible values. * * Generated from protobuf field optional string status = 181260274; */ - private $status = null; + protected $status = null; /** * The storage pool in which the new disk is created. You can provide this as a partial or full URL to the resource. For example, the following are valid values: - https://www.googleapis.com/compute/v1/projects/project/zones/zone /storagePools/storagePool - projects/project/zones/zone/storagePools/storagePool - zones/zone/storagePools/storagePool * * Generated from protobuf field optional string storage_pool = 360473440; */ - private $storage_pool = null; + protected $storage_pool = null; /** * URL of the disk type resource describing which disk type to use to create the disk. Provide this when creating the disk. For example: projects/project /zones/zone/diskTypes/pd-ssd . See Persistent disk types. * * Generated from protobuf field optional string type = 3575610; */ - private $type = null; + protected $type = null; /** * [Output Only] Links to the users of the disk (attached instances) in form: projects/project/zones/zone/instances/instance * @@ -317,7 +317,7 @@ class Disk extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string zone = 3744684; */ - private $zone = null; + protected $zone = null; /** * Constructor. diff --git a/Compute/src/V1/DiskAggregatedList.php b/Compute/src/V1/DiskAggregatedList.php index 185a961dd784..e4f632536f15 100644 --- a/Compute/src/V1/DiskAggregatedList.php +++ b/Compute/src/V1/DiskAggregatedList.php @@ -19,7 +19,7 @@ class DiskAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of DisksScopedList resources. * @@ -31,19 +31,19 @@ class DiskAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Unreachable resources. * @@ -55,7 +55,7 @@ class DiskAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/DiskAsyncReplication.php b/Compute/src/V1/DiskAsyncReplication.php index 8f5214b9c3b5..342490dc10ad 100644 --- a/Compute/src/V1/DiskAsyncReplication.php +++ b/Compute/src/V1/DiskAsyncReplication.php @@ -19,25 +19,25 @@ class DiskAsyncReplication extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string consistency_group_policy = 1991097; */ - private $consistency_group_policy = null; + protected $consistency_group_policy = null; /** * [Output Only] ID of the DiskConsistencyGroupPolicy if replication was started on the disk as a member of a group. * * Generated from protobuf field optional string consistency_group_policy_id = 261065057; */ - private $consistency_group_policy_id = null; + protected $consistency_group_policy_id = null; /** * The other disk asynchronously replicated to or from the current disk. You can provide this as a partial or full URL to the resource. For example, the following are valid values: - https://www.googleapis.com/compute/v1/projects/project/zones/zone /disks/disk - projects/project/zones/zone/disks/disk - zones/zone/disks/disk * * Generated from protobuf field optional string disk = 3083677; */ - private $disk = null; + protected $disk = null; /** * [Output Only] The unique ID of the other disk asynchronously replicated to or from the current disk. This value identifies the exact disk that was used to create this replication. For example, if you started replicating the persistent disk from a disk that was later deleted and recreated under the same name, the disk ID would identify the exact version of the disk that was used. * * Generated from protobuf field optional string disk_id = 60990205; */ - private $disk_id = null; + protected $disk_id = null; /** * Constructor. diff --git a/Compute/src/V1/DiskAsyncReplicationList.php b/Compute/src/V1/DiskAsyncReplicationList.php index 1da82262ab80..15f1cd7ab9f3 100644 --- a/Compute/src/V1/DiskAsyncReplicationList.php +++ b/Compute/src/V1/DiskAsyncReplicationList.php @@ -17,7 +17,7 @@ class DiskAsyncReplicationList extends \Google\Protobuf\Internal\Message /** * Generated from protobuf field optional .google.cloud.compute.v1.DiskAsyncReplication async_replication_disk = 231794067; */ - private $async_replication_disk = null; + protected $async_replication_disk = null; /** * Constructor. diff --git a/Compute/src/V1/DiskInstantiationConfig.php b/Compute/src/V1/DiskInstantiationConfig.php index b753ec0d5945..06de762466a7 100644 --- a/Compute/src/V1/DiskInstantiationConfig.php +++ b/Compute/src/V1/DiskInstantiationConfig.php @@ -20,26 +20,26 @@ class DiskInstantiationConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional bool auto_delete = 464761403; */ - private $auto_delete = null; + protected $auto_delete = null; /** * The custom source image to be used to restore this disk when instantiating this instance template. * * Generated from protobuf field optional string custom_image = 184123149; */ - private $custom_image = null; + protected $custom_image = null; /** * Specifies the device name of the disk to which the configurations apply to. * * Generated from protobuf field optional string device_name = 67541716; */ - private $device_name = null; + protected $device_name = null; /** * Specifies whether to include the disk and what image to use. Possible values are: - source-image: to use the same image that was used to create the source instance's corresponding disk. Applicable to the boot disk and additional read-write disks. - source-image-family: to use the same image family that was used to create the source instance's corresponding disk. Applicable to the boot disk and additional read-write disks. - custom-image: to use a user-provided image url for disk creation. Applicable to the boot disk and additional read-write disks. - attach-read-only: to attach a read-only disk. Applicable to read-only disks. - do-not-include: to exclude a disk from the template. Applicable to additional read-write disks, local SSDs, and read-only disks. * Check the InstantiateFrom enum for the list of possible values. * * Generated from protobuf field optional string instantiate_from = 393383903; */ - private $instantiate_from = null; + protected $instantiate_from = null; /** * Constructor. diff --git a/Compute/src/V1/DiskList.php b/Compute/src/V1/DiskList.php index 72542bf4eaa5..abfde790a352 100644 --- a/Compute/src/V1/DiskList.php +++ b/Compute/src/V1/DiskList.php @@ -20,7 +20,7 @@ class DiskList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of Disk resources. * @@ -32,25 +32,25 @@ class DiskList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/DiskMoveRequest.php b/Compute/src/V1/DiskMoveRequest.php index 0444408085ed..af83a7deeb58 100644 --- a/Compute/src/V1/DiskMoveRequest.php +++ b/Compute/src/V1/DiskMoveRequest.php @@ -19,13 +19,13 @@ class DiskMoveRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string destination_zone = 131854653; */ - private $destination_zone = null; + protected $destination_zone = null; /** * The URL of the target disk to move. This can be a full or partial URL. For example, the following are all valid URLs to a disk: - https://www.googleapis.com/compute/v1/projects/project/zones/zone /disks/disk - projects/project/zones/zone/disks/disk - zones/zone/disks/disk * * Generated from protobuf field optional string target_disk = 62433163; */ - private $target_disk = null; + protected $target_disk = null; /** * Constructor. diff --git a/Compute/src/V1/DiskResourceStatus.php b/Compute/src/V1/DiskResourceStatus.php index 11d0d9961a29..83db94a520a8 100644 --- a/Compute/src/V1/DiskResourceStatus.php +++ b/Compute/src/V1/DiskResourceStatus.php @@ -17,7 +17,7 @@ class DiskResourceStatus extends \Google\Protobuf\Internal\Message /** * Generated from protobuf field optional .google.cloud.compute.v1.DiskResourceStatusAsyncReplicationStatus async_primary_disk = 180517533; */ - private $async_primary_disk = null; + protected $async_primary_disk = null; /** * Key: disk, value: AsyncReplicationStatus message * diff --git a/Compute/src/V1/DiskResourceStatusAsyncReplicationStatus.php b/Compute/src/V1/DiskResourceStatusAsyncReplicationStatus.php index fe9c748861c3..e2a0b2b2c362 100644 --- a/Compute/src/V1/DiskResourceStatusAsyncReplicationStatus.php +++ b/Compute/src/V1/DiskResourceStatusAsyncReplicationStatus.php @@ -20,7 +20,7 @@ class DiskResourceStatusAsyncReplicationStatus extends \Google\Protobuf\Internal * * Generated from protobuf field optional string state = 109757585; */ - private $state = null; + protected $state = null; /** * Constructor. diff --git a/Compute/src/V1/DiskType.php b/Compute/src/V1/DiskType.php index 93a8ccd89ef1..792708a0ed1c 100644 --- a/Compute/src/V1/DiskType.php +++ b/Compute/src/V1/DiskType.php @@ -9,7 +9,7 @@ use Google\Protobuf\Internal\GPBUtil; /** - * Represents a Disk Type resource. Google Compute Engine has two Disk Type resources: * [Regional](/compute/docs/reference/rest/v1/regionDiskTypes) * [Zonal](https://cloud.google.com/compute/docs/reference/rest/v1/diskTypes) You can choose from a variety of disk types based on your needs. For more information, read Storage options. The diskTypes resource represents disk types for a zonal persistent disk. For more information, read Zonal persistent disks. The regionDiskTypes resource represents disk types for a regional persistent disk. For more information, read Regional persistent disks. + * Represents a Disk Type resource. Google Compute Engine has two Disk Type resources: * [Regional](/compute/docs/reference/rest/v1/regionDiskTypes) * [Zonal](/compute/docs/reference/rest/v1/diskTypes) You can choose from a variety of disk types based on your needs. For more information, read Storage options. The diskTypes resource represents disk types for a zonal persistent disk. For more information, read Zonal persistent disks. The regionDiskTypes resource represents disk types for a regional persistent disk. For more information, read Regional persistent disks. * * Generated from protobuf message google.cloud.compute.v1.DiskType */ @@ -20,67 +20,67 @@ class DiskType extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * [Output Only] Server-defined default disk size in GB. * * Generated from protobuf field optional int64 default_disk_size_gb = 270619253; */ - private $default_disk_size_gb = null; + protected $default_disk_size_gb = null; /** * [Output Only] The deprecation status associated with this disk type. * * Generated from protobuf field optional .google.cloud.compute.v1.DeprecationStatus deprecated = 515138995; */ - private $deprecated = null; + protected $deprecated = null; /** * [Output Only] An optional description of this resource. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * [Output Only] The unique identifier for the resource. This identifier is defined by the server. * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * [Output Only] Type of the resource. Always compute#diskType for disk types. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] Name of the resource. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * [Output Only] URL of the region where the disk type resides. Only applicable for regional resources. You must specify this field as part of the HTTP request URL. It is not settable as a field in the request body. * * Generated from protobuf field optional string region = 138946292; */ - private $region = null; + protected $region = null; /** * [Output Only] Server-defined URL for the resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] An optional textual description of the valid disk size, such as "10GB-10TB". * * Generated from protobuf field optional string valid_disk_size = 493962464; */ - private $valid_disk_size = null; + protected $valid_disk_size = null; /** * [Output Only] URL of the zone where the disk type resides. You must specify this field as part of the HTTP request URL. It is not settable as a field in the request body. * * Generated from protobuf field optional string zone = 3744684; */ - private $zone = null; + protected $zone = null; /** * Constructor. diff --git a/Compute/src/V1/DiskTypeAggregatedList.php b/Compute/src/V1/DiskTypeAggregatedList.php index 214baed64371..2599645a3cb1 100644 --- a/Compute/src/V1/DiskTypeAggregatedList.php +++ b/Compute/src/V1/DiskTypeAggregatedList.php @@ -19,7 +19,7 @@ class DiskTypeAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of DiskTypesScopedList resources. * @@ -31,19 +31,19 @@ class DiskTypeAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Unreachable resources. * @@ -55,7 +55,7 @@ class DiskTypeAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/DiskTypeList.php b/Compute/src/V1/DiskTypeList.php index 37bdd3f7fec7..d5c6cda8a6dc 100644 --- a/Compute/src/V1/DiskTypeList.php +++ b/Compute/src/V1/DiskTypeList.php @@ -20,7 +20,7 @@ class DiskTypeList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of DiskType resources. * @@ -32,25 +32,25 @@ class DiskTypeList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/DiskTypesClient.php b/Compute/src/V1/DiskTypesClient.php deleted file mode 100644 index 9c98d8956a30..000000000000 --- a/Compute/src/V1/DiskTypesClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/DisksClient.php b/Compute/src/V1/DisksClient.php deleted file mode 100644 index ccd5d43a9898..000000000000 --- a/Compute/src/V1/DisksClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional int64 size_gb = 494929369; */ - private $size_gb = null; + protected $size_gb = null; /** * Constructor. diff --git a/Compute/src/V1/DisksScopedList.php b/Compute/src/V1/DisksScopedList.php index a0cf07aef01f..a819d3cd5e4c 100644 --- a/Compute/src/V1/DisksScopedList.php +++ b/Compute/src/V1/DisksScopedList.php @@ -25,7 +25,7 @@ class DisksScopedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/DisksStartAsyncReplicationRequest.php b/Compute/src/V1/DisksStartAsyncReplicationRequest.php index 9f99847bf38a..ad5447020182 100644 --- a/Compute/src/V1/DisksStartAsyncReplicationRequest.php +++ b/Compute/src/V1/DisksStartAsyncReplicationRequest.php @@ -19,7 +19,7 @@ class DisksStartAsyncReplicationRequest extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field optional string async_secondary_disk = 131645867; */ - private $async_secondary_disk = null; + protected $async_secondary_disk = null; /** * Constructor. diff --git a/Compute/src/V1/DisksStopGroupAsyncReplicationResource.php b/Compute/src/V1/DisksStopGroupAsyncReplicationResource.php index 5bb38074f18c..d134b338a2eb 100644 --- a/Compute/src/V1/DisksStopGroupAsyncReplicationResource.php +++ b/Compute/src/V1/DisksStopGroupAsyncReplicationResource.php @@ -20,7 +20,7 @@ class DisksStopGroupAsyncReplicationResource extends \Google\Protobuf\Internal\M * * Generated from protobuf field optional string resource_policy = 159240835; */ - private $resource_policy = null; + protected $resource_policy = null; /** * Constructor. diff --git a/Compute/src/V1/DisplayDevice.php b/Compute/src/V1/DisplayDevice.php index a56382e63057..caaac6dfef3b 100644 --- a/Compute/src/V1/DisplayDevice.php +++ b/Compute/src/V1/DisplayDevice.php @@ -20,7 +20,7 @@ class DisplayDevice extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional bool enable_display = 14266886; */ - private $enable_display = null; + protected $enable_display = null; /** * Constructor. diff --git a/Compute/src/V1/DistributionPolicy.php b/Compute/src/V1/DistributionPolicy.php index 6d8c9ca05048..cd5bdd981794 100644 --- a/Compute/src/V1/DistributionPolicy.php +++ b/Compute/src/V1/DistributionPolicy.php @@ -20,7 +20,7 @@ class DistributionPolicy extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string target_shape = 338621299; */ - private $target_shape = null; + protected $target_shape = null; /** * Zones where the regional managed instance group will create and manage its instances. * diff --git a/Compute/src/V1/DistributionPolicyZoneConfiguration.php b/Compute/src/V1/DistributionPolicyZoneConfiguration.php index 784b596b31b7..377fcfecd7fc 100644 --- a/Compute/src/V1/DistributionPolicyZoneConfiguration.php +++ b/Compute/src/V1/DistributionPolicyZoneConfiguration.php @@ -19,7 +19,7 @@ class DistributionPolicyZoneConfiguration extends \Google\Protobuf\Internal\Mess * * Generated from protobuf field optional string zone = 3744684; */ - private $zone = null; + protected $zone = null; /** * Constructor. diff --git a/Compute/src/V1/Duration.php b/Compute/src/V1/Duration.php index 1db3b347d1e0..fb27945fa449 100644 --- a/Compute/src/V1/Duration.php +++ b/Compute/src/V1/Duration.php @@ -20,13 +20,13 @@ class Duration extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int32 nanos = 104586303; */ - private $nanos = null; + protected $nanos = null; /** * Span of time at a resolution of a second. Must be from 0 to 315,576,000,000 inclusive. Note: these bounds are computed from: 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years * * Generated from protobuf field optional int64 seconds = 359484031; */ - private $seconds = null; + protected $seconds = null; /** * Constructor. diff --git a/Compute/src/V1/EnableXpnHostProjectRequest.php b/Compute/src/V1/EnableXpnHostProjectRequest.php index 6ef04ed3195a..2a3447ae1659 100644 --- a/Compute/src/V1/EnableXpnHostProjectRequest.php +++ b/Compute/src/V1/EnableXpnHostProjectRequest.php @@ -20,13 +20,13 @@ class EnableXpnHostProjectRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/EnableXpnResourceProjectRequest.php b/Compute/src/V1/EnableXpnResourceProjectRequest.php index efe4d8eb8daa..79f4c2241d77 100644 --- a/Compute/src/V1/EnableXpnResourceProjectRequest.php +++ b/Compute/src/V1/EnableXpnResourceProjectRequest.php @@ -20,19 +20,19 @@ class EnableXpnResourceProjectRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.ProjectsEnableXpnResourceRequest projects_enable_xpn_resource_request_resource = 421980207 [(.google.api.field_behavior) = REQUIRED]; */ - private $projects_enable_xpn_resource_request_resource = null; + protected $projects_enable_xpn_resource_request_resource = null; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/Enums/AccessConfig/NetworkTier.php b/Compute/src/V1/Enums/AccessConfig/NetworkTier.php deleted file mode 100644 index d882fe715cb9..000000000000 --- a/Compute/src/V1/Enums/AccessConfig/NetworkTier.php +++ /dev/null @@ -1,42 +0,0 @@ -optional .google.cloud.compute.v1.ErrorInfo error_info = 25251973; */ - private $error_info = null; + protected $error_info = null; /** * Generated from protobuf field optional .google.cloud.compute.v1.Help help = 3198785; */ - private $help = null; + protected $help = null; /** * Generated from protobuf field optional .google.cloud.compute.v1.LocalizedMessage localized_message = 404537155; */ - private $localized_message = null; + protected $localized_message = null; /** * Generated from protobuf field optional .google.cloud.compute.v1.QuotaExceededInfo quota_info = 93923861; */ - private $quota_info = null; + protected $quota_info = null; /** * Constructor. diff --git a/Compute/src/V1/ErrorInfo.php b/Compute/src/V1/ErrorInfo.php index 56765dbe33bc..f8e5eca2a127 100644 --- a/Compute/src/V1/ErrorInfo.php +++ b/Compute/src/V1/ErrorInfo.php @@ -20,7 +20,7 @@ class ErrorInfo extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string domain = 284415172; */ - private $domain = null; + protected $domain = null; /** * Additional structured details about this error. Keys must match a regular expression of `a-z+` but should ideally be lowerCamelCase. Also, they must be limited to 64 characters in length. When identifying the current value of an exceeded limit, the units should be contained in the key, not the value. For example, rather than `{"instanceLimit": "100/request"}`, should be returned as, `{"instanceLimitPerRequest": "100"}`, if the client exceeds the number of instances that can be created in a single (batch) request. * @@ -32,7 +32,7 @@ class ErrorInfo extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string reason = 138777156; */ - private $reason = null; + protected $reason = null; /** * Constructor. diff --git a/Compute/src/V1/Errors.php b/Compute/src/V1/Errors.php index d42d8a645fab..232efc194aeb 100644 --- a/Compute/src/V1/Errors.php +++ b/Compute/src/V1/Errors.php @@ -19,7 +19,7 @@ class Errors extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string code = 3059181; */ - private $code = null; + protected $code = null; /** * [Output Only] An optional list of messages that contain the error details. There is a set of defined message types to use for providing details.The syntax depends on the error code. For example, QuotaExceededInfo will have details when the error code is QUOTA_EXCEEDED. * @@ -31,13 +31,13 @@ class Errors extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string location = 290430901; */ - private $location = null; + protected $location = null; /** * [Output Only] An optional, human-readable error message. * * Generated from protobuf field optional string message = 418054151; */ - private $message = null; + protected $message = null; /** * Constructor. diff --git a/Compute/src/V1/ExchangedPeeringRoute.php b/Compute/src/V1/ExchangedPeeringRoute.php index dde83773dd8c..e74aeec28197 100644 --- a/Compute/src/V1/ExchangedPeeringRoute.php +++ b/Compute/src/V1/ExchangedPeeringRoute.php @@ -19,32 +19,32 @@ class ExchangedPeeringRoute extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string dest_range = 381327712; */ - private $dest_range = null; + protected $dest_range = null; /** * True if the peering route has been imported from a peer. The actual import happens if the field networkPeering.importCustomRoutes is true for this network, and networkPeering.exportCustomRoutes is true for the peer network, and the import does not result in a route conflict. * * Generated from protobuf field optional bool imported = 114502404; */ - private $imported = null; + protected $imported = null; /** * The region of peering route next hop, only applies to dynamic routes. * * Generated from protobuf field optional string next_hop_region = 122577014; */ - private $next_hop_region = null; + protected $next_hop_region = null; /** * The priority of the peering route. * * Generated from protobuf field optional uint32 priority = 445151652; */ - private $priority = null; + protected $priority = null; /** * The type of the peering route. * Check the Type enum for the list of possible values. * * Generated from protobuf field optional string type = 3575610; */ - private $type = null; + protected $type = null; /** * Constructor. diff --git a/Compute/src/V1/ExchangedPeeringRoutesList.php b/Compute/src/V1/ExchangedPeeringRoutesList.php index 328d66a6f398..c5f3f54170a3 100644 --- a/Compute/src/V1/ExchangedPeeringRoutesList.php +++ b/Compute/src/V1/ExchangedPeeringRoutesList.php @@ -19,7 +19,7 @@ class ExchangedPeeringRoutesList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of ExchangedPeeringRoute resources. * @@ -31,25 +31,25 @@ class ExchangedPeeringRoutesList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/ExpandIpCidrRangeSubnetworkRequest.php b/Compute/src/V1/ExpandIpCidrRangeSubnetworkRequest.php index e794f50e44a4..9ffde28fe313 100644 --- a/Compute/src/V1/ExpandIpCidrRangeSubnetworkRequest.php +++ b/Compute/src/V1/ExpandIpCidrRangeSubnetworkRequest.php @@ -20,31 +20,31 @@ class ExpandIpCidrRangeSubnetworkRequest extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name of the Subnetwork resource to update. * * Generated from protobuf field string subnetwork = 307827694 [(.google.api.field_behavior) = REQUIRED]; */ - private $subnetwork = ''; + protected $subnetwork = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.SubnetworksExpandIpCidrRangeRequest subnetworks_expand_ip_cidr_range_request_resource = 477014110 [(.google.api.field_behavior) = REQUIRED]; */ - private $subnetworks_expand_ip_cidr_range_request_resource = null; + protected $subnetworks_expand_ip_cidr_range_request_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/Expr.php b/Compute/src/V1/Expr.php index 7cb46edcdbcf..c591d666993f 100644 --- a/Compute/src/V1/Expr.php +++ b/Compute/src/V1/Expr.php @@ -20,25 +20,25 @@ class Expr extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * Textual representation of an expression in Common Expression Language syntax. * * Generated from protobuf field optional string expression = 352031384; */ - private $expression = null; + protected $expression = null; /** * Optional. String indicating the location of the expression for error reporting, e.g. a file name and a position in the file. * * Generated from protobuf field optional string location = 290430901; */ - private $location = null; + protected $location = null; /** * Optional. Title for the expression, i.e. a short string describing its purpose. This can be used e.g. in UIs which allow to enter the expression. * * Generated from protobuf field optional string title = 110371416; */ - private $title = null; + protected $title = null; /** * Constructor. diff --git a/Compute/src/V1/ExternalVpnGateway.php b/Compute/src/V1/ExternalVpnGateway.php index 641a4dc446d1..5e7b0d50ee33 100644 --- a/Compute/src/V1/ExternalVpnGateway.php +++ b/Compute/src/V1/ExternalVpnGateway.php @@ -20,19 +20,19 @@ class ExternalVpnGateway extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * An optional description of this resource. Provide this property when you create the resource. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * [Output Only] The unique identifier for the resource. This identifier is defined by the server. * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * A list of interfaces for this external VPN gateway. If your peer-side gateway is an on-premises gateway and non-AWS cloud providers' gateway, at most two interfaces can be provided for an external VPN gateway. If your peer side is an AWS virtual private gateway, four interfaces should be provided for an external VPN gateway. * @@ -44,13 +44,13 @@ class ExternalVpnGateway extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * A fingerprint for the labels being applied to this ExternalVpnGateway, which is essentially a hash of the labels set used for optimistic locking. The fingerprint is initially generated by Compute Engine and changes after every request to modify or update labels. You must always provide an up-to-date fingerprint hash in order to update or change labels, otherwise the request will fail with error 412 conditionNotMet. To see the latest fingerprint, make a get() request to retrieve an ExternalVpnGateway. * * Generated from protobuf field optional string label_fingerprint = 178124825; */ - private $label_fingerprint = null; + protected $label_fingerprint = null; /** * Labels for this resource. These can only be added or modified by the setLabels method. Each label key/value pair must comply with RFC1035. Label values may be empty. * @@ -62,20 +62,20 @@ class ExternalVpnGateway extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * Indicates the user-supplied redundancy type of this external VPN gateway. * Check the RedundancyType enum for the list of possible values. * * Generated from protobuf field optional string redundancy_type = 271443740; */ - private $redundancy_type = null; + protected $redundancy_type = null; /** * [Output Only] Server-defined URL for the resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * Constructor. diff --git a/Compute/src/V1/ExternalVpnGatewayInterface.php b/Compute/src/V1/ExternalVpnGatewayInterface.php index 3683b5d01a67..be6f9b269d5e 100644 --- a/Compute/src/V1/ExternalVpnGatewayInterface.php +++ b/Compute/src/V1/ExternalVpnGatewayInterface.php @@ -20,19 +20,19 @@ class ExternalVpnGatewayInterface extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional uint32 id = 3355; */ - private $id = null; + protected $id = null; /** * IP address of the interface in the external VPN gateway. Only IPv4 is supported. This IP address can be either from your on-premise gateway or another Cloud provider's VPN gateway, it cannot be an IP address from Google Compute Engine. * * Generated from protobuf field optional string ip_address = 406272220; */ - private $ip_address = null; + protected $ip_address = null; /** * IPv6 address of the interface in the external VPN gateway. This IPv6 address can be either from your on-premise gateway or another Cloud provider's VPN gateway, it cannot be an IP address from Google Compute Engine. Must specify an IPv6 address (not IPV4-mapped) using any format described in RFC 4291 (e.g. 2001:db8:0:0:2d9:51:0:0). The output format is RFC 5952 format (e.g. 2001:db8::2d9:51:0:0). * * Generated from protobuf field optional string ipv6_address = 341563804; */ - private $ipv6_address = null; + protected $ipv6_address = null; /** * Constructor. diff --git a/Compute/src/V1/ExternalVpnGatewayList.php b/Compute/src/V1/ExternalVpnGatewayList.php index c0ec728e0e03..04cd872b1a6b 100644 --- a/Compute/src/V1/ExternalVpnGatewayList.php +++ b/Compute/src/V1/ExternalVpnGatewayList.php @@ -18,13 +18,13 @@ class ExternalVpnGatewayList extends \Google\Protobuf\Internal\Message /** * Generated from protobuf field optional string etag = 3123477; */ - private $etag = null; + protected $etag = null; /** * [Output Only] Unique identifier for the resource; defined by the server. * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of ExternalVpnGateway resources. * @@ -36,25 +36,25 @@ class ExternalVpnGatewayList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/ExternalVpnGatewaysClient.php b/Compute/src/V1/ExternalVpnGatewaysClient.php deleted file mode 100644 index 0e6d37713fc5..000000000000 --- a/Compute/src/V1/ExternalVpnGatewaysClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional string content = 414659705; */ - private $content = null; + protected $content = null; /** * The file type of source file. * Check the FileType enum for the list of possible values. * * Generated from protobuf field optional string file_type = 294346781; */ - private $file_type = null; + protected $file_type = null; /** * Constructor. diff --git a/Compute/src/V1/Firewall.php b/Compute/src/V1/Firewall.php index 67308338b2f4..e247babb20d2 100644 --- a/Compute/src/V1/Firewall.php +++ b/Compute/src/V1/Firewall.php @@ -26,7 +26,7 @@ class Firewall extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * The list of DENY rules specified by this firewall. Each rule specifies a protocol and port-range tuple that describes a denied connection. * @@ -38,7 +38,7 @@ class Firewall extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * If destination ranges are specified, the firewall rule applies only to traffic that has destination IP address in these ranges. These ranges must be expressed in CIDR format. Both IPv4 and IPv6 are supported. * @@ -51,61 +51,61 @@ class Firewall extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string direction = 111150975; */ - private $direction = null; + protected $direction = null; /** * Denotes whether the firewall rule is disabled. When set to true, the firewall rule is not enforced and the network behaves as if it did not exist. If this is unspecified, the firewall rule will be enabled. * * Generated from protobuf field optional bool disabled = 270940796; */ - private $disabled = null; + protected $disabled = null; /** * [Output Only] The unique identifier for the resource. This identifier is defined by the server. * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * [Output Only] Type of the resource. Always compute#firewall for firewall rules. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * This field denotes the logging options for a particular firewall rule. If logging is enabled, logs will be exported to Cloud Logging. * * Generated from protobuf field optional .google.cloud.compute.v1.FirewallLogConfig log_config = 351299741; */ - private $log_config = null; + protected $log_config = null; /** * Name of the resource; provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?`. The first character must be a lowercase letter, and all following characters (except for the last character) must be a dash, lowercase letter, or digit. The last character must be a lowercase letter or digit. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * URL of the network resource for this firewall rule. If not specified when creating a firewall rule, the default network is used: global/networks/default If you choose to specify this field, you can specify the network as a full or partial URL. For example, the following are all valid URLs: - https://www.googleapis.com/compute/v1/projects/myproject/global/networks/my-network - projects/myproject/global/networks/my-network - global/networks/default * * Generated from protobuf field optional string network = 232872494; */ - private $network = null; + protected $network = null; /** * Input only. [Input Only] Additional params passed with the request, but not persisted as part of resource payload. * * Generated from protobuf field optional .google.cloud.compute.v1.FirewallParams params = 78313862; */ - private $params = null; + protected $params = null; /** * Priority for this rule. This is an integer between `0` and `65535`, both inclusive. The default value is `1000`. Relative priorities determine which rule takes effect if multiple rules apply. Lower values indicate higher priority. For example, a rule with priority `0` has higher precedence than a rule with priority `1`. DENY rules take precedence over ALLOW rules if they have equal priority. Note that VPC networks have implied rules with a priority of `65535`. To avoid conflicts with the implied rules, use a priority number less than `65535`. * * Generated from protobuf field optional int32 priority = 445151652; */ - private $priority = null; + protected $priority = null; /** * [Output Only] Server-defined URL for the resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * If source ranges are specified, the firewall rule applies only to traffic that has a source IP address in these ranges. These ranges must be expressed in CIDR format. One or both of sourceRanges and sourceTags may be set. If both fields are set, the rule applies to traffic that has a source IP address within sourceRanges OR a source IP from a resource with a matching tag listed in the sourceTags field. The connection does not need to match both fields for the rule to apply. Both IPv4 and IPv6 are supported. * diff --git a/Compute/src/V1/FirewallList.php b/Compute/src/V1/FirewallList.php index dbd343e2352b..4661f6f4b551 100644 --- a/Compute/src/V1/FirewallList.php +++ b/Compute/src/V1/FirewallList.php @@ -20,7 +20,7 @@ class FirewallList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of Firewall resources. * @@ -32,25 +32,25 @@ class FirewallList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/FirewallLogConfig.php b/Compute/src/V1/FirewallLogConfig.php index 7ab80d3e9d05..585bfe18acbd 100644 --- a/Compute/src/V1/FirewallLogConfig.php +++ b/Compute/src/V1/FirewallLogConfig.php @@ -20,14 +20,14 @@ class FirewallLogConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional bool enable = 311764355; */ - private $enable = null; + protected $enable = null; /** * This field can only be specified for a particular firewall rule if logging is enabled for that rule. This field denotes whether to include or exclude metadata for firewall logs. * Check the Metadata enum for the list of possible values. * * Generated from protobuf field optional string metadata = 86866735; */ - private $metadata = null; + protected $metadata = null; /** * Constructor. diff --git a/Compute/src/V1/FirewallPoliciesClient.php b/Compute/src/V1/FirewallPoliciesClient.php deleted file mode 100644 index a72d5076f8f5..000000000000 --- a/Compute/src/V1/FirewallPoliciesClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * Constructor. diff --git a/Compute/src/V1/FirewallPoliciesScopedList.php b/Compute/src/V1/FirewallPoliciesScopedList.php index 9627c70fdf42..2fc7fca4f846 100644 --- a/Compute/src/V1/FirewallPoliciesScopedList.php +++ b/Compute/src/V1/FirewallPoliciesScopedList.php @@ -25,7 +25,7 @@ class FirewallPoliciesScopedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/FirewallPolicy.php b/Compute/src/V1/FirewallPolicy.php index de6104c0890d..b8319f426874 100644 --- a/Compute/src/V1/FirewallPolicy.php +++ b/Compute/src/V1/FirewallPolicy.php @@ -26,43 +26,43 @@ class FirewallPolicy extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * An optional description of this resource. Provide this property when you create the resource. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * Deprecated, please use short name instead. User-provided name of the Organization firewall policy. The name should be unique in the organization in which the firewall policy is created. This field is not applicable to network firewall policies. This name must be set on creation and cannot be changed. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. * * Generated from protobuf field optional string display_name = 4473832; */ - private $display_name = null; + protected $display_name = null; /** * Specifies a fingerprint for this resource, which is essentially a hash of the metadata's contents and used for optimistic locking. The fingerprint is initially generated by Compute Engine and changes after every request to modify or update metadata. You must always provide an up-to-date fingerprint hash in order to update or change metadata, otherwise the request will fail with error 412 conditionNotMet. To see the latest fingerprint, make get() request to the firewall policy. * * Generated from protobuf field optional string fingerprint = 234678500; */ - private $fingerprint = null; + protected $fingerprint = null; /** * [Output Only] The unique identifier for the resource. This identifier is defined by the server. * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * [Output only] Type of the resource. Always compute#firewallPolicyfor firewall policies * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * Name of the resource. For Organization Firewall Policies it's a [Output Only] numeric ID allocated by Google Cloud which uniquely identifies the Organization Firewall Policy. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * A list of packet mirroring rules that belong to this policy. * @@ -74,19 +74,19 @@ class FirewallPolicy extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string parent = 78317738; */ - private $parent = null; + protected $parent = null; /** * [Output Only] URL of the region where the regional firewall policy resides. This field is not applicable to global firewall policies. You must specify this field as part of the HTTP request URL. It is not settable as a field in the request body. * * Generated from protobuf field optional string region = 138946292; */ - private $region = null; + protected $region = null; /** * [Output Only] Total count of all firewall policy rule tuples. A firewall policy can not exceed a set number of tuples. * * Generated from protobuf field optional int32 rule_tuple_count = 388342037; */ - private $rule_tuple_count = null; + protected $rule_tuple_count = null; /** * A list of rules that belong to this policy. There must always be a default rule (rule with priority 2147483647 and match "*"). If no rules are provided when creating a firewall policy, a default rule with action "allow" will be added. * @@ -98,19 +98,19 @@ class FirewallPolicy extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Server-defined URL for this resource with the resource id. * * Generated from protobuf field optional string self_link_with_id = 44520962; */ - private $self_link_with_id = null; + protected $self_link_with_id = null; /** * User-provided name of the Organization firewall policy. The name should be unique in the organization in which the firewall policy is created. This field is not applicable to network firewall policies. This name must be set on creation and cannot be changed. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. * * Generated from protobuf field optional string short_name = 492051566; */ - private $short_name = null; + protected $short_name = null; /** * Constructor. diff --git a/Compute/src/V1/FirewallPolicyAssociation.php b/Compute/src/V1/FirewallPolicyAssociation.php index 6154684bbd8d..07d36ff4f38f 100644 --- a/Compute/src/V1/FirewallPolicyAssociation.php +++ b/Compute/src/V1/FirewallPolicyAssociation.php @@ -19,31 +19,31 @@ class FirewallPolicyAssociation extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string attachment_target = 175773741; */ - private $attachment_target = null; + protected $attachment_target = null; /** * [Output Only] Deprecated, please use short name instead. The display name of the firewall policy of the association. * * Generated from protobuf field optional string display_name = 4473832; */ - private $display_name = null; + protected $display_name = null; /** * [Output Only] The firewall policy ID of the association. * * Generated from protobuf field optional string firewall_policy_id = 357211849; */ - private $firewall_policy_id = null; + protected $firewall_policy_id = null; /** * The name for an association. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * [Output Only] The short name of the firewall policy of the association. * * Generated from protobuf field optional string short_name = 492051566; */ - private $short_name = null; + protected $short_name = null; /** * Constructor. diff --git a/Compute/src/V1/FirewallPolicyList.php b/Compute/src/V1/FirewallPolicyList.php index 2742c4e010e9..579406261ac6 100644 --- a/Compute/src/V1/FirewallPolicyList.php +++ b/Compute/src/V1/FirewallPolicyList.php @@ -19,7 +19,7 @@ class FirewallPolicyList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of FirewallPolicy resources. * @@ -31,19 +31,19 @@ class FirewallPolicyList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/FirewallPolicyRule.php b/Compute/src/V1/FirewallPolicyRule.php index 80ba55119cb1..00606248f6ca 100644 --- a/Compute/src/V1/FirewallPolicyRule.php +++ b/Compute/src/V1/FirewallPolicyRule.php @@ -20,68 +20,68 @@ class FirewallPolicyRule extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string action = 187661878; */ - private $action = null; + protected $action = null; /** * An optional description for this resource. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * The direction in which this rule applies. * Check the Direction enum for the list of possible values. * * Generated from protobuf field optional string direction = 111150975; */ - private $direction = null; + protected $direction = null; /** * Denotes whether the firewall policy rule is disabled. When set to true, the firewall policy rule is not enforced and traffic behaves as if it did not exist. If this is unspecified, the firewall policy rule will be enabled. * * Generated from protobuf field optional bool disabled = 270940796; */ - private $disabled = null; + protected $disabled = null; /** * Denotes whether to enable logging for a particular rule. If logging is enabled, logs will be exported to the configured export destination in Stackdriver. Logs may be exported to BigQuery or Pub/Sub. Note: you cannot enable logging on "goto_next" rules. * * Generated from protobuf field optional bool enable_logging = 295396515; */ - private $enable_logging = null; + protected $enable_logging = null; /** * [Output only] Type of the resource. Returns compute#firewallPolicyRule for firewall rules and compute#packetMirroringRule for packet mirroring rules. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * A match condition that incoming traffic is evaluated against. If it evaluates to true, the corresponding 'action' is enforced. * * Generated from protobuf field optional .google.cloud.compute.v1.FirewallPolicyRuleMatcher match = 103668165; */ - private $match = null; + protected $match = null; /** * An integer indicating the priority of a rule in the list. The priority must be a positive value between 0 and 2147483647. Rules are evaluated from highest to lowest priority where 0 is the highest priority and 2147483647 is the lowest priority. * * Generated from protobuf field optional int32 priority = 445151652; */ - private $priority = null; + protected $priority = null; /** * An optional name for the rule. This field is not a unique identifier and can be updated. * * Generated from protobuf field optional string rule_name = 55286254; */ - private $rule_name = null; + protected $rule_name = null; /** * [Output Only] Calculation of the complexity of a single firewall policy rule. * * Generated from protobuf field optional int32 rule_tuple_count = 388342037; */ - private $rule_tuple_count = null; + protected $rule_tuple_count = null; /** * A fully-qualified URL of a SecurityProfile resource instance. Example: https://networksecurity.googleapis.com/v1/projects/{project}/locations/{location}/securityProfileGroups/my-security-profile-group Must be specified if action is one of 'apply_security_profile_group' or 'mirror'. Cannot be specified for other actions. * * Generated from protobuf field optional string security_profile_group = 207411626; */ - private $security_profile_group = null; + protected $security_profile_group = null; /** * A list of network resource URLs to which this rule applies. This field allows you to control which network's VMs get this rule. If this field is left blank, all VMs within the organization will receive the rule. * @@ -105,7 +105,7 @@ class FirewallPolicyRule extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional bool tls_inspect = 43425488; */ - private $tls_inspect = null; + protected $tls_inspect = null; /** * Constructor. diff --git a/Compute/src/V1/FirewallPolicyRuleMatcher.php b/Compute/src/V1/FirewallPolicyRuleMatcher.php index 8aab5011d191..333fc8ae8e01 100644 --- a/Compute/src/V1/FirewallPolicyRuleMatcher.php +++ b/Compute/src/V1/FirewallPolicyRuleMatcher.php @@ -39,7 +39,7 @@ class FirewallPolicyRuleMatcher extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string dest_network_type = 409853224; */ - private $dest_network_type = null; + protected $dest_network_type = null; /** * Region codes whose IP addresses will be used to match for destination of traffic. Should be specified as 2 letter country code defined as per ISO 3166 alpha-2 country codes. ex."US" Maximum number of dest region codes allowed is 5000. * @@ -82,7 +82,7 @@ class FirewallPolicyRuleMatcher extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string src_network_type = 309819686; */ - private $src_network_type = null; + protected $src_network_type = null; /** * Networks of the traffic source. It can be either a full or partial url. * diff --git a/Compute/src/V1/FirewallPolicyRuleMatcherLayer4Config.php b/Compute/src/V1/FirewallPolicyRuleMatcherLayer4Config.php index 9a3d6fe22317..aea21ff42098 100644 --- a/Compute/src/V1/FirewallPolicyRuleMatcherLayer4Config.php +++ b/Compute/src/V1/FirewallPolicyRuleMatcherLayer4Config.php @@ -19,7 +19,7 @@ class FirewallPolicyRuleMatcherLayer4Config extends \Google\Protobuf\Internal\Me * * Generated from protobuf field optional string ip_protocol = 475958960; */ - private $ip_protocol = null; + protected $ip_protocol = null; /** * An optional list of ports to which this rule applies. This field is only applicable for UDP or TCP protocol. Each entry must be either an integer or a range. If not specified, this rule applies to connections through any port. Example inputs include: ["22"], ["80","443"], and ["12345-12349"]. * diff --git a/Compute/src/V1/FirewallPolicyRuleSecureTag.php b/Compute/src/V1/FirewallPolicyRuleSecureTag.php index dacd84aa8d41..38bd61e12736 100644 --- a/Compute/src/V1/FirewallPolicyRuleSecureTag.php +++ b/Compute/src/V1/FirewallPolicyRuleSecureTag.php @@ -19,14 +19,14 @@ class FirewallPolicyRuleSecureTag extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * [Output Only] State of the secure tag, either `EFFECTIVE` or `INEFFECTIVE`. A secure tag is `INEFFECTIVE` when it is deleted or its network is deleted. * Check the State enum for the list of possible values. * * Generated from protobuf field optional string state = 109757585; */ - private $state = null; + protected $state = null; /** * Constructor. diff --git a/Compute/src/V1/FirewallsClient.php b/Compute/src/V1/FirewallsClient.php deleted file mode 100644 index 869813e6364f..000000000000 --- a/Compute/src/V1/FirewallsClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional int32 calculated = 472082878; */ - private $calculated = null; + protected $calculated = null; /** * Specifies a fixed number of VM instances. This must be a positive integer. * * Generated from protobuf field optional int32 fixed = 97445748; */ - private $fixed = null; + protected $fixed = null; /** * Specifies a percentage of instances between 0 to 100%, inclusive. For example, specify 80 for 80%. * * Generated from protobuf field optional int32 percent = 394814533; */ - private $percent = null; + protected $percent = null; /** * Constructor. diff --git a/Compute/src/V1/ForwardingRule.php b/Compute/src/V1/ForwardingRule.php index 7821f3425f3a..5b46dbb9550f 100644 --- a/Compute/src/V1/ForwardingRule.php +++ b/Compute/src/V1/ForwardingRule.php @@ -20,112 +20,112 @@ class ForwardingRule extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string I_p_address = 42976943; */ - private $I_p_address = null; + protected $I_p_address = null; /** * The IP protocol to which this rule applies. For protocol forwarding, valid options are TCP, UDP, ESP, AH, SCTP, ICMP and L3_DEFAULT. The valid IP protocols are different for different load balancing products as described in [Load balancing features](https://cloud.google.com/load-balancing/docs/features#protocols_from_the_load_balancer_to_the_backends). * Check the IPProtocolEnum enum for the list of possible values. * * Generated from protobuf field optional string I_p_protocol = 488094525; */ - private $I_p_protocol = null; + protected $I_p_protocol = null; /** * The ports, portRange, and allPorts fields are mutually exclusive. Only packets addressed to ports in the specified range will be forwarded to the backends configured with this forwarding rule. The allPorts field has the following limitations: - It requires that the forwarding rule IPProtocol be TCP, UDP, SCTP, or L3_DEFAULT. - It's applicable only to the following products: internal passthrough Network Load Balancers, backend service-based external passthrough Network Load Balancers, and internal and external protocol forwarding. - Set this field to true to allow packets addressed to any port or packets lacking destination port information (for example, UDP fragments after the first fragment) to be forwarded to the backends configured with this forwarding rule. The L3_DEFAULT protocol requires allPorts be set to true. * * Generated from protobuf field optional bool all_ports = 445175796; */ - private $all_ports = null; + protected $all_ports = null; /** * If set to true, clients can access the internal passthrough Network Load Balancers, the regional internal Application Load Balancer, and the regional internal proxy Network Load Balancer from all regions. If false, only allows access from the local region the load balancer is located at. Note that for INTERNAL_MANAGED forwarding rules, this field cannot be changed after the forwarding rule is created. * * Generated from protobuf field optional bool allow_global_access = 499409674; */ - private $allow_global_access = null; + protected $allow_global_access = null; /** * This is used in PSC consumer ForwardingRule to control whether the PSC endpoint can be accessed from another region. * * Generated from protobuf field optional bool allow_psc_global_access = 263471819; */ - private $allow_psc_global_access = null; + protected $allow_psc_global_access = null; /** * Identifies the backend service to which the forwarding rule sends traffic. Required for internal and external passthrough Network Load Balancers; must be omitted for all other load balancer types. * * Generated from protobuf field optional string backend_service = 306946058; */ - private $backend_service = null; + protected $backend_service = null; /** * [Output Only] The URL for the corresponding base forwarding rule. By base forwarding rule, we mean the forwarding rule that has the same IP address, protocol, and port settings with the current forwarding rule, but without sourceIPRanges specified. Always empty if the current forwarding rule does not have sourceIPRanges specified. * * Generated from protobuf field optional string base_forwarding_rule = 524873104; */ - private $base_forwarding_rule = null; + protected $base_forwarding_rule = null; /** * [Output Only] Creation timestamp in RFC3339 text format. * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * An optional description of this resource. Provide this property when you create the resource. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * Specifies the canary migration state for the backend buckets attached to this forwarding rule. Possible values are PREPARE, TEST_BY_PERCENTAGE, and TEST_ALL_TRAFFIC. To begin the migration from EXTERNAL to EXTERNAL_MANAGED, the state must be changed to PREPARE. The state must be changed to TEST_ALL_TRAFFIC before the loadBalancingScheme can be changed to EXTERNAL_MANAGED. Optionally, the TEST_BY_PERCENTAGE state can be used to migrate traffic to backend buckets attached to this forwarding rule by percentage using externalManagedBackendBucketMigrationTestingPercentage. Rolling back a migration requires the states to be set in reverse order. So changing the scheme from EXTERNAL_MANAGED to EXTERNAL requires the state to be set to TEST_ALL_TRAFFIC at the same time. Optionally, the TEST_BY_PERCENTAGE state can be used to migrate some traffic back to EXTERNAL or PREPARE can be used to migrate all traffic back to EXTERNAL. * Check the ExternalManagedBackendBucketMigrationState enum for the list of possible values. * * Generated from protobuf field optional string external_managed_backend_bucket_migration_state = 107811370; */ - private $external_managed_backend_bucket_migration_state = null; + protected $external_managed_backend_bucket_migration_state = null; /** * Determines the fraction of requests to backend buckets that should be processed by the global external Application Load Balancer. The value of this field must be in the range [0, 100]. This value can only be set if the loadBalancingScheme in the BackendService is set to EXTERNAL (when using the classic Application Load Balancer) and the migration state is TEST_BY_PERCENTAGE. * * Generated from protobuf field optional float external_managed_backend_bucket_migration_testing_percentage = 105676592; */ - private $external_managed_backend_bucket_migration_testing_percentage = null; + protected $external_managed_backend_bucket_migration_testing_percentage = null; /** * Fingerprint of this resource. A hash of the contents stored in this object. This field is used in optimistic locking. This field will be ignored when inserting a ForwardingRule. Include the fingerprint in patch request to ensure that you do not overwrite changes that were applied from another concurrent request. To see the latest fingerprint, make a get() request to retrieve a ForwardingRule. * * Generated from protobuf field optional string fingerprint = 234678500; */ - private $fingerprint = null; + protected $fingerprint = null; /** * [Output Only] The unique identifier for the resource. This identifier is defined by the server. * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * Resource reference of a PublicDelegatedPrefix. The PDP must be a sub-PDP in EXTERNAL_IPV6_FORWARDING_RULE_CREATION mode. Use one of the following formats to specify a sub-PDP when creating an IPv6 NetLB forwarding rule using BYOIP: Full resource URL, as in https://www.googleapis.com/compute/v1/projects/project_id/regions/region /publicDelegatedPrefixes/sub-pdp-name Partial URL, as in: - projects/project_id/regions/region/publicDelegatedPrefixes/sub-pdp-name - regions/region/publicDelegatedPrefixes/sub-pdp-name * * Generated from protobuf field optional string ip_collection = 176818358; */ - private $ip_collection = null; + protected $ip_collection = null; /** * The IP Version that will be used by this forwarding rule. Valid options are IPV4 or IPV6. * Check the IpVersion enum for the list of possible values. * * Generated from protobuf field optional string ip_version = 294959552; */ - private $ip_version = null; + protected $ip_version = null; /** * Indicates whether or not this load balancer can be used as a collector for packet mirroring. To prevent mirroring loops, instances behind this load balancer will not have their traffic mirrored even if a PacketMirroring rule applies to them. This can only be set to true for load balancers that have their loadBalancingScheme set to INTERNAL. * * Generated from protobuf field optional bool is_mirroring_collector = 119255164; */ - private $is_mirroring_collector = null; + protected $is_mirroring_collector = null; /** * [Output Only] Type of the resource. Always compute#forwardingRule for forwarding rule resources. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * A fingerprint for the labels being applied to this resource, which is essentially a hash of the labels set used for optimistic locking. The fingerprint is initially generated by Compute Engine and changes after every request to modify or update labels. You must always provide an up-to-date fingerprint hash in order to update or change labels, otherwise the request will fail with error 412 conditionNotMet. To see the latest fingerprint, make a get() request to retrieve a ForwardingRule. * * Generated from protobuf field optional string label_fingerprint = 178124825; */ - private $label_fingerprint = null; + protected $label_fingerprint = null; /** * Labels for this resource. These can only be added or modified by the setLabels method. Each label key/value pair must comply with RFC1035. Label values may be empty. * @@ -138,7 +138,7 @@ class ForwardingRule extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string load_balancing_scheme = 363890244; */ - private $load_balancing_scheme = null; + protected $load_balancing_scheme = null; /** * Opaque filter criteria used by load balancer to restrict routing configuration to a limited set of xDS compliant clients. In their xDS requests to load balancer, xDS clients present node metadata. When there is a match, the relevant configuration is made available to those proxies. Otherwise, all the resources (e.g. TargetHttpProxy, UrlMap) referenced by the ForwardingRule are not visible to those proxies. For each metadataFilter in this list, if its filterMatchCriteria is set to MATCH_ANY, at least one of the filterLabels must match the corresponding label provided in the metadata. If its filterMatchCriteria is set to MATCH_ALL, then all of its filterLabels must match with corresponding labels provided in the metadata. If multiple metadataFilters are specified, all of them need to be satisfied in order to be considered a match. metadataFilters specified here will be applifed before those specified in the UrlMap that this ForwardingRule references. metadataFilters only applies to Loadbalancers that have their loadBalancingScheme set to INTERNAL_SELF_MANAGED. * @@ -150,32 +150,32 @@ class ForwardingRule extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * This field is not used for global external load balancing. For internal passthrough Network Load Balancers, this field identifies the network that the load balanced IP should belong to for this forwarding rule. If the subnetwork is specified, the network of the subnetwork will be used. If neither subnetwork nor this field is specified, the default network will be used. For Private Service Connect forwarding rules that forward traffic to Google APIs, a network must be provided. * * Generated from protobuf field optional string network = 232872494; */ - private $network = null; + protected $network = null; /** * This signifies the networking tier used for configuring this load balancer and can only take the following values: PREMIUM, STANDARD. For regional ForwardingRule, the valid values are PREMIUM and STANDARD. For GlobalForwardingRule, the valid value is PREMIUM. If this field is not specified, it is assumed to be PREMIUM. If IPAddress is specified, this value must be equal to the networkTier of the Address. * Check the NetworkTier enum for the list of possible values. * * Generated from protobuf field optional string network_tier = 517397843; */ - private $network_tier = null; + protected $network_tier = null; /** * This is used in PSC consumer ForwardingRule to control whether it should try to auto-generate a DNS zone or not. Non-PSC forwarding rules do not use this field. Once set, this field is not mutable. * * Generated from protobuf field optional bool no_automate_dns_zone = 64546991; */ - private $no_automate_dns_zone = null; + protected $no_automate_dns_zone = null; /** * The ports, portRange, and allPorts fields are mutually exclusive. Only packets addressed to ports in the specified range will be forwarded to the backends configured with this forwarding rule. The portRange field has the following limitations: - It requires that the forwarding rule IPProtocol be TCP, UDP, or SCTP, and - It's applicable only to the following products: external passthrough Network Load Balancers, internal and external proxy Network Load Balancers, internal and external Application Load Balancers, external protocol forwarding, and Classic VPN. - Some products have restrictions on what ports can be used. See port specifications for details. For external forwarding rules, two or more forwarding rules cannot use the same [IPAddress, IPProtocol] pair, and cannot have overlapping portRanges. For internal forwarding rules within the same VPC network, two or more forwarding rules cannot use the same [IPAddress, IPProtocol] pair, and cannot have overlapping portRanges. @pattern: \\d+(?:-\\d+)? * * Generated from protobuf field optional string port_range = 217518079; */ - private $port_range = null; + protected $port_range = null; /** * The ports, portRange, and allPorts fields are mutually exclusive. Only packets addressed to ports in the specified range will be forwarded to the backends configured with this forwarding rule. The ports field has the following limitations: - It requires that the forwarding rule IPProtocol be TCP, UDP, or SCTP, and - It's applicable only to the following products: internal passthrough Network Load Balancers, backend service-based external passthrough Network Load Balancers, and internal protocol forwarding. - You can specify a list of up to five ports by number, separated by commas. The ports can be contiguous or discontiguous. For external forwarding rules, two or more forwarding rules cannot use the same [IPAddress, IPProtocol] pair if they share at least one port number. For internal forwarding rules within the same VPC network, two or more forwarding rules cannot use the same [IPAddress, IPProtocol] pair if they share at least one port number. @pattern: \\d+(?:-\\d+)? * @@ -187,32 +187,32 @@ class ForwardingRule extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional uint64 psc_connection_id = 292082397; */ - private $psc_connection_id = null; + protected $psc_connection_id = null; /** * * Check the PscConnectionStatus enum for the list of possible values. * * Generated from protobuf field optional string psc_connection_status = 184149172; */ - private $psc_connection_status = null; + protected $psc_connection_status = null; /** * [Output Only] URL of the region where the regional forwarding rule resides. This field is not applicable to global forwarding rules. You must specify this field as part of the HTTP request URL. It is not settable as a field in the request body. * * Generated from protobuf field optional string region = 138946292; */ - private $region = null; + protected $region = null; /** * [Output Only] Server-defined URL for the resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Server-defined URL for this resource with the resource id. * * Generated from protobuf field optional string self_link_with_id = 44520962; */ - private $self_link_with_id = null; + protected $self_link_with_id = null; /** * Service Directory resources to register this forwarding rule with. Currently, only supports a single Service Directory resource. * @@ -224,13 +224,13 @@ class ForwardingRule extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string service_label = 417008874; */ - private $service_label = null; + protected $service_label = null; /** * [Output Only] The internal fully qualified service name for this forwarding rule. This field is only used for internal load balancing. * * Generated from protobuf field optional string service_name = 359880149; */ - private $service_name = null; + protected $service_name = null; /** * If not empty, this forwarding rule will only forward the traffic when the source IP address matches one of the IP addresses or CIDR ranges set here. Note that a forwarding rule can only have up to 64 source IP ranges, and this field can only be used with a regional forwarding rule whose scheme is EXTERNAL. Each source_ip_range entry should be either an IP address (for example, 1.2.3.4) or a CIDR range (for example, 1.2.3.0/24). * @@ -242,13 +242,13 @@ class ForwardingRule extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string subnetwork = 307827694; */ - private $subnetwork = null; + protected $subnetwork = null; /** * The URL of the target resource to receive the matched traffic. For regional forwarding rules, this target must be in the same region as the forwarding rule. For global forwarding rules, this target must be a global load balancing resource. The forwarded traffic must be of a type appropriate to the target object. - For load balancers, see the "Target" column in [Port specifications](https://cloud.google.com/load-balancing/docs/forwarding-rule-concepts#ip_address_specifications). - For Private Service Connect forwarding rules that forward traffic to Google APIs, provide the name of a supported Google API bundle: - vpc-sc - APIs that support VPC Service Controls. - all-apis - All supported Google APIs. - For Private Service Connect forwarding rules that forward traffic to managed services, the target must be a service attachment. The target is not mutable once set as a service attachment. * * Generated from protobuf field optional string target = 192835985; */ - private $target = null; + protected $target = null; /** * Constructor. diff --git a/Compute/src/V1/ForwardingRule/IPProtocol.php b/Compute/src/V1/ForwardingRule/IPProtocol.php deleted file mode 100644 index 77d7b50ad283..000000000000 --- a/Compute/src/V1/ForwardingRule/IPProtocol.php +++ /dev/null @@ -1,85 +0,0 @@ -google.cloud.compute.v1.ForwardingRule.IPProtocol - */ -class IPProtocol -{ - /** - * A value indicating that the enum field is not set. - * - * Generated from protobuf enum UNDEFINED_I_P_PROTOCOL = 0; - */ - const UNDEFINED_I_P_PROTOCOL = 0; - /** - * Generated from protobuf enum AH = 2087; - */ - const AH = 2087; - /** - * Generated from protobuf enum ESP = 68962; - */ - const ESP = 68962; - /** - * Generated from protobuf enum ICMP = 2241597; - */ - const ICMP = 2241597; - /** - * Generated from protobuf enum SCTP = 2539724; - */ - const SCTP = 2539724; - /** - * Generated from protobuf enum TCP = 82881; - */ - const TCP = 82881; - /** - * Generated from protobuf enum UDP = 83873; - */ - const UDP = 83873; - - private static $valueToName = [ - self::UNDEFINED_I_P_PROTOCOL => 'UNDEFINED_I_P_PROTOCOL', - self::AH => 'AH', - self::ESP => 'ESP', - self::ICMP => 'ICMP', - self::SCTP => 'SCTP', - self::TCP => 'TCP', - self::UDP => 'UDP', - ]; - - 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/Compute/src/V1/ForwardingRuleAggregatedList.php b/Compute/src/V1/ForwardingRuleAggregatedList.php index c511be81ecf2..1e3b38d3fc38 100644 --- a/Compute/src/V1/ForwardingRuleAggregatedList.php +++ b/Compute/src/V1/ForwardingRuleAggregatedList.php @@ -19,7 +19,7 @@ class ForwardingRuleAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of ForwardingRulesScopedList resources. * @@ -31,19 +31,19 @@ class ForwardingRuleAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Unreachable resources. * @@ -55,7 +55,7 @@ class ForwardingRuleAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/ForwardingRuleList.php b/Compute/src/V1/ForwardingRuleList.php index 9ee0d4eb37b1..3ea2c35af9f1 100644 --- a/Compute/src/V1/ForwardingRuleList.php +++ b/Compute/src/V1/ForwardingRuleList.php @@ -20,7 +20,7 @@ class ForwardingRuleList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of ForwardingRule resources. * @@ -32,25 +32,25 @@ class ForwardingRuleList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/ForwardingRuleReference.php b/Compute/src/V1/ForwardingRuleReference.php index 9778de0763ea..dc12ac824832 100644 --- a/Compute/src/V1/ForwardingRuleReference.php +++ b/Compute/src/V1/ForwardingRuleReference.php @@ -17,7 +17,7 @@ class ForwardingRuleReference extends \Google\Protobuf\Internal\Message /** * Generated from protobuf field optional string forwarding_rule = 269964030; */ - private $forwarding_rule = null; + protected $forwarding_rule = null; /** * Constructor. diff --git a/Compute/src/V1/ForwardingRuleServiceDirectoryRegistration.php b/Compute/src/V1/ForwardingRuleServiceDirectoryRegistration.php index 295ce035b63d..ea22e86911a0 100644 --- a/Compute/src/V1/ForwardingRuleServiceDirectoryRegistration.php +++ b/Compute/src/V1/ForwardingRuleServiceDirectoryRegistration.php @@ -20,19 +20,19 @@ class ForwardingRuleServiceDirectoryRegistration extends \Google\Protobuf\Intern * * Generated from protobuf field optional string namespace = 178476379; */ - private $namespace = null; + protected $namespace = null; /** * Service Directory service to register the forwarding rule under. * * Generated from protobuf field optional string service = 373540533; */ - private $service = null; + protected $service = null; /** * [Optional] Service Directory region to register this global forwarding rule under. Default to "us-central1". Only used for PSC for Google APIs. All PSC for Google APIs forwarding rules on the same network should use the same Service Directory region. * * Generated from protobuf field optional string service_directory_region = 74030416; */ - private $service_directory_region = null; + protected $service_directory_region = null; /** * Constructor. diff --git a/Compute/src/V1/ForwardingRulesClient.php b/Compute/src/V1/ForwardingRulesClient.php deleted file mode 100644 index 7bd882f8d828..000000000000 --- a/Compute/src/V1/ForwardingRulesClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/GRPCHealthCheck.php b/Compute/src/V1/GRPCHealthCheck.php index a13f12d4de41..6ede0d816ac3 100644 --- a/Compute/src/V1/GRPCHealthCheck.php +++ b/Compute/src/V1/GRPCHealthCheck.php @@ -19,26 +19,26 @@ class GRPCHealthCheck extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string grpc_service_name = 136533078; */ - private $grpc_service_name = null; + protected $grpc_service_name = null; /** * The TCP port number to which the health check prober sends packets. Valid values are 1 through 65535. * * Generated from protobuf field optional int32 port = 3446913; */ - private $port = null; + protected $port = null; /** * Not supported. * * Generated from protobuf field optional string port_name = 41534345; */ - private $port_name = null; + protected $port_name = null; /** * Specifies how a port is selected for health checking. Can be one of the following values: USE_FIXED_PORT: Specifies a port number explicitly using the port field in the health check. Supported by backend services for passthrough load balancers and backend services for proxy load balancers. Not supported by target pools. The health check supports all backends supported by the backend service provided the backend can be health checked. For example, GCE_VM_IP network endpoint groups, GCE_VM_IP_PORT network endpoint groups, and instance group backends. USE_NAMED_PORT: Not supported. USE_SERVING_PORT: Provides an indirect method of specifying the health check port by referring to the backend service. Only supported by backend services for proxy load balancers. Not supported by target pools. Not supported by backend services for passthrough load balancers. Supports all backends that can be health checked; for example, GCE_VM_IP_PORT network endpoint groups and instance group backends. For GCE_VM_IP_PORT network endpoint group backends, the health check uses the port number specified for each endpoint in the network endpoint group. For instance group backends, the health check uses the port number determined by looking up the backend service's named port in the instance group's list of named ports. * Check the PortSpecification enum for the list of possible values. * * Generated from protobuf field optional string port_specification = 51590597; */ - private $port_specification = null; + protected $port_specification = null; /** * Constructor. diff --git a/Compute/src/V1/Gapic/AcceleratorTypesGapicClient.php b/Compute/src/V1/Gapic/AcceleratorTypesGapicClient.php deleted file mode 100644 index f70f0c7b7dec..000000000000 --- a/Compute/src/V1/Gapic/AcceleratorTypesGapicClient.php +++ /dev/null @@ -1,425 +0,0 @@ -aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $acceleratorTypesClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $acceleratorTypesClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\AcceleratorTypesClient}. - */ -class AcceleratorTypesGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.AcceleratorTypes'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute.readonly', - 'https://www.googleapis.com/auth/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/accelerator_types_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/accelerator_types_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/accelerator_types_rest_client_config.php', - ], - ], - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * 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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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); - } - - /** - * Retrieves an aggregated list of accelerator types. To prevent failure, Google recommends that you set the `returnPartialSuccess` parameter to `true`. - * - * Sample code: - * ``` - * $acceleratorTypesClient = new AcceleratorTypesClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $acceleratorTypesClient->aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $acceleratorTypesClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $acceleratorTypesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type bool $includeAllScopes - * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type int $serviceProjectNumber - * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable 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 aggregatedList($project, array $optionalArgs = []) - { - $request = new AggregatedListAcceleratorTypesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['includeAllScopes'])) { - $request->setIncludeAllScopes($optionalArgs['includeAllScopes']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - if (isset($optionalArgs['serviceProjectNumber'])) { - $request->setServiceProjectNumber($optionalArgs['serviceProjectNumber']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('AggregatedList', $optionalArgs, AcceleratorTypeAggregatedList::class, $request); - } - - /** - * Returns the specified accelerator type. - * - * Sample code: - * ``` - * $acceleratorTypesClient = new AcceleratorTypesClient(); - * try { - * $acceleratorType = 'accelerator_type'; - * $project = 'project'; - * $zone = 'zone'; - * $response = $acceleratorTypesClient->get($acceleratorType, $project, $zone); - * } finally { - * $acceleratorTypesClient->close(); - * } - * ``` - * - * @param string $acceleratorType Name of the accelerator type to return. - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\AcceleratorType - * - * @throws ApiException if the remote call fails - */ - public function get($acceleratorType, $project, $zone, array $optionalArgs = []) - { - $request = new GetAcceleratorTypeRequest(); - $requestParamHeaders = []; - $request->setAcceleratorType($acceleratorType); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['accelerator_type'] = $acceleratorType; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', AcceleratorType::class, $optionalArgs, $request)->wait(); - } - - /** - * Retrieves a list of accelerator types that are available to the specified project. - * - * Sample code: - * ``` - * $acceleratorTypesClient = new AcceleratorTypesClient(); - * try { - * $project = 'project'; - * $zone = 'zone'; - * // Iterate over pages of elements - * $pagedResponse = $acceleratorTypesClient->list($project, $zone); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $acceleratorTypesClient->list($project, $zone); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $acceleratorTypesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, $zone, array $optionalArgs = []) - { - $request = new ListAcceleratorTypesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, AcceleratorTypeList::class, $request); - } -} diff --git a/Compute/src/V1/Gapic/AddressesGapicClient.php b/Compute/src/V1/Gapic/AddressesGapicClient.php deleted file mode 100644 index a023f8eb24e2..000000000000 --- a/Compute/src/V1/Gapic/AddressesGapicClient.php +++ /dev/null @@ -1,794 +0,0 @@ -aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $addressesClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $addressesClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\AddressesClient}. - */ -class AddressesGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.Addresses'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/addresses_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/addresses_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/addresses_rest_client_config.php', - ], - ], - 'operationsClientClass' => RegionOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an RegionOperationsClient object with the same endpoint as $this. - * - * @return RegionOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetRegionOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteRegionOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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); - } - - /** - * Retrieves an aggregated list of addresses. To prevent failure, Google recommends that you set the `returnPartialSuccess` parameter to `true`. - * - * Sample code: - * ``` - * $addressesClient = new AddressesClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $addressesClient->aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $addressesClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $addressesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type bool $includeAllScopes - * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type int $serviceProjectNumber - * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable 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 aggregatedList($project, array $optionalArgs = []) - { - $request = new AggregatedListAddressesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['includeAllScopes'])) { - $request->setIncludeAllScopes($optionalArgs['includeAllScopes']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - if (isset($optionalArgs['serviceProjectNumber'])) { - $request->setServiceProjectNumber($optionalArgs['serviceProjectNumber']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('AggregatedList', $optionalArgs, AddressAggregatedList::class, $request); - } - - /** - * Deletes the specified address resource. - * - * Sample code: - * ``` - * $addressesClient = new AddressesClient(); - * try { - * $address = 'address'; - * $project = 'project'; - * $region = 'region'; - * $operationResponse = $addressesClient->delete($address, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $addressesClient->delete($address, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $addressesClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $addressesClient->close(); - * } - * ``` - * - * @param string $address Name of the address resource to delete. - * @param string $project Project ID for this request. - * @param string $region Name of the region for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($address, $project, $region, array $optionalArgs = []) - { - $request = new DeleteAddressRequest(); - $requestParamHeaders = []; - $request->setAddress($address); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['address'] = $address; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns the specified address resource. - * - * Sample code: - * ``` - * $addressesClient = new AddressesClient(); - * try { - * $address = 'address'; - * $project = 'project'; - * $region = 'region'; - * $response = $addressesClient->get($address, $project, $region); - * } finally { - * $addressesClient->close(); - * } - * ``` - * - * @param string $address Name of the address resource to return. - * @param string $project Project ID for this request. - * @param string $region Name of the region for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Address - * - * @throws ApiException if the remote call fails - */ - public function get($address, $project, $region, array $optionalArgs = []) - { - $request = new GetAddressRequest(); - $requestParamHeaders = []; - $request->setAddress($address); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['address'] = $address; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', Address::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates an address resource in the specified project by using the data included in the request. - * - * Sample code: - * ``` - * $addressesClient = new AddressesClient(); - * try { - * $addressResource = new Address(); - * $project = 'project'; - * $region = 'region'; - * $operationResponse = $addressesClient->insert($addressResource, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $addressesClient->insert($addressResource, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $addressesClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $addressesClient->close(); - * } - * ``` - * - * @param Address $addressResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $region Name of the region for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 insert($addressResource, $project, $region, array $optionalArgs = []) - { - $request = new InsertAddressRequest(); - $requestParamHeaders = []; - $request->setAddressResource($addressResource); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Retrieves a list of addresses contained within the specified region. - * - * Sample code: - * ``` - * $addressesClient = new AddressesClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * // Iterate over pages of elements - * $pagedResponse = $addressesClient->list($project, $region); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $addressesClient->list($project, $region); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $addressesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, $region, array $optionalArgs = []) - { - $request = new ListAddressesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, AddressList::class, $request); - } - - /** - * Moves the specified address resource. - * - * Sample code: - * ``` - * $addressesClient = new AddressesClient(); - * try { - * $address = 'address'; - * $project = 'project'; - * $region = 'region'; - * $regionAddressesMoveRequestResource = new RegionAddressesMoveRequest(); - * $operationResponse = $addressesClient->move($address, $project, $region, $regionAddressesMoveRequestResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $addressesClient->move($address, $project, $region, $regionAddressesMoveRequestResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $addressesClient->resumeOperation($operationName, 'move'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $addressesClient->close(); - * } - * ``` - * - * @param string $address Name of the address resource to move. - * @param string $project Source project ID which the Address is moved from. - * @param string $region Name of the region for this request. - * @param RegionAddressesMoveRequest $regionAddressesMoveRequestResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 move($address, $project, $region, $regionAddressesMoveRequestResource, array $optionalArgs = []) - { - $request = new MoveAddressRequest(); - $requestParamHeaders = []; - $request->setAddress($address); - $request->setProject($project); - $request->setRegion($region); - $request->setRegionAddressesMoveRequestResource($regionAddressesMoveRequestResource); - $requestParamHeaders['address'] = $address; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('Move', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Sets the labels on an Address. To learn more about labels, read the Labeling Resources documentation. - * - * Sample code: - * ``` - * $addressesClient = new AddressesClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $regionSetLabelsRequestResource = new RegionSetLabelsRequest(); - * $resource = 'resource'; - * $operationResponse = $addressesClient->setLabels($project, $region, $regionSetLabelsRequestResource, $resource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $addressesClient->setLabels($project, $region, $regionSetLabelsRequestResource, $resource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $addressesClient->resumeOperation($operationName, 'setLabels'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $addressesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region The region for this request. - * @param RegionSetLabelsRequest $regionSetLabelsRequestResource The body resource for this request - * @param string $resource Name or id of the resource for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 setLabels($project, $region, $regionSetLabelsRequestResource, $resource, array $optionalArgs = []) - { - $request = new SetLabelsAddressRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setRegionSetLabelsRequestResource($regionSetLabelsRequestResource); - $request->setResource($resource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['resource'] = $resource; - 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('SetLabels', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/AutoscalersGapicClient.php b/Compute/src/V1/Gapic/AutoscalersGapicClient.php deleted file mode 100644 index 0ed125649ae5..000000000000 --- a/Compute/src/V1/Gapic/AutoscalersGapicClient.php +++ /dev/null @@ -1,796 +0,0 @@ -aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $autoscalersClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $autoscalersClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\AutoscalersClient}. - */ -class AutoscalersGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.Autoscalers'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/autoscalers_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/autoscalers_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/autoscalers_rest_client_config.php', - ], - ], - 'operationsClientClass' => ZoneOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an ZoneOperationsClient object with the same endpoint as $this. - * - * @return ZoneOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getZone', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetZoneOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteZoneOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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); - } - - /** - * Retrieves an aggregated list of autoscalers. To prevent failure, Google recommends that you set the `returnPartialSuccess` parameter to `true`. - * - * Sample code: - * ``` - * $autoscalersClient = new AutoscalersClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $autoscalersClient->aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $autoscalersClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $autoscalersClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type bool $includeAllScopes - * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type int $serviceProjectNumber - * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable 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 aggregatedList($project, array $optionalArgs = []) - { - $request = new AggregatedListAutoscalersRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['includeAllScopes'])) { - $request->setIncludeAllScopes($optionalArgs['includeAllScopes']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - if (isset($optionalArgs['serviceProjectNumber'])) { - $request->setServiceProjectNumber($optionalArgs['serviceProjectNumber']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('AggregatedList', $optionalArgs, AutoscalerAggregatedList::class, $request); - } - - /** - * Deletes the specified autoscaler. - * - * Sample code: - * ``` - * $autoscalersClient = new AutoscalersClient(); - * try { - * $autoscaler = 'autoscaler'; - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $autoscalersClient->delete($autoscaler, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $autoscalersClient->delete($autoscaler, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $autoscalersClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $autoscalersClient->close(); - * } - * ``` - * - * @param string $autoscaler Name of the autoscaler to delete. - * @param string $project Project ID for this request. - * @param string $zone Name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($autoscaler, $project, $zone, array $optionalArgs = []) - { - $request = new DeleteAutoscalerRequest(); - $requestParamHeaders = []; - $request->setAutoscaler($autoscaler); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['autoscaler'] = $autoscaler; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns the specified autoscaler resource. - * - * Sample code: - * ``` - * $autoscalersClient = new AutoscalersClient(); - * try { - * $autoscaler = 'autoscaler'; - * $project = 'project'; - * $zone = 'zone'; - * $response = $autoscalersClient->get($autoscaler, $project, $zone); - * } finally { - * $autoscalersClient->close(); - * } - * ``` - * - * @param string $autoscaler Name of the autoscaler to return. - * @param string $project Project ID for this request. - * @param string $zone Name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Autoscaler - * - * @throws ApiException if the remote call fails - */ - public function get($autoscaler, $project, $zone, array $optionalArgs = []) - { - $request = new GetAutoscalerRequest(); - $requestParamHeaders = []; - $request->setAutoscaler($autoscaler); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['autoscaler'] = $autoscaler; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', Autoscaler::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates an autoscaler in the specified project using the data included in the request. - * - * Sample code: - * ``` - * $autoscalersClient = new AutoscalersClient(); - * try { - * $autoscalerResource = new Autoscaler(); - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $autoscalersClient->insert($autoscalerResource, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $autoscalersClient->insert($autoscalerResource, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $autoscalersClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $autoscalersClient->close(); - * } - * ``` - * - * @param Autoscaler $autoscalerResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $zone Name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 insert($autoscalerResource, $project, $zone, array $optionalArgs = []) - { - $request = new InsertAutoscalerRequest(); - $requestParamHeaders = []; - $request->setAutoscalerResource($autoscalerResource); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Retrieves a list of autoscalers contained within the specified zone. - * - * Sample code: - * ``` - * $autoscalersClient = new AutoscalersClient(); - * try { - * $project = 'project'; - * $zone = 'zone'; - * // Iterate over pages of elements - * $pagedResponse = $autoscalersClient->list($project, $zone); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $autoscalersClient->list($project, $zone); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $autoscalersClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $zone Name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, $zone, array $optionalArgs = []) - { - $request = new ListAutoscalersRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, AutoscalerList::class, $request); - } - - /** - * Updates an autoscaler in the specified project using the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. - * - * Sample code: - * ``` - * $autoscalersClient = new AutoscalersClient(); - * try { - * $autoscalerResource = new Autoscaler(); - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $autoscalersClient->patch($autoscalerResource, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $autoscalersClient->patch($autoscalerResource, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $autoscalersClient->resumeOperation($operationName, 'patch'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $autoscalersClient->close(); - * } - * ``` - * - * @param Autoscaler $autoscalerResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $zone Name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $autoscaler - * Name of the autoscaler to patch. - * @type string $requestId - * 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. 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 patch($autoscalerResource, $project, $zone, array $optionalArgs = []) - { - $request = new PatchAutoscalerRequest(); - $requestParamHeaders = []; - $request->setAutoscalerResource($autoscalerResource); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - if (isset($optionalArgs['autoscaler'])) { - $request->setAutoscaler($optionalArgs['autoscaler']); - } - - 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('Patch', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Updates an autoscaler in the specified project using the data included in the request. - * - * Sample code: - * ``` - * $autoscalersClient = new AutoscalersClient(); - * try { - * $autoscalerResource = new Autoscaler(); - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $autoscalersClient->update($autoscalerResource, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $autoscalersClient->update($autoscalerResource, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $autoscalersClient->resumeOperation($operationName, 'update'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $autoscalersClient->close(); - * } - * ``` - * - * @param Autoscaler $autoscalerResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $zone Name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $autoscaler - * Name of the autoscaler to update. - * @type string $requestId - * 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. 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 update($autoscalerResource, $project, $zone, array $optionalArgs = []) - { - $request = new UpdateAutoscalerRequest(); - $requestParamHeaders = []; - $request->setAutoscalerResource($autoscalerResource); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - if (isset($optionalArgs['autoscaler'])) { - $request->setAutoscaler($optionalArgs['autoscaler']); - } - - 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('Update', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/BackendBucketsGapicClient.php b/Compute/src/V1/Gapic/BackendBucketsGapicClient.php deleted file mode 100644 index da6197c3d896..000000000000 --- a/Compute/src/V1/Gapic/BackendBucketsGapicClient.php +++ /dev/null @@ -1,1060 +0,0 @@ -addSignedUrlKey($backendBucket, $project, $signedUrlKeyResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $backendBucketsClient->addSignedUrlKey($backendBucket, $project, $signedUrlKeyResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $backendBucketsClient->resumeOperation($operationName, 'addSignedUrlKey'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $backendBucketsClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\BackendBucketsClient}. - */ -class BackendBucketsGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.BackendBuckets'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/backend_buckets_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/backend_buckets_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/backend_buckets_rest_client_config.php', - ], - ], - 'operationsClientClass' => GlobalOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an GlobalOperationsClient object with the same endpoint as $this. - * - * @return GlobalOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetGlobalOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteGlobalOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method for the - * supported options. - * @type callable $clientCertSource - * A callable which returns the client cert as a string. This can be used to - * provide a certificate and private key to the transport layer for mTLS. - * } - * - * @throws ValidationException - */ - public function __construct(array $options = []) - { - $clientOptions = $this->buildClientOptions($options); - $this->setClientOptions($clientOptions); - $this->operationsClient = $this->createOperationsClient($clientOptions); - } - - /** - * Adds a key for validating requests with signed URLs for this backend bucket. - * - * Sample code: - * ``` - * $backendBucketsClient = new BackendBucketsClient(); - * try { - * $backendBucket = 'backend_bucket'; - * $project = 'project'; - * $signedUrlKeyResource = new SignedUrlKey(); - * $operationResponse = $backendBucketsClient->addSignedUrlKey($backendBucket, $project, $signedUrlKeyResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $backendBucketsClient->addSignedUrlKey($backendBucket, $project, $signedUrlKeyResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $backendBucketsClient->resumeOperation($operationName, 'addSignedUrlKey'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $backendBucketsClient->close(); - * } - * ``` - * - * @param string $backendBucket Name of the BackendBucket resource to which the Signed URL Key should be added. The name should conform to RFC1035. - * @param string $project Project ID for this request. - * @param SignedUrlKey $signedUrlKeyResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 addSignedUrlKey($backendBucket, $project, $signedUrlKeyResource, array $optionalArgs = []) - { - $request = new AddSignedUrlKeyBackendBucketRequest(); - $requestParamHeaders = []; - $request->setBackendBucket($backendBucket); - $request->setProject($project); - $request->setSignedUrlKeyResource($signedUrlKeyResource); - $requestParamHeaders['backend_bucket'] = $backendBucket; - $requestParamHeaders['project'] = $project; - 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('AddSignedUrlKey', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Deletes the specified BackendBucket resource. - * - * Sample code: - * ``` - * $backendBucketsClient = new BackendBucketsClient(); - * try { - * $backendBucket = 'backend_bucket'; - * $project = 'project'; - * $operationResponse = $backendBucketsClient->delete($backendBucket, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $backendBucketsClient->delete($backendBucket, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $backendBucketsClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $backendBucketsClient->close(); - * } - * ``` - * - * @param string $backendBucket Name of the BackendBucket resource to delete. - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($backendBucket, $project, array $optionalArgs = []) - { - $request = new DeleteBackendBucketRequest(); - $requestParamHeaders = []; - $request->setBackendBucket($backendBucket); - $request->setProject($project); - $requestParamHeaders['backend_bucket'] = $backendBucket; - $requestParamHeaders['project'] = $project; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Deletes a key for validating requests with signed URLs for this backend bucket. - * - * Sample code: - * ``` - * $backendBucketsClient = new BackendBucketsClient(); - * try { - * $backendBucket = 'backend_bucket'; - * $keyName = 'key_name'; - * $project = 'project'; - * $operationResponse = $backendBucketsClient->deleteSignedUrlKey($backendBucket, $keyName, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $backendBucketsClient->deleteSignedUrlKey($backendBucket, $keyName, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $backendBucketsClient->resumeOperation($operationName, 'deleteSignedUrlKey'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $backendBucketsClient->close(); - * } - * ``` - * - * @param string $backendBucket Name of the BackendBucket resource to which the Signed URL Key should be added. The name should conform to RFC1035. - * @param string $keyName The name of the Signed URL Key to delete. - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 deleteSignedUrlKey($backendBucket, $keyName, $project, array $optionalArgs = []) - { - $request = new DeleteSignedUrlKeyBackendBucketRequest(); - $requestParamHeaders = []; - $request->setBackendBucket($backendBucket); - $request->setKeyName($keyName); - $request->setProject($project); - $requestParamHeaders['backend_bucket'] = $backendBucket; - $requestParamHeaders['project'] = $project; - 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('DeleteSignedUrlKey', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns the specified BackendBucket resource. - * - * Sample code: - * ``` - * $backendBucketsClient = new BackendBucketsClient(); - * try { - * $backendBucket = 'backend_bucket'; - * $project = 'project'; - * $response = $backendBucketsClient->get($backendBucket, $project); - * } finally { - * $backendBucketsClient->close(); - * } - * ``` - * - * @param string $backendBucket Name of the BackendBucket resource to return. - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\BackendBucket - * - * @throws ApiException if the remote call fails - */ - public function get($backendBucket, $project, array $optionalArgs = []) - { - $request = new GetBackendBucketRequest(); - $requestParamHeaders = []; - $request->setBackendBucket($backendBucket); - $request->setProject($project); - $requestParamHeaders['backend_bucket'] = $backendBucket; - $requestParamHeaders['project'] = $project; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', BackendBucket::class, $optionalArgs, $request)->wait(); - } - - /** - * Gets the access control policy for a resource. May be empty if no such policy or resource exists. - * - * Sample code: - * ``` - * $backendBucketsClient = new BackendBucketsClient(); - * try { - * $project = 'project'; - * $resource = 'resource'; - * $response = $backendBucketsClient->getIamPolicy($project, $resource); - * } finally { - * $backendBucketsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $resource Name or id of the resource for this request. - * @param array $optionalArgs { - * Optional. - * - * @type int $optionsRequestedPolicyVersion - * Requested IAM Policy version. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function getIamPolicy($project, $resource, array $optionalArgs = []) - { - $request = new GetIamPolicyBackendBucketRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setResource($resource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['optionsRequestedPolicyVersion'])) { - $request->setOptionsRequestedPolicyVersion($optionalArgs['optionsRequestedPolicyVersion']); - } - - $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(); - } - - /** - * Creates a BackendBucket resource in the specified project using the data included in the request. - * - * Sample code: - * ``` - * $backendBucketsClient = new BackendBucketsClient(); - * try { - * $backendBucketResource = new BackendBucket(); - * $project = 'project'; - * $operationResponse = $backendBucketsClient->insert($backendBucketResource, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $backendBucketsClient->insert($backendBucketResource, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $backendBucketsClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $backendBucketsClient->close(); - * } - * ``` - * - * @param BackendBucket $backendBucketResource The body resource for this request - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 insert($backendBucketResource, $project, array $optionalArgs = []) - { - $request = new InsertBackendBucketRequest(); - $requestParamHeaders = []; - $request->setBackendBucketResource($backendBucketResource); - $request->setProject($project); - $requestParamHeaders['project'] = $project; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Retrieves the list of BackendBucket resources available to the specified project. - * - * Sample code: - * ``` - * $backendBucketsClient = new BackendBucketsClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $backendBucketsClient->list($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $backendBucketsClient->list($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $backendBucketsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, array $optionalArgs = []) - { - $request = new ListBackendBucketsRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, BackendBucketList::class, $request); - } - - /** - * Updates the specified BackendBucket resource with the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. - * - * Sample code: - * ``` - * $backendBucketsClient = new BackendBucketsClient(); - * try { - * $backendBucket = 'backend_bucket'; - * $backendBucketResource = new BackendBucket(); - * $project = 'project'; - * $operationResponse = $backendBucketsClient->patch($backendBucket, $backendBucketResource, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $backendBucketsClient->patch($backendBucket, $backendBucketResource, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $backendBucketsClient->resumeOperation($operationName, 'patch'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $backendBucketsClient->close(); - * } - * ``` - * - * @param string $backendBucket Name of the BackendBucket resource to patch. - * @param BackendBucket $backendBucketResource The body resource for this request - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 patch($backendBucket, $backendBucketResource, $project, array $optionalArgs = []) - { - $request = new PatchBackendBucketRequest(); - $requestParamHeaders = []; - $request->setBackendBucket($backendBucket); - $request->setBackendBucketResource($backendBucketResource); - $request->setProject($project); - $requestParamHeaders['backend_bucket'] = $backendBucket; - $requestParamHeaders['project'] = $project; - 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('Patch', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Sets the edge security policy for the specified backend bucket. - * - * Sample code: - * ``` - * $backendBucketsClient = new BackendBucketsClient(); - * try { - * $backendBucket = 'backend_bucket'; - * $project = 'project'; - * $securityPolicyReferenceResource = new SecurityPolicyReference(); - * $operationResponse = $backendBucketsClient->setEdgeSecurityPolicy($backendBucket, $project, $securityPolicyReferenceResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $backendBucketsClient->setEdgeSecurityPolicy($backendBucket, $project, $securityPolicyReferenceResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $backendBucketsClient->resumeOperation($operationName, 'setEdgeSecurityPolicy'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $backendBucketsClient->close(); - * } - * ``` - * - * @param string $backendBucket Name of the BackendBucket resource to which the security policy should be set. The name should conform to RFC1035. - * @param string $project Project ID for this request. - * @param SecurityPolicyReference $securityPolicyReferenceResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 setEdgeSecurityPolicy($backendBucket, $project, $securityPolicyReferenceResource, array $optionalArgs = []) - { - $request = new SetEdgeSecurityPolicyBackendBucketRequest(); - $requestParamHeaders = []; - $request->setBackendBucket($backendBucket); - $request->setProject($project); - $request->setSecurityPolicyReferenceResource($securityPolicyReferenceResource); - $requestParamHeaders['backend_bucket'] = $backendBucket; - $requestParamHeaders['project'] = $project; - 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('SetEdgeSecurityPolicy', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Sets the access control policy on the specified resource. Replaces any existing policy. - * - * Sample code: - * ``` - * $backendBucketsClient = new BackendBucketsClient(); - * try { - * $globalSetPolicyRequestResource = new GlobalSetPolicyRequest(); - * $project = 'project'; - * $resource = 'resource'; - * $response = $backendBucketsClient->setIamPolicy($globalSetPolicyRequestResource, $project, $resource); - * } finally { - * $backendBucketsClient->close(); - * } - * ``` - * - * @param GlobalSetPolicyRequest $globalSetPolicyRequestResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $resource Name or id of the resource for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function setIamPolicy($globalSetPolicyRequestResource, $project, $resource, array $optionalArgs = []) - { - $request = new SetIamPolicyBackendBucketRequest(); - $requestParamHeaders = []; - $request->setGlobalSetPolicyRequestResource($globalSetPolicyRequestResource); - $request->setProject($project); - $request->setResource($resource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['resource'] = $resource; - $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 resource. - * - * Sample code: - * ``` - * $backendBucketsClient = new BackendBucketsClient(); - * try { - * $project = 'project'; - * $resource = 'resource'; - * $testPermissionsRequestResource = new TestPermissionsRequest(); - * $response = $backendBucketsClient->testIamPermissions($project, $resource, $testPermissionsRequestResource); - * } finally { - * $backendBucketsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $resource Name or id of the resource for this request. - * @param TestPermissionsRequest $testPermissionsRequestResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\TestPermissionsResponse - * - * @throws ApiException if the remote call fails - */ - public function testIamPermissions($project, $resource, $testPermissionsRequestResource, array $optionalArgs = []) - { - $request = new TestIamPermissionsBackendBucketRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setResource($resource); - $request->setTestPermissionsRequestResource($testPermissionsRequestResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['resource'] = $resource; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('TestIamPermissions', TestPermissionsResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Updates the specified BackendBucket resource with the data included in the request. - * - * Sample code: - * ``` - * $backendBucketsClient = new BackendBucketsClient(); - * try { - * $backendBucket = 'backend_bucket'; - * $backendBucketResource = new BackendBucket(); - * $project = 'project'; - * $operationResponse = $backendBucketsClient->update($backendBucket, $backendBucketResource, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $backendBucketsClient->update($backendBucket, $backendBucketResource, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $backendBucketsClient->resumeOperation($operationName, 'update'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $backendBucketsClient->close(); - * } - * ``` - * - * @param string $backendBucket Name of the BackendBucket resource to update. - * @param BackendBucket $backendBucketResource The body resource for this request - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 update($backendBucket, $backendBucketResource, $project, array $optionalArgs = []) - { - $request = new UpdateBackendBucketRequest(); - $requestParamHeaders = []; - $request->setBackendBucket($backendBucket); - $request->setBackendBucketResource($backendBucketResource); - $request->setProject($project); - $requestParamHeaders['backend_bucket'] = $backendBucket; - $requestParamHeaders['project'] = $project; - 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('Update', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/BackendServicesGapicClient.php b/Compute/src/V1/Gapic/BackendServicesGapicClient.php deleted file mode 100644 index fbc01acfa249..000000000000 --- a/Compute/src/V1/Gapic/BackendServicesGapicClient.php +++ /dev/null @@ -1,1369 +0,0 @@ -addSignedUrlKey($backendService, $project, $signedUrlKeyResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $backendServicesClient->addSignedUrlKey($backendService, $project, $signedUrlKeyResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $backendServicesClient->resumeOperation($operationName, 'addSignedUrlKey'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $backendServicesClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\BackendServicesClient}. - */ -class BackendServicesGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.BackendServices'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/backend_services_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/backend_services_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/backend_services_rest_client_config.php', - ], - ], - 'operationsClientClass' => GlobalOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an GlobalOperationsClient object with the same endpoint as $this. - * - * @return GlobalOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetGlobalOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteGlobalOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method for the - * supported options. - * @type callable $clientCertSource - * A callable which returns the client cert as a string. This can be used to - * provide a certificate and private key to the transport layer for mTLS. - * } - * - * @throws ValidationException - */ - public function __construct(array $options = []) - { - $clientOptions = $this->buildClientOptions($options); - $this->setClientOptions($clientOptions); - $this->operationsClient = $this->createOperationsClient($clientOptions); - } - - /** - * Adds a key for validating requests with signed URLs for this backend service. - * - * Sample code: - * ``` - * $backendServicesClient = new BackendServicesClient(); - * try { - * $backendService = 'backend_service'; - * $project = 'project'; - * $signedUrlKeyResource = new SignedUrlKey(); - * $operationResponse = $backendServicesClient->addSignedUrlKey($backendService, $project, $signedUrlKeyResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $backendServicesClient->addSignedUrlKey($backendService, $project, $signedUrlKeyResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $backendServicesClient->resumeOperation($operationName, 'addSignedUrlKey'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $backendServicesClient->close(); - * } - * ``` - * - * @param string $backendService Name of the BackendService resource to which the Signed URL Key should be added. The name should conform to RFC1035. - * @param string $project Project ID for this request. - * @param SignedUrlKey $signedUrlKeyResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 addSignedUrlKey($backendService, $project, $signedUrlKeyResource, array $optionalArgs = []) - { - $request = new AddSignedUrlKeyBackendServiceRequest(); - $requestParamHeaders = []; - $request->setBackendService($backendService); - $request->setProject($project); - $request->setSignedUrlKeyResource($signedUrlKeyResource); - $requestParamHeaders['backend_service'] = $backendService; - $requestParamHeaders['project'] = $project; - 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('AddSignedUrlKey', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Retrieves the list of all BackendService resources, regional and global, available to the specified project. To prevent failure, Google recommends that you set the `returnPartialSuccess` parameter to `true`. - * - * Sample code: - * ``` - * $backendServicesClient = new BackendServicesClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $backendServicesClient->aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $backendServicesClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $backendServicesClient->close(); - * } - * ``` - * - * @param string $project Name of the project scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type bool $includeAllScopes - * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type int $serviceProjectNumber - * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable 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 aggregatedList($project, array $optionalArgs = []) - { - $request = new AggregatedListBackendServicesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['includeAllScopes'])) { - $request->setIncludeAllScopes($optionalArgs['includeAllScopes']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - if (isset($optionalArgs['serviceProjectNumber'])) { - $request->setServiceProjectNumber($optionalArgs['serviceProjectNumber']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('AggregatedList', $optionalArgs, BackendServiceAggregatedList::class, $request); - } - - /** - * Deletes the specified BackendService resource. - * - * Sample code: - * ``` - * $backendServicesClient = new BackendServicesClient(); - * try { - * $backendService = 'backend_service'; - * $project = 'project'; - * $operationResponse = $backendServicesClient->delete($backendService, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $backendServicesClient->delete($backendService, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $backendServicesClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $backendServicesClient->close(); - * } - * ``` - * - * @param string $backendService Name of the BackendService resource to delete. - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($backendService, $project, array $optionalArgs = []) - { - $request = new DeleteBackendServiceRequest(); - $requestParamHeaders = []; - $request->setBackendService($backendService); - $request->setProject($project); - $requestParamHeaders['backend_service'] = $backendService; - $requestParamHeaders['project'] = $project; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Deletes a key for validating requests with signed URLs for this backend service. - * - * Sample code: - * ``` - * $backendServicesClient = new BackendServicesClient(); - * try { - * $backendService = 'backend_service'; - * $keyName = 'key_name'; - * $project = 'project'; - * $operationResponse = $backendServicesClient->deleteSignedUrlKey($backendService, $keyName, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $backendServicesClient->deleteSignedUrlKey($backendService, $keyName, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $backendServicesClient->resumeOperation($operationName, 'deleteSignedUrlKey'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $backendServicesClient->close(); - * } - * ``` - * - * @param string $backendService Name of the BackendService resource to which the Signed URL Key should be added. The name should conform to RFC1035. - * @param string $keyName The name of the Signed URL Key to delete. - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 deleteSignedUrlKey($backendService, $keyName, $project, array $optionalArgs = []) - { - $request = new DeleteSignedUrlKeyBackendServiceRequest(); - $requestParamHeaders = []; - $request->setBackendService($backendService); - $request->setKeyName($keyName); - $request->setProject($project); - $requestParamHeaders['backend_service'] = $backendService; - $requestParamHeaders['project'] = $project; - 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('DeleteSignedUrlKey', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns the specified BackendService resource. - * - * Sample code: - * ``` - * $backendServicesClient = new BackendServicesClient(); - * try { - * $backendService = 'backend_service'; - * $project = 'project'; - * $response = $backendServicesClient->get($backendService, $project); - * } finally { - * $backendServicesClient->close(); - * } - * ``` - * - * @param string $backendService Name of the BackendService resource to return. - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\BackendService - * - * @throws ApiException if the remote call fails - */ - public function get($backendService, $project, array $optionalArgs = []) - { - $request = new GetBackendServiceRequest(); - $requestParamHeaders = []; - $request->setBackendService($backendService); - $request->setProject($project); - $requestParamHeaders['backend_service'] = $backendService; - $requestParamHeaders['project'] = $project; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', BackendService::class, $optionalArgs, $request)->wait(); - } - - /** - * Gets the most recent health check results for this BackendService. Example request body: { "group": "/zones/us-east1-b/instanceGroups/lb-backend-example" } - * - * Sample code: - * ``` - * $backendServicesClient = new BackendServicesClient(); - * try { - * $backendService = 'backend_service'; - * $project = 'project'; - * $resourceGroupReferenceResource = new ResourceGroupReference(); - * $response = $backendServicesClient->getHealth($backendService, $project, $resourceGroupReferenceResource); - * } finally { - * $backendServicesClient->close(); - * } - * ``` - * - * @param string $backendService Name of the BackendService resource to which the queried instance belongs. - * @param string $project - * @param ResourceGroupReference $resourceGroupReferenceResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\BackendServiceGroupHealth - * - * @throws ApiException if the remote call fails - */ - public function getHealth($backendService, $project, $resourceGroupReferenceResource, array $optionalArgs = []) - { - $request = new GetHealthBackendServiceRequest(); - $requestParamHeaders = []; - $request->setBackendService($backendService); - $request->setProject($project); - $request->setResourceGroupReferenceResource($resourceGroupReferenceResource); - $requestParamHeaders['backend_service'] = $backendService; - $requestParamHeaders['project'] = $project; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetHealth', BackendServiceGroupHealth::class, $optionalArgs, $request)->wait(); - } - - /** - * Gets the access control policy for a resource. May be empty if no such policy or resource exists. - * - * Sample code: - * ``` - * $backendServicesClient = new BackendServicesClient(); - * try { - * $project = 'project'; - * $resource = 'resource'; - * $response = $backendServicesClient->getIamPolicy($project, $resource); - * } finally { - * $backendServicesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $resource Name or id of the resource for this request. - * @param array $optionalArgs { - * Optional. - * - * @type int $optionsRequestedPolicyVersion - * Requested IAM Policy version. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function getIamPolicy($project, $resource, array $optionalArgs = []) - { - $request = new GetIamPolicyBackendServiceRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setResource($resource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['optionsRequestedPolicyVersion'])) { - $request->setOptionsRequestedPolicyVersion($optionalArgs['optionsRequestedPolicyVersion']); - } - - $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(); - } - - /** - * Creates a BackendService resource in the specified project using the data included in the request. For more information, see Backend services overview . - * - * Sample code: - * ``` - * $backendServicesClient = new BackendServicesClient(); - * try { - * $backendServiceResource = new BackendService(); - * $project = 'project'; - * $operationResponse = $backendServicesClient->insert($backendServiceResource, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $backendServicesClient->insert($backendServiceResource, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $backendServicesClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $backendServicesClient->close(); - * } - * ``` - * - * @param BackendService $backendServiceResource The body resource for this request - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 insert($backendServiceResource, $project, array $optionalArgs = []) - { - $request = new InsertBackendServiceRequest(); - $requestParamHeaders = []; - $request->setBackendServiceResource($backendServiceResource); - $request->setProject($project); - $requestParamHeaders['project'] = $project; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Retrieves the list of BackendService resources available to the specified project. - * - * Sample code: - * ``` - * $backendServicesClient = new BackendServicesClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $backendServicesClient->list($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $backendServicesClient->list($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $backendServicesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, array $optionalArgs = []) - { - $request = new ListBackendServicesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, BackendServiceList::class, $request); - } - - /** - * Retrieves a list of all usable backend services in the specified project. - * - * Sample code: - * ``` - * $backendServicesClient = new BackendServicesClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $backendServicesClient->listUsable($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $backendServicesClient->listUsable($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $backendServicesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 listUsable($project, array $optionalArgs = []) - { - $request = new ListUsableBackendServicesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('ListUsable', $optionalArgs, BackendServiceListUsable::class, $request); - } - - /** - * Patches the specified BackendService resource with the data included in the request. For more information, see Backend services overview. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. - * - * Sample code: - * ``` - * $backendServicesClient = new BackendServicesClient(); - * try { - * $backendService = 'backend_service'; - * $backendServiceResource = new BackendService(); - * $project = 'project'; - * $operationResponse = $backendServicesClient->patch($backendService, $backendServiceResource, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $backendServicesClient->patch($backendService, $backendServiceResource, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $backendServicesClient->resumeOperation($operationName, 'patch'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $backendServicesClient->close(); - * } - * ``` - * - * @param string $backendService Name of the BackendService resource to patch. - * @param BackendService $backendServiceResource The body resource for this request - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 patch($backendService, $backendServiceResource, $project, array $optionalArgs = []) - { - $request = new PatchBackendServiceRequest(); - $requestParamHeaders = []; - $request->setBackendService($backendService); - $request->setBackendServiceResource($backendServiceResource); - $request->setProject($project); - $requestParamHeaders['backend_service'] = $backendService; - $requestParamHeaders['project'] = $project; - 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('Patch', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Sets the edge security policy for the specified backend service. - * - * Sample code: - * ``` - * $backendServicesClient = new BackendServicesClient(); - * try { - * $backendService = 'backend_service'; - * $project = 'project'; - * $securityPolicyReferenceResource = new SecurityPolicyReference(); - * $operationResponse = $backendServicesClient->setEdgeSecurityPolicy($backendService, $project, $securityPolicyReferenceResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $backendServicesClient->setEdgeSecurityPolicy($backendService, $project, $securityPolicyReferenceResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $backendServicesClient->resumeOperation($operationName, 'setEdgeSecurityPolicy'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $backendServicesClient->close(); - * } - * ``` - * - * @param string $backendService Name of the BackendService resource to which the edge security policy should be set. The name should conform to RFC1035. - * @param string $project Project ID for this request. - * @param SecurityPolicyReference $securityPolicyReferenceResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 setEdgeSecurityPolicy($backendService, $project, $securityPolicyReferenceResource, array $optionalArgs = []) - { - $request = new SetEdgeSecurityPolicyBackendServiceRequest(); - $requestParamHeaders = []; - $request->setBackendService($backendService); - $request->setProject($project); - $request->setSecurityPolicyReferenceResource($securityPolicyReferenceResource); - $requestParamHeaders['backend_service'] = $backendService; - $requestParamHeaders['project'] = $project; - 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('SetEdgeSecurityPolicy', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Sets the access control policy on the specified resource. Replaces any existing policy. - * - * Sample code: - * ``` - * $backendServicesClient = new BackendServicesClient(); - * try { - * $globalSetPolicyRequestResource = new GlobalSetPolicyRequest(); - * $project = 'project'; - * $resource = 'resource'; - * $response = $backendServicesClient->setIamPolicy($globalSetPolicyRequestResource, $project, $resource); - * } finally { - * $backendServicesClient->close(); - * } - * ``` - * - * @param GlobalSetPolicyRequest $globalSetPolicyRequestResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $resource Name or id of the resource for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function setIamPolicy($globalSetPolicyRequestResource, $project, $resource, array $optionalArgs = []) - { - $request = new SetIamPolicyBackendServiceRequest(); - $requestParamHeaders = []; - $request->setGlobalSetPolicyRequestResource($globalSetPolicyRequestResource); - $request->setProject($project); - $request->setResource($resource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['resource'] = $resource; - $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(); - } - - /** - * Sets the Google Cloud Armor security policy for the specified backend service. For more information, see Google Cloud Armor Overview - * - * Sample code: - * ``` - * $backendServicesClient = new BackendServicesClient(); - * try { - * $backendService = 'backend_service'; - * $project = 'project'; - * $securityPolicyReferenceResource = new SecurityPolicyReference(); - * $operationResponse = $backendServicesClient->setSecurityPolicy($backendService, $project, $securityPolicyReferenceResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $backendServicesClient->setSecurityPolicy($backendService, $project, $securityPolicyReferenceResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $backendServicesClient->resumeOperation($operationName, 'setSecurityPolicy'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $backendServicesClient->close(); - * } - * ``` - * - * @param string $backendService Name of the BackendService resource to which the security policy should be set. The name should conform to RFC1035. - * @param string $project Project ID for this request. - * @param SecurityPolicyReference $securityPolicyReferenceResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 setSecurityPolicy($backendService, $project, $securityPolicyReferenceResource, array $optionalArgs = []) - { - $request = new SetSecurityPolicyBackendServiceRequest(); - $requestParamHeaders = []; - $request->setBackendService($backendService); - $request->setProject($project); - $request->setSecurityPolicyReferenceResource($securityPolicyReferenceResource); - $requestParamHeaders['backend_service'] = $backendService; - $requestParamHeaders['project'] = $project; - 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('SetSecurityPolicy', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns permissions that a caller has on the specified resource. - * - * Sample code: - * ``` - * $backendServicesClient = new BackendServicesClient(); - * try { - * $project = 'project'; - * $resource = 'resource'; - * $testPermissionsRequestResource = new TestPermissionsRequest(); - * $response = $backendServicesClient->testIamPermissions($project, $resource, $testPermissionsRequestResource); - * } finally { - * $backendServicesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $resource Name or id of the resource for this request. - * @param TestPermissionsRequest $testPermissionsRequestResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\TestPermissionsResponse - * - * @throws ApiException if the remote call fails - */ - public function testIamPermissions($project, $resource, $testPermissionsRequestResource, array $optionalArgs = []) - { - $request = new TestIamPermissionsBackendServiceRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setResource($resource); - $request->setTestPermissionsRequestResource($testPermissionsRequestResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['resource'] = $resource; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('TestIamPermissions', TestPermissionsResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Updates the specified BackendService resource with the data included in the request. For more information, see Backend services overview. - * - * Sample code: - * ``` - * $backendServicesClient = new BackendServicesClient(); - * try { - * $backendService = 'backend_service'; - * $backendServiceResource = new BackendService(); - * $project = 'project'; - * $operationResponse = $backendServicesClient->update($backendService, $backendServiceResource, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $backendServicesClient->update($backendService, $backendServiceResource, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $backendServicesClient->resumeOperation($operationName, 'update'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $backendServicesClient->close(); - * } - * ``` - * - * @param string $backendService Name of the BackendService resource to update. - * @param BackendService $backendServiceResource The body resource for this request - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 update($backendService, $backendServiceResource, $project, array $optionalArgs = []) - { - $request = new UpdateBackendServiceRequest(); - $requestParamHeaders = []; - $request->setBackendService($backendService); - $request->setBackendServiceResource($backendServiceResource); - $request->setProject($project); - $requestParamHeaders['backend_service'] = $backendService; - $requestParamHeaders['project'] = $project; - 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('Update', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/DiskTypesGapicClient.php b/Compute/src/V1/Gapic/DiskTypesGapicClient.php deleted file mode 100644 index b048ec73d686..000000000000 --- a/Compute/src/V1/Gapic/DiskTypesGapicClient.php +++ /dev/null @@ -1,422 +0,0 @@ -aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $diskTypesClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $diskTypesClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\DiskTypesClient}. - */ -class DiskTypesGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.DiskTypes'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute.readonly', - 'https://www.googleapis.com/auth/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/disk_types_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/disk_types_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/disk_types_rest_client_config.php', - ], - ], - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * 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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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); - } - - /** - * Retrieves an aggregated list of disk types. To prevent failure, Google recommends that you set the `returnPartialSuccess` parameter to `true`. - * - * Sample code: - * ``` - * $diskTypesClient = new DiskTypesClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $diskTypesClient->aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $diskTypesClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $diskTypesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type bool $includeAllScopes - * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type int $serviceProjectNumber - * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable 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 aggregatedList($project, array $optionalArgs = []) - { - $request = new AggregatedListDiskTypesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['includeAllScopes'])) { - $request->setIncludeAllScopes($optionalArgs['includeAllScopes']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - if (isset($optionalArgs['serviceProjectNumber'])) { - $request->setServiceProjectNumber($optionalArgs['serviceProjectNumber']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('AggregatedList', $optionalArgs, DiskTypeAggregatedList::class, $request); - } - - /** - * Returns the specified disk type. - * - * Sample code: - * ``` - * $diskTypesClient = new DiskTypesClient(); - * try { - * $diskType = 'disk_type'; - * $project = 'project'; - * $zone = 'zone'; - * $response = $diskTypesClient->get($diskType, $project, $zone); - * } finally { - * $diskTypesClient->close(); - * } - * ``` - * - * @param string $diskType Name of the disk type to return. - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\DiskType - * - * @throws ApiException if the remote call fails - */ - public function get($diskType, $project, $zone, array $optionalArgs = []) - { - $request = new GetDiskTypeRequest(); - $requestParamHeaders = []; - $request->setDiskType($diskType); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['disk_type'] = $diskType; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', DiskType::class, $optionalArgs, $request)->wait(); - } - - /** - * Retrieves a list of disk types available to the specified project. - * - * Sample code: - * ``` - * $diskTypesClient = new DiskTypesClient(); - * try { - * $project = 'project'; - * $zone = 'zone'; - * // Iterate over pages of elements - * $pagedResponse = $diskTypesClient->list($project, $zone); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $diskTypesClient->list($project, $zone); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $diskTypesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, $zone, array $optionalArgs = []) - { - $request = new ListDiskTypesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, DiskTypeList::class, $request); - } -} diff --git a/Compute/src/V1/Gapic/DisksGapicClient.php b/Compute/src/V1/Gapic/DisksGapicClient.php deleted file mode 100644 index 73fa72ce85bd..000000000000 --- a/Compute/src/V1/Gapic/DisksGapicClient.php +++ /dev/null @@ -1,1709 +0,0 @@ -addResourcePolicies($disk, $disksAddResourcePoliciesRequestResource, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $disksClient->addResourcePolicies($disk, $disksAddResourcePoliciesRequestResource, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $disksClient->resumeOperation($operationName, 'addResourcePolicies'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $disksClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\DisksClient}. - */ -class DisksGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.Disks'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/disks_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/disks_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/disks_rest_client_config.php', - ], - ], - 'operationsClientClass' => ZoneOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an ZoneOperationsClient object with the same endpoint as $this. - * - * @return ZoneOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getZone', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetZoneOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteZoneOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method for the - * supported options. - * @type callable $clientCertSource - * A callable which returns the client cert as a string. This can be used to - * provide a certificate and private key to the transport layer for mTLS. - * } - * - * @throws ValidationException - */ - public function __construct(array $options = []) - { - $clientOptions = $this->buildClientOptions($options); - $this->setClientOptions($clientOptions); - $this->operationsClient = $this->createOperationsClient($clientOptions); - } - - /** - * Adds existing resource policies to a disk. You can only add one policy which will be applied to this disk for scheduling snapshot creation. - * - * Sample code: - * ``` - * $disksClient = new DisksClient(); - * try { - * $disk = 'disk'; - * $disksAddResourcePoliciesRequestResource = new DisksAddResourcePoliciesRequest(); - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $disksClient->addResourcePolicies($disk, $disksAddResourcePoliciesRequestResource, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $disksClient->addResourcePolicies($disk, $disksAddResourcePoliciesRequestResource, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $disksClient->resumeOperation($operationName, 'addResourcePolicies'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $disksClient->close(); - * } - * ``` - * - * @param string $disk The disk name for this request. - * @param DisksAddResourcePoliciesRequest $disksAddResourcePoliciesRequestResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 addResourcePolicies($disk, $disksAddResourcePoliciesRequestResource, $project, $zone, array $optionalArgs = []) - { - $request = new AddResourcePoliciesDiskRequest(); - $requestParamHeaders = []; - $request->setDisk($disk); - $request->setDisksAddResourcePoliciesRequestResource($disksAddResourcePoliciesRequestResource); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['disk'] = $disk; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('AddResourcePolicies', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Retrieves an aggregated list of persistent disks. To prevent failure, Google recommends that you set the `returnPartialSuccess` parameter to `true`. - * - * Sample code: - * ``` - * $disksClient = new DisksClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $disksClient->aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $disksClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $disksClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type bool $includeAllScopes - * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type int $serviceProjectNumber - * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable 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 aggregatedList($project, array $optionalArgs = []) - { - $request = new AggregatedListDisksRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['includeAllScopes'])) { - $request->setIncludeAllScopes($optionalArgs['includeAllScopes']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - if (isset($optionalArgs['serviceProjectNumber'])) { - $request->setServiceProjectNumber($optionalArgs['serviceProjectNumber']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('AggregatedList', $optionalArgs, DiskAggregatedList::class, $request); - } - - /** - * Bulk create a set of disks. - * - * Sample code: - * ``` - * $disksClient = new DisksClient(); - * try { - * $bulkInsertDiskResourceResource = new BulkInsertDiskResource(); - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $disksClient->bulkInsert($bulkInsertDiskResourceResource, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $disksClient->bulkInsert($bulkInsertDiskResourceResource, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $disksClient->resumeOperation($operationName, 'bulkInsert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $disksClient->close(); - * } - * ``` - * - * @param BulkInsertDiskResource $bulkInsertDiskResourceResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 bulkInsert($bulkInsertDiskResourceResource, $project, $zone, array $optionalArgs = []) - { - $request = new BulkInsertDiskRequest(); - $requestParamHeaders = []; - $request->setBulkInsertDiskResourceResource($bulkInsertDiskResourceResource); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('BulkInsert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Sets the labels on many disks at once. To learn more about labels, read the Labeling Resources documentation. - * - * Sample code: - * ``` - * $disksClient = new DisksClient(); - * try { - * $bulkZoneSetLabelsRequestResource = new BulkZoneSetLabelsRequest(); - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $disksClient->bulkSetLabels($bulkZoneSetLabelsRequestResource, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $disksClient->bulkSetLabels($bulkZoneSetLabelsRequestResource, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $disksClient->resumeOperation($operationName, 'bulkSetLabels'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $disksClient->close(); - * } - * ``` - * - * @param BulkZoneSetLabelsRequest $bulkZoneSetLabelsRequestResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 $resource - * Name or id of the resource for this request. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 bulkSetLabels($bulkZoneSetLabelsRequestResource, $project, $zone, array $optionalArgs = []) - { - $request = new BulkSetLabelsDiskRequest(); - $requestParamHeaders = []; - $request->setBulkZoneSetLabelsRequestResource($bulkZoneSetLabelsRequestResource); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - if (isset($optionalArgs['resource'])) { - $request->setResource($optionalArgs['resource']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('BulkSetLabels', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Creates a snapshot of a specified persistent disk. For regular snapshot creation, consider using snapshots.insert instead, as that method supports more features, such as creating snapshots in a project different from the source disk project. - * - * Sample code: - * ``` - * $disksClient = new DisksClient(); - * try { - * $disk = 'disk'; - * $project = 'project'; - * $snapshotResource = new Snapshot(); - * $zone = 'zone'; - * $operationResponse = $disksClient->createSnapshot($disk, $project, $snapshotResource, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $disksClient->createSnapshot($disk, $project, $snapshotResource, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $disksClient->resumeOperation($operationName, 'createSnapshot'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $disksClient->close(); - * } - * ``` - * - * @param string $disk Name of the persistent disk to snapshot. - * @param string $project Project ID for this request. - * @param Snapshot $snapshotResource The body resource for this request - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type bool $guestFlush - * [Input Only] Whether to attempt an application consistent snapshot by informing the OS to prepare for the snapshot process. - * @type string $requestId - * 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. 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 createSnapshot($disk, $project, $snapshotResource, $zone, array $optionalArgs = []) - { - $request = new CreateSnapshotDiskRequest(); - $requestParamHeaders = []; - $request->setDisk($disk); - $request->setProject($project); - $request->setSnapshotResource($snapshotResource); - $request->setZone($zone); - $requestParamHeaders['disk'] = $disk; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - if (isset($optionalArgs['guestFlush'])) { - $request->setGuestFlush($optionalArgs['guestFlush']); - } - - 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('CreateSnapshot', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Deletes the specified persistent disk. Deleting a disk removes its data permanently and is irreversible. However, deleting a disk does not delete any snapshots previously made from the disk. You must separately delete snapshots. - * - * Sample code: - * ``` - * $disksClient = new DisksClient(); - * try { - * $disk = 'disk'; - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $disksClient->delete($disk, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $disksClient->delete($disk, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $disksClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $disksClient->close(); - * } - * ``` - * - * @param string $disk Name of the persistent disk to delete. - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($disk, $project, $zone, array $optionalArgs = []) - { - $request = new DeleteDiskRequest(); - $requestParamHeaders = []; - $request->setDisk($disk); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['disk'] = $disk; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns the specified persistent disk. - * - * Sample code: - * ``` - * $disksClient = new DisksClient(); - * try { - * $disk = 'disk'; - * $project = 'project'; - * $zone = 'zone'; - * $response = $disksClient->get($disk, $project, $zone); - * } finally { - * $disksClient->close(); - * } - * ``` - * - * @param string $disk Name of the persistent disk to return. - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Disk - * - * @throws ApiException if the remote call fails - */ - public function get($disk, $project, $zone, array $optionalArgs = []) - { - $request = new GetDiskRequest(); - $requestParamHeaders = []; - $request->setDisk($disk); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['disk'] = $disk; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', Disk::class, $optionalArgs, $request)->wait(); - } - - /** - * Gets the access control policy for a resource. May be empty if no such policy or resource exists. - * - * Sample code: - * ``` - * $disksClient = new DisksClient(); - * try { - * $project = 'project'; - * $resource = 'resource'; - * $zone = 'zone'; - * $response = $disksClient->getIamPolicy($project, $resource, $zone); - * } finally { - * $disksClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $resource Name or id of the resource for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type int $optionsRequestedPolicyVersion - * Requested IAM Policy version. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function getIamPolicy($project, $resource, $zone, array $optionalArgs = []) - { - $request = new GetIamPolicyDiskRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setResource($resource); - $request->setZone($zone); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['resource'] = $resource; - $requestParamHeaders['zone'] = $zone; - if (isset($optionalArgs['optionsRequestedPolicyVersion'])) { - $request->setOptionsRequestedPolicyVersion($optionalArgs['optionsRequestedPolicyVersion']); - } - - $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(); - } - - /** - * Creates a persistent disk in the specified project using the data in the request. You can create a disk from a source (sourceImage, sourceSnapshot, or sourceDisk) or create an empty 500 GB data disk by omitting all properties. You can also create a disk that is larger than the default size by specifying the sizeGb property. - * - * Sample code: - * ``` - * $disksClient = new DisksClient(); - * try { - * $diskResource = new Disk(); - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $disksClient->insert($diskResource, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $disksClient->insert($diskResource, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $disksClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $disksClient->close(); - * } - * ``` - * - * @param Disk $diskResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 $sourceImage - * Source image to restore onto a disk. This field is optional. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 insert($diskResource, $project, $zone, array $optionalArgs = []) - { - $request = new InsertDiskRequest(); - $requestParamHeaders = []; - $request->setDiskResource($diskResource); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - if (isset($optionalArgs['sourceImage'])) { - $request->setSourceImage($optionalArgs['sourceImage']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Retrieves a list of persistent disks contained within the specified zone. - * - * Sample code: - * ``` - * $disksClient = new DisksClient(); - * try { - * $project = 'project'; - * $zone = 'zone'; - * // Iterate over pages of elements - * $pagedResponse = $disksClient->list($project, $zone); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $disksClient->list($project, $zone); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $disksClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, $zone, array $optionalArgs = []) - { - $request = new ListDisksRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, DiskList::class, $request); - } - - /** - * Removes resource policies from a disk. - * - * Sample code: - * ``` - * $disksClient = new DisksClient(); - * try { - * $disk = 'disk'; - * $disksRemoveResourcePoliciesRequestResource = new DisksRemoveResourcePoliciesRequest(); - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $disksClient->removeResourcePolicies($disk, $disksRemoveResourcePoliciesRequestResource, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $disksClient->removeResourcePolicies($disk, $disksRemoveResourcePoliciesRequestResource, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $disksClient->resumeOperation($operationName, 'removeResourcePolicies'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $disksClient->close(); - * } - * ``` - * - * @param string $disk The disk name for this request. - * @param DisksRemoveResourcePoliciesRequest $disksRemoveResourcePoliciesRequestResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 removeResourcePolicies($disk, $disksRemoveResourcePoliciesRequestResource, $project, $zone, array $optionalArgs = []) - { - $request = new RemoveResourcePoliciesDiskRequest(); - $requestParamHeaders = []; - $request->setDisk($disk); - $request->setDisksRemoveResourcePoliciesRequestResource($disksRemoveResourcePoliciesRequestResource); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['disk'] = $disk; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('RemoveResourcePolicies', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Resizes the specified persistent disk. You can only increase the size of the disk. - * - * Sample code: - * ``` - * $disksClient = new DisksClient(); - * try { - * $disk = 'disk'; - * $disksResizeRequestResource = new DisksResizeRequest(); - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $disksClient->resize($disk, $disksResizeRequestResource, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $disksClient->resize($disk, $disksResizeRequestResource, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $disksClient->resumeOperation($operationName, 'resize'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $disksClient->close(); - * } - * ``` - * - * @param string $disk The name of the persistent disk. - * @param DisksResizeRequest $disksResizeRequestResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 resize($disk, $disksResizeRequestResource, $project, $zone, array $optionalArgs = []) - { - $request = new ResizeDiskRequest(); - $requestParamHeaders = []; - $request->setDisk($disk); - $request->setDisksResizeRequestResource($disksResizeRequestResource); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['disk'] = $disk; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('Resize', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Sets the access control policy on the specified resource. Replaces any existing policy. - * - * Sample code: - * ``` - * $disksClient = new DisksClient(); - * try { - * $project = 'project'; - * $resource = 'resource'; - * $zone = 'zone'; - * $zoneSetPolicyRequestResource = new ZoneSetPolicyRequest(); - * $response = $disksClient->setIamPolicy($project, $resource, $zone, $zoneSetPolicyRequestResource); - * } finally { - * $disksClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $resource Name or id of the resource for this request. - * @param string $zone The name of the zone for this request. - * @param ZoneSetPolicyRequest $zoneSetPolicyRequestResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function setIamPolicy($project, $resource, $zone, $zoneSetPolicyRequestResource, array $optionalArgs = []) - { - $request = new SetIamPolicyDiskRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setResource($resource); - $request->setZone($zone); - $request->setZoneSetPolicyRequestResource($zoneSetPolicyRequestResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['resource'] = $resource; - $requestParamHeaders['zone'] = $zone; - $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(); - } - - /** - * Sets the labels on a disk. To learn more about labels, read the Labeling Resources documentation. - * - * Sample code: - * ``` - * $disksClient = new DisksClient(); - * try { - * $project = 'project'; - * $resource = 'resource'; - * $zone = 'zone'; - * $zoneSetLabelsRequestResource = new ZoneSetLabelsRequest(); - * $operationResponse = $disksClient->setLabels($project, $resource, $zone, $zoneSetLabelsRequestResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $disksClient->setLabels($project, $resource, $zone, $zoneSetLabelsRequestResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $disksClient->resumeOperation($operationName, 'setLabels'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $disksClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $resource Name or id of the resource for this request. - * @param string $zone The name of the zone for this request. - * @param ZoneSetLabelsRequest $zoneSetLabelsRequestResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 setLabels($project, $resource, $zone, $zoneSetLabelsRequestResource, array $optionalArgs = []) - { - $request = new SetLabelsDiskRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setResource($resource); - $request->setZone($zone); - $request->setZoneSetLabelsRequestResource($zoneSetLabelsRequestResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['resource'] = $resource; - $requestParamHeaders['zone'] = $zone; - 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('SetLabels', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Starts asynchronous replication. Must be invoked on the primary disk. - * - * Sample code: - * ``` - * $disksClient = new DisksClient(); - * try { - * $disk = 'disk'; - * $disksStartAsyncReplicationRequestResource = new DisksStartAsyncReplicationRequest(); - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $disksClient->startAsyncReplication($disk, $disksStartAsyncReplicationRequestResource, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $disksClient->startAsyncReplication($disk, $disksStartAsyncReplicationRequestResource, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $disksClient->resumeOperation($operationName, 'startAsyncReplication'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $disksClient->close(); - * } - * ``` - * - * @param string $disk The name of the persistent disk. - * @param DisksStartAsyncReplicationRequest $disksStartAsyncReplicationRequestResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 startAsyncReplication($disk, $disksStartAsyncReplicationRequestResource, $project, $zone, array $optionalArgs = []) - { - $request = new StartAsyncReplicationDiskRequest(); - $requestParamHeaders = []; - $request->setDisk($disk); - $request->setDisksStartAsyncReplicationRequestResource($disksStartAsyncReplicationRequestResource); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['disk'] = $disk; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('StartAsyncReplication', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Stops asynchronous replication. Can be invoked either on the primary or on the secondary disk. - * - * Sample code: - * ``` - * $disksClient = new DisksClient(); - * try { - * $disk = 'disk'; - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $disksClient->stopAsyncReplication($disk, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $disksClient->stopAsyncReplication($disk, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $disksClient->resumeOperation($operationName, 'stopAsyncReplication'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $disksClient->close(); - * } - * ``` - * - * @param string $disk The name of the persistent disk. - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 stopAsyncReplication($disk, $project, $zone, array $optionalArgs = []) - { - $request = new StopAsyncReplicationDiskRequest(); - $requestParamHeaders = []; - $request->setDisk($disk); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['disk'] = $disk; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('StopAsyncReplication', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Stops asynchronous replication for a consistency group of disks. Can be invoked either in the primary or secondary scope. - * - * Sample code: - * ``` - * $disksClient = new DisksClient(); - * try { - * $disksStopGroupAsyncReplicationResourceResource = new DisksStopGroupAsyncReplicationResource(); - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $disksClient->stopGroupAsyncReplication($disksStopGroupAsyncReplicationResourceResource, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $disksClient->stopGroupAsyncReplication($disksStopGroupAsyncReplicationResourceResource, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $disksClient->resumeOperation($operationName, 'stopGroupAsyncReplication'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $disksClient->close(); - * } - * ``` - * - * @param DisksStopGroupAsyncReplicationResource $disksStopGroupAsyncReplicationResourceResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. This must be the zone of the primary or secondary disks in the consistency group. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 stopGroupAsyncReplication($disksStopGroupAsyncReplicationResourceResource, $project, $zone, array $optionalArgs = []) - { - $request = new StopGroupAsyncReplicationDiskRequest(); - $requestParamHeaders = []; - $request->setDisksStopGroupAsyncReplicationResourceResource($disksStopGroupAsyncReplicationResourceResource); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('StopGroupAsyncReplication', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns permissions that a caller has on the specified resource. - * - * Sample code: - * ``` - * $disksClient = new DisksClient(); - * try { - * $project = 'project'; - * $resource = 'resource'; - * $testPermissionsRequestResource = new TestPermissionsRequest(); - * $zone = 'zone'; - * $response = $disksClient->testIamPermissions($project, $resource, $testPermissionsRequestResource, $zone); - * } finally { - * $disksClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $resource Name or id of the resource for this request. - * @param TestPermissionsRequest $testPermissionsRequestResource The body resource for this request - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\TestPermissionsResponse - * - * @throws ApiException if the remote call fails - */ - public function testIamPermissions($project, $resource, $testPermissionsRequestResource, $zone, array $optionalArgs = []) - { - $request = new TestIamPermissionsDiskRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setResource($resource); - $request->setTestPermissionsRequestResource($testPermissionsRequestResource); - $request->setZone($zone); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['resource'] = $resource; - $requestParamHeaders['zone'] = $zone; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('TestIamPermissions', TestPermissionsResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Updates the specified disk with the data included in the request. The update is performed only on selected fields included as part of update-mask. Only the following fields can be modified: user_license. - * - * Sample code: - * ``` - * $disksClient = new DisksClient(); - * try { - * $disk = 'disk'; - * $diskResource = new Disk(); - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $disksClient->update($disk, $diskResource, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $disksClient->update($disk, $diskResource, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $disksClient->resumeOperation($operationName, 'update'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $disksClient->close(); - * } - * ``` - * - * @param string $disk The disk name for this request. - * @param Disk $diskResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $paths - * @type string $requestId - * 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. 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 $updateMask - * update_mask indicates fields to be updated as part of this request. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 update($disk, $diskResource, $project, $zone, array $optionalArgs = []) - { - $request = new UpdateDiskRequest(); - $requestParamHeaders = []; - $request->setDisk($disk); - $request->setDiskResource($diskResource); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['disk'] = $disk; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - if (isset($optionalArgs['paths'])) { - $request->setPaths($optionalArgs['paths']); - } - - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('Update', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/ExternalVpnGatewaysGapicClient.php b/Compute/src/V1/Gapic/ExternalVpnGatewaysGapicClient.php deleted file mode 100644 index 1a6ab8785768..000000000000 --- a/Compute/src/V1/Gapic/ExternalVpnGatewaysGapicClient.php +++ /dev/null @@ -1,649 +0,0 @@ -delete($externalVpnGateway, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $externalVpnGatewaysClient->delete($externalVpnGateway, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $externalVpnGatewaysClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $externalVpnGatewaysClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\ExternalVpnGatewaysClient}. - */ -class ExternalVpnGatewaysGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.ExternalVpnGateways'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/external_vpn_gateways_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/external_vpn_gateways_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/external_vpn_gateways_rest_client_config.php', - ], - ], - 'operationsClientClass' => GlobalOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an GlobalOperationsClient object with the same endpoint as $this. - * - * @return GlobalOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetGlobalOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteGlobalOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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 the specified externalVpnGateway. - * - * Sample code: - * ``` - * $externalVpnGatewaysClient = new ExternalVpnGatewaysClient(); - * try { - * $externalVpnGateway = 'external_vpn_gateway'; - * $project = 'project'; - * $operationResponse = $externalVpnGatewaysClient->delete($externalVpnGateway, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $externalVpnGatewaysClient->delete($externalVpnGateway, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $externalVpnGatewaysClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $externalVpnGatewaysClient->close(); - * } - * ``` - * - * @param string $externalVpnGateway Name of the externalVpnGateways to delete. - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($externalVpnGateway, $project, array $optionalArgs = []) - { - $request = new DeleteExternalVpnGatewayRequest(); - $requestParamHeaders = []; - $request->setExternalVpnGateway($externalVpnGateway); - $request->setProject($project); - $requestParamHeaders['external_vpn_gateway'] = $externalVpnGateway; - $requestParamHeaders['project'] = $project; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns the specified externalVpnGateway. Get a list of available externalVpnGateways by making a list() request. - * - * Sample code: - * ``` - * $externalVpnGatewaysClient = new ExternalVpnGatewaysClient(); - * try { - * $externalVpnGateway = 'external_vpn_gateway'; - * $project = 'project'; - * $response = $externalVpnGatewaysClient->get($externalVpnGateway, $project); - * } finally { - * $externalVpnGatewaysClient->close(); - * } - * ``` - * - * @param string $externalVpnGateway Name of the externalVpnGateway to return. - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\ExternalVpnGateway - * - * @throws ApiException if the remote call fails - */ - public function get($externalVpnGateway, $project, array $optionalArgs = []) - { - $request = new GetExternalVpnGatewayRequest(); - $requestParamHeaders = []; - $request->setExternalVpnGateway($externalVpnGateway); - $request->setProject($project); - $requestParamHeaders['external_vpn_gateway'] = $externalVpnGateway; - $requestParamHeaders['project'] = $project; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', ExternalVpnGateway::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates a ExternalVpnGateway in the specified project using the data included in the request. - * - * Sample code: - * ``` - * $externalVpnGatewaysClient = new ExternalVpnGatewaysClient(); - * try { - * $externalVpnGatewayResource = new ExternalVpnGateway(); - * $project = 'project'; - * $operationResponse = $externalVpnGatewaysClient->insert($externalVpnGatewayResource, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $externalVpnGatewaysClient->insert($externalVpnGatewayResource, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $externalVpnGatewaysClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $externalVpnGatewaysClient->close(); - * } - * ``` - * - * @param ExternalVpnGateway $externalVpnGatewayResource The body resource for this request - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 insert($externalVpnGatewayResource, $project, array $optionalArgs = []) - { - $request = new InsertExternalVpnGatewayRequest(); - $requestParamHeaders = []; - $request->setExternalVpnGatewayResource($externalVpnGatewayResource); - $request->setProject($project); - $requestParamHeaders['project'] = $project; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Retrieves the list of ExternalVpnGateway available to the specified project. - * - * Sample code: - * ``` - * $externalVpnGatewaysClient = new ExternalVpnGatewaysClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $externalVpnGatewaysClient->list($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $externalVpnGatewaysClient->list($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $externalVpnGatewaysClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, array $optionalArgs = []) - { - $request = new ListExternalVpnGatewaysRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, ExternalVpnGatewayList::class, $request); - } - - /** - * Sets the labels on an ExternalVpnGateway. To learn more about labels, read the Labeling Resources documentation. - * - * Sample code: - * ``` - * $externalVpnGatewaysClient = new ExternalVpnGatewaysClient(); - * try { - * $globalSetLabelsRequestResource = new GlobalSetLabelsRequest(); - * $project = 'project'; - * $resource = 'resource'; - * $operationResponse = $externalVpnGatewaysClient->setLabels($globalSetLabelsRequestResource, $project, $resource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $externalVpnGatewaysClient->setLabels($globalSetLabelsRequestResource, $project, $resource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $externalVpnGatewaysClient->resumeOperation($operationName, 'setLabels'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $externalVpnGatewaysClient->close(); - * } - * ``` - * - * @param GlobalSetLabelsRequest $globalSetLabelsRequestResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $resource Name or id of the resource for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 setLabels($globalSetLabelsRequestResource, $project, $resource, array $optionalArgs = []) - { - $request = new SetLabelsExternalVpnGatewayRequest(); - $requestParamHeaders = []; - $request->setGlobalSetLabelsRequestResource($globalSetLabelsRequestResource); - $request->setProject($project); - $request->setResource($resource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['resource'] = $resource; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('SetLabels', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns permissions that a caller has on the specified resource. - * - * Sample code: - * ``` - * $externalVpnGatewaysClient = new ExternalVpnGatewaysClient(); - * try { - * $project = 'project'; - * $resource = 'resource'; - * $testPermissionsRequestResource = new TestPermissionsRequest(); - * $response = $externalVpnGatewaysClient->testIamPermissions($project, $resource, $testPermissionsRequestResource); - * } finally { - * $externalVpnGatewaysClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $resource Name or id of the resource for this request. - * @param TestPermissionsRequest $testPermissionsRequestResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\TestPermissionsResponse - * - * @throws ApiException if the remote call fails - */ - public function testIamPermissions($project, $resource, $testPermissionsRequestResource, array $optionalArgs = []) - { - $request = new TestIamPermissionsExternalVpnGatewayRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setResource($resource); - $request->setTestPermissionsRequestResource($testPermissionsRequestResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['resource'] = $resource; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('TestIamPermissions', TestPermissionsResponse::class, $optionalArgs, $request)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/FirewallPoliciesGapicClient.php b/Compute/src/V1/Gapic/FirewallPoliciesGapicClient.php deleted file mode 100644 index c240731dc0bd..000000000000 --- a/Compute/src/V1/Gapic/FirewallPoliciesGapicClient.php +++ /dev/null @@ -1,1382 +0,0 @@ -addAssociation($firewallPolicy, $firewallPolicyAssociationResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $firewallPoliciesClient->addAssociation($firewallPolicy, $firewallPolicyAssociationResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $firewallPoliciesClient->resumeOperation($operationName, 'addAssociation'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $firewallPoliciesClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\FirewallPoliciesClient}. - */ -class FirewallPoliciesGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.FirewallPolicies'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/firewall_policies_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/firewall_policies_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/firewall_policies_rest_client_config.php', - ], - ], - 'operationsClientClass' => GlobalOrganizationOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an GlobalOrganizationOperationsClient object with the same endpoint as - * $this. - * - * @return GlobalOrganizationOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetGlobalOrganizationOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteGlobalOrganizationOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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); - } - - /** - * Inserts an association for the specified firewall policy. - * - * Sample code: - * ``` - * $firewallPoliciesClient = new FirewallPoliciesClient(); - * try { - * $firewallPolicy = 'firewall_policy'; - * $firewallPolicyAssociationResource = new FirewallPolicyAssociation(); - * $operationResponse = $firewallPoliciesClient->addAssociation($firewallPolicy, $firewallPolicyAssociationResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $firewallPoliciesClient->addAssociation($firewallPolicy, $firewallPolicyAssociationResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $firewallPoliciesClient->resumeOperation($operationName, 'addAssociation'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $firewallPoliciesClient->close(); - * } - * ``` - * - * @param string $firewallPolicy Name of the firewall policy to update. - * @param FirewallPolicyAssociation $firewallPolicyAssociationResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type bool $replaceExistingAssociation - * Indicates whether or not to replace it if an association of the attachment already exists. This is false by default, in which case an error will be returned if an association already exists. - * @type string $requestId - * 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. 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 addAssociation($firewallPolicy, $firewallPolicyAssociationResource, array $optionalArgs = []) - { - $request = new AddAssociationFirewallPolicyRequest(); - $requestParamHeaders = []; - $request->setFirewallPolicy($firewallPolicy); - $request->setFirewallPolicyAssociationResource($firewallPolicyAssociationResource); - $requestParamHeaders['firewall_policy'] = $firewallPolicy; - if (isset($optionalArgs['replaceExistingAssociation'])) { - $request->setReplaceExistingAssociation($optionalArgs['replaceExistingAssociation']); - } - - 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('AddAssociation', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Inserts a rule into a firewall policy. - * - * Sample code: - * ``` - * $firewallPoliciesClient = new FirewallPoliciesClient(); - * try { - * $firewallPolicy = 'firewall_policy'; - * $firewallPolicyRuleResource = new FirewallPolicyRule(); - * $operationResponse = $firewallPoliciesClient->addRule($firewallPolicy, $firewallPolicyRuleResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $firewallPoliciesClient->addRule($firewallPolicy, $firewallPolicyRuleResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $firewallPoliciesClient->resumeOperation($operationName, 'addRule'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $firewallPoliciesClient->close(); - * } - * ``` - * - * @param string $firewallPolicy Name of the firewall policy to update. - * @param FirewallPolicyRule $firewallPolicyRuleResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 addRule($firewallPolicy, $firewallPolicyRuleResource, array $optionalArgs = []) - { - $request = new AddRuleFirewallPolicyRequest(); - $requestParamHeaders = []; - $request->setFirewallPolicy($firewallPolicy); - $request->setFirewallPolicyRuleResource($firewallPolicyRuleResource); - $requestParamHeaders['firewall_policy'] = $firewallPolicy; - 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('AddRule', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Copies rules to the specified firewall policy. - * - * Sample code: - * ``` - * $firewallPoliciesClient = new FirewallPoliciesClient(); - * try { - * $firewallPolicy = 'firewall_policy'; - * $operationResponse = $firewallPoliciesClient->cloneRules($firewallPolicy); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $firewallPoliciesClient->cloneRules($firewallPolicy); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $firewallPoliciesClient->resumeOperation($operationName, 'cloneRules'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $firewallPoliciesClient->close(); - * } - * ``` - * - * @param string $firewallPolicy Name of the firewall policy to update. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 $sourceFirewallPolicy - * The firewall policy from which to copy rules. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 cloneRules($firewallPolicy, array $optionalArgs = []) - { - $request = new CloneRulesFirewallPolicyRequest(); - $requestParamHeaders = []; - $request->setFirewallPolicy($firewallPolicy); - $requestParamHeaders['firewall_policy'] = $firewallPolicy; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - if (isset($optionalArgs['sourceFirewallPolicy'])) { - $request->setSourceFirewallPolicy($optionalArgs['sourceFirewallPolicy']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('CloneRules', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Deletes the specified policy. - * - * Sample code: - * ``` - * $firewallPoliciesClient = new FirewallPoliciesClient(); - * try { - * $firewallPolicy = 'firewall_policy'; - * $operationResponse = $firewallPoliciesClient->delete($firewallPolicy); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $firewallPoliciesClient->delete($firewallPolicy); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $firewallPoliciesClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $firewallPoliciesClient->close(); - * } - * ``` - * - * @param string $firewallPolicy Name of the firewall policy to delete. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($firewallPolicy, array $optionalArgs = []) - { - $request = new DeleteFirewallPolicyRequest(); - $requestParamHeaders = []; - $request->setFirewallPolicy($firewallPolicy); - $requestParamHeaders['firewall_policy'] = $firewallPolicy; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns the specified firewall policy. - * - * Sample code: - * ``` - * $firewallPoliciesClient = new FirewallPoliciesClient(); - * try { - * $firewallPolicy = 'firewall_policy'; - * $response = $firewallPoliciesClient->get($firewallPolicy); - * } finally { - * $firewallPoliciesClient->close(); - * } - * ``` - * - * @param string $firewallPolicy Name of the firewall policy to get. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\FirewallPolicy - * - * @throws ApiException if the remote call fails - */ - public function get($firewallPolicy, array $optionalArgs = []) - { - $request = new GetFirewallPolicyRequest(); - $requestParamHeaders = []; - $request->setFirewallPolicy($firewallPolicy); - $requestParamHeaders['firewall_policy'] = $firewallPolicy; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', FirewallPolicy::class, $optionalArgs, $request)->wait(); - } - - /** - * Gets an association with the specified name. - * - * Sample code: - * ``` - * $firewallPoliciesClient = new FirewallPoliciesClient(); - * try { - * $firewallPolicy = 'firewall_policy'; - * $response = $firewallPoliciesClient->getAssociation($firewallPolicy); - * } finally { - * $firewallPoliciesClient->close(); - * } - * ``` - * - * @param string $firewallPolicy Name of the firewall policy to which the queried rule belongs. - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * The name of the association to get from the firewall policy. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\FirewallPolicyAssociation - * - * @throws ApiException if the remote call fails - */ - public function getAssociation($firewallPolicy, array $optionalArgs = []) - { - $request = new GetAssociationFirewallPolicyRequest(); - $requestParamHeaders = []; - $request->setFirewallPolicy($firewallPolicy); - $requestParamHeaders['firewall_policy'] = $firewallPolicy; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetAssociation', FirewallPolicyAssociation::class, $optionalArgs, $request)->wait(); - } - - /** - * Gets the access control policy for a resource. May be empty if no such policy or resource exists. - * - * Sample code: - * ``` - * $firewallPoliciesClient = new FirewallPoliciesClient(); - * try { - * $resource = 'resource'; - * $response = $firewallPoliciesClient->getIamPolicy($resource); - * } finally { - * $firewallPoliciesClient->close(); - * } - * ``` - * - * @param string $resource Name or id of the resource for this request. - * @param array $optionalArgs { - * Optional. - * - * @type int $optionsRequestedPolicyVersion - * Requested IAM Policy version. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function getIamPolicy($resource, array $optionalArgs = []) - { - $request = new GetIamPolicyFirewallPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['optionsRequestedPolicyVersion'])) { - $request->setOptionsRequestedPolicyVersion($optionalArgs['optionsRequestedPolicyVersion']); - } - - $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 a rule of the specified priority. - * - * Sample code: - * ``` - * $firewallPoliciesClient = new FirewallPoliciesClient(); - * try { - * $firewallPolicy = 'firewall_policy'; - * $response = $firewallPoliciesClient->getRule($firewallPolicy); - * } finally { - * $firewallPoliciesClient->close(); - * } - * ``` - * - * @param string $firewallPolicy Name of the firewall policy to which the queried rule belongs. - * @param array $optionalArgs { - * Optional. - * - * @type int $priority - * The priority of the rule to get from the firewall policy. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\FirewallPolicyRule - * - * @throws ApiException if the remote call fails - */ - public function getRule($firewallPolicy, array $optionalArgs = []) - { - $request = new GetRuleFirewallPolicyRequest(); - $requestParamHeaders = []; - $request->setFirewallPolicy($firewallPolicy); - $requestParamHeaders['firewall_policy'] = $firewallPolicy; - if (isset($optionalArgs['priority'])) { - $request->setPriority($optionalArgs['priority']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetRule', FirewallPolicyRule::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates a new policy in the specified project using the data included in the request. - * - * Sample code: - * ``` - * $firewallPoliciesClient = new FirewallPoliciesClient(); - * try { - * $firewallPolicyResource = new FirewallPolicy(); - * $parentId = 'parent_id'; - * $operationResponse = $firewallPoliciesClient->insert($firewallPolicyResource, $parentId); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $firewallPoliciesClient->insert($firewallPolicyResource, $parentId); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $firewallPoliciesClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $firewallPoliciesClient->close(); - * } - * ``` - * - * @param FirewallPolicy $firewallPolicyResource The body resource for this request - * @param string $parentId Parent ID for this request. The ID can be either be "folders/[FOLDER_ID]" if the parent is a folder or "organizations/[ORGANIZATION_ID]" if the parent is an organization. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 insert($firewallPolicyResource, $parentId, array $optionalArgs = []) - { - $request = new InsertFirewallPolicyRequest(); - $request->setFirewallPolicyResource($firewallPolicyResource); - $request->setParentId($parentId); - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - return $this->startOperationsCall('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Lists all the policies that have been configured for the specified folder or organization. - * - * Sample code: - * ``` - * $firewallPoliciesClient = new FirewallPoliciesClient(); - * try { - * // Iterate over pages of elements - * $pagedResponse = $firewallPoliciesClient->list(); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $firewallPoliciesClient->list(); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $firewallPoliciesClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $parentId - * Parent ID for this request. The ID can be either be "folders/[FOLDER_ID]" if the parent is a folder or "organizations/[ORGANIZATION_ID]" if the parent is an organization. - * @type bool $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list(array $optionalArgs = []) - { - $request = new ListFirewallPoliciesRequest(); - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['parentId'])) { - $request->setParentId($optionalArgs['parentId']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - return $this->getPagedListResponse('List', $optionalArgs, FirewallPolicyList::class, $request); - } - - /** - * Lists associations of a specified target, i.e., organization or folder. - * - * Sample code: - * ``` - * $firewallPoliciesClient = new FirewallPoliciesClient(); - * try { - * $response = $firewallPoliciesClient->listAssociations(); - * } finally { - * $firewallPoliciesClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $targetResource - * The target resource to list associations. It is an organization, or a folder. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\FirewallPoliciesListAssociationsResponse - * - * @throws ApiException if the remote call fails - */ - public function listAssociations(array $optionalArgs = []) - { - $request = new ListAssociationsFirewallPolicyRequest(); - if (isset($optionalArgs['targetResource'])) { - $request->setTargetResource($optionalArgs['targetResource']); - } - - return $this->startCall('ListAssociations', FirewallPoliciesListAssociationsResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Moves the specified firewall policy. - * - * Sample code: - * ``` - * $firewallPoliciesClient = new FirewallPoliciesClient(); - * try { - * $firewallPolicy = 'firewall_policy'; - * $parentId = 'parent_id'; - * $operationResponse = $firewallPoliciesClient->move($firewallPolicy, $parentId); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $firewallPoliciesClient->move($firewallPolicy, $parentId); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $firewallPoliciesClient->resumeOperation($operationName, 'move'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $firewallPoliciesClient->close(); - * } - * ``` - * - * @param string $firewallPolicy Name of the firewall policy to update. - * @param string $parentId The new parent of the firewall policy. The ID can be either be "folders/[FOLDER_ID]" if the parent is a folder or "organizations/[ORGANIZATION_ID]" if the parent is an organization. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 move($firewallPolicy, $parentId, array $optionalArgs = []) - { - $request = new MoveFirewallPolicyRequest(); - $requestParamHeaders = []; - $request->setFirewallPolicy($firewallPolicy); - $request->setParentId($parentId); - $requestParamHeaders['firewall_policy'] = $firewallPolicy; - 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('Move', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Patches the specified policy with the data included in the request. - * - * Sample code: - * ``` - * $firewallPoliciesClient = new FirewallPoliciesClient(); - * try { - * $firewallPolicy = 'firewall_policy'; - * $firewallPolicyResource = new FirewallPolicy(); - * $operationResponse = $firewallPoliciesClient->patch($firewallPolicy, $firewallPolicyResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $firewallPoliciesClient->patch($firewallPolicy, $firewallPolicyResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $firewallPoliciesClient->resumeOperation($operationName, 'patch'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $firewallPoliciesClient->close(); - * } - * ``` - * - * @param string $firewallPolicy Name of the firewall policy to update. - * @param FirewallPolicy $firewallPolicyResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 patch($firewallPolicy, $firewallPolicyResource, array $optionalArgs = []) - { - $request = new PatchFirewallPolicyRequest(); - $requestParamHeaders = []; - $request->setFirewallPolicy($firewallPolicy); - $request->setFirewallPolicyResource($firewallPolicyResource); - $requestParamHeaders['firewall_policy'] = $firewallPolicy; - 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('Patch', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Patches a rule of the specified priority. - * - * Sample code: - * ``` - * $firewallPoliciesClient = new FirewallPoliciesClient(); - * try { - * $firewallPolicy = 'firewall_policy'; - * $firewallPolicyRuleResource = new FirewallPolicyRule(); - * $operationResponse = $firewallPoliciesClient->patchRule($firewallPolicy, $firewallPolicyRuleResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $firewallPoliciesClient->patchRule($firewallPolicy, $firewallPolicyRuleResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $firewallPoliciesClient->resumeOperation($operationName, 'patchRule'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $firewallPoliciesClient->close(); - * } - * ``` - * - * @param string $firewallPolicy Name of the firewall policy to update. - * @param FirewallPolicyRule $firewallPolicyRuleResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type int $priority - * The priority of the rule to patch. - * @type string $requestId - * 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. 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 patchRule($firewallPolicy, $firewallPolicyRuleResource, array $optionalArgs = []) - { - $request = new PatchRuleFirewallPolicyRequest(); - $requestParamHeaders = []; - $request->setFirewallPolicy($firewallPolicy); - $request->setFirewallPolicyRuleResource($firewallPolicyRuleResource); - $requestParamHeaders['firewall_policy'] = $firewallPolicy; - if (isset($optionalArgs['priority'])) { - $request->setPriority($optionalArgs['priority']); - } - - 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('PatchRule', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Removes an association for the specified firewall policy. - * - * Sample code: - * ``` - * $firewallPoliciesClient = new FirewallPoliciesClient(); - * try { - * $firewallPolicy = 'firewall_policy'; - * $operationResponse = $firewallPoliciesClient->removeAssociation($firewallPolicy); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $firewallPoliciesClient->removeAssociation($firewallPolicy); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $firewallPoliciesClient->resumeOperation($operationName, 'removeAssociation'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $firewallPoliciesClient->close(); - * } - * ``` - * - * @param string $firewallPolicy Name of the firewall policy to update. - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * Name for the attachment that will be removed. - * @type string $requestId - * 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. 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 removeAssociation($firewallPolicy, array $optionalArgs = []) - { - $request = new RemoveAssociationFirewallPolicyRequest(); - $requestParamHeaders = []; - $request->setFirewallPolicy($firewallPolicy); - $requestParamHeaders['firewall_policy'] = $firewallPolicy; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['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('RemoveAssociation', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Deletes a rule of the specified priority. - * - * Sample code: - * ``` - * $firewallPoliciesClient = new FirewallPoliciesClient(); - * try { - * $firewallPolicy = 'firewall_policy'; - * $operationResponse = $firewallPoliciesClient->removeRule($firewallPolicy); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $firewallPoliciesClient->removeRule($firewallPolicy); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $firewallPoliciesClient->resumeOperation($operationName, 'removeRule'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $firewallPoliciesClient->close(); - * } - * ``` - * - * @param string $firewallPolicy Name of the firewall policy to update. - * @param array $optionalArgs { - * Optional. - * - * @type int $priority - * The priority of the rule to remove from the firewall policy. - * @type string $requestId - * 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. 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 removeRule($firewallPolicy, array $optionalArgs = []) - { - $request = new RemoveRuleFirewallPolicyRequest(); - $requestParamHeaders = []; - $request->setFirewallPolicy($firewallPolicy); - $requestParamHeaders['firewall_policy'] = $firewallPolicy; - if (isset($optionalArgs['priority'])) { - $request->setPriority($optionalArgs['priority']); - } - - 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('RemoveRule', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Sets the access control policy on the specified resource. Replaces any existing policy. - * - * Sample code: - * ``` - * $firewallPoliciesClient = new FirewallPoliciesClient(); - * try { - * $globalOrganizationSetPolicyRequestResource = new GlobalOrganizationSetPolicyRequest(); - * $resource = 'resource'; - * $response = $firewallPoliciesClient->setIamPolicy($globalOrganizationSetPolicyRequestResource, $resource); - * } finally { - * $firewallPoliciesClient->close(); - * } - * ``` - * - * @param GlobalOrganizationSetPolicyRequest $globalOrganizationSetPolicyRequestResource The body resource for this request - * @param string $resource Name or id of the resource for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function setIamPolicy($globalOrganizationSetPolicyRequestResource, $resource, array $optionalArgs = []) - { - $request = new SetIamPolicyFirewallPolicyRequest(); - $requestParamHeaders = []; - $request->setGlobalOrganizationSetPolicyRequestResource($globalOrganizationSetPolicyRequestResource); - $request->setResource($resource); - $requestParamHeaders['resource'] = $resource; - $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 resource. - * - * Sample code: - * ``` - * $firewallPoliciesClient = new FirewallPoliciesClient(); - * try { - * $resource = 'resource'; - * $testPermissionsRequestResource = new TestPermissionsRequest(); - * $response = $firewallPoliciesClient->testIamPermissions($resource, $testPermissionsRequestResource); - * } finally { - * $firewallPoliciesClient->close(); - * } - * ``` - * - * @param string $resource Name or id of the resource for this request. - * @param TestPermissionsRequest $testPermissionsRequestResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\TestPermissionsResponse - * - * @throws ApiException if the remote call fails - */ - public function testIamPermissions($resource, $testPermissionsRequestResource, array $optionalArgs = []) - { - $request = new TestIamPermissionsFirewallPolicyRequest(); - $requestParamHeaders = []; - $request->setResource($resource); - $request->setTestPermissionsRequestResource($testPermissionsRequestResource); - $requestParamHeaders['resource'] = $resource; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('TestIamPermissions', TestPermissionsResponse::class, $optionalArgs, $request)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/FirewallsGapicClient.php b/Compute/src/V1/Gapic/FirewallsGapicClient.php deleted file mode 100644 index a66d582ffadd..000000000000 --- a/Compute/src/V1/Gapic/FirewallsGapicClient.php +++ /dev/null @@ -1,681 +0,0 @@ -delete($firewall, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $firewallsClient->delete($firewall, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $firewallsClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $firewallsClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\FirewallsClient}. - */ -class FirewallsGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.Firewalls'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/firewalls_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/firewalls_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/firewalls_rest_client_config.php', - ], - ], - 'operationsClientClass' => GlobalOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an GlobalOperationsClient object with the same endpoint as $this. - * - * @return GlobalOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetGlobalOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteGlobalOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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 the specified firewall. - * - * Sample code: - * ``` - * $firewallsClient = new FirewallsClient(); - * try { - * $firewall = 'firewall'; - * $project = 'project'; - * $operationResponse = $firewallsClient->delete($firewall, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $firewallsClient->delete($firewall, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $firewallsClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $firewallsClient->close(); - * } - * ``` - * - * @param string $firewall Name of the firewall rule to delete. - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($firewall, $project, array $optionalArgs = []) - { - $request = new DeleteFirewallRequest(); - $requestParamHeaders = []; - $request->setFirewall($firewall); - $request->setProject($project); - $requestParamHeaders['firewall'] = $firewall; - $requestParamHeaders['project'] = $project; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns the specified firewall. - * - * Sample code: - * ``` - * $firewallsClient = new FirewallsClient(); - * try { - * $firewall = 'firewall'; - * $project = 'project'; - * $response = $firewallsClient->get($firewall, $project); - * } finally { - * $firewallsClient->close(); - * } - * ``` - * - * @param string $firewall Name of the firewall rule to return. - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Firewall - * - * @throws ApiException if the remote call fails - */ - public function get($firewall, $project, array $optionalArgs = []) - { - $request = new GetFirewallRequest(); - $requestParamHeaders = []; - $request->setFirewall($firewall); - $request->setProject($project); - $requestParamHeaders['firewall'] = $firewall; - $requestParamHeaders['project'] = $project; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', Firewall::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates a firewall rule in the specified project using the data included in the request. - * - * Sample code: - * ``` - * $firewallsClient = new FirewallsClient(); - * try { - * $firewallResource = new Firewall(); - * $project = 'project'; - * $operationResponse = $firewallsClient->insert($firewallResource, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $firewallsClient->insert($firewallResource, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $firewallsClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $firewallsClient->close(); - * } - * ``` - * - * @param Firewall $firewallResource The body resource for this request - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 insert($firewallResource, $project, array $optionalArgs = []) - { - $request = new InsertFirewallRequest(); - $requestParamHeaders = []; - $request->setFirewallResource($firewallResource); - $request->setProject($project); - $requestParamHeaders['project'] = $project; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Retrieves the list of firewall rules available to the specified project. - * - * Sample code: - * ``` - * $firewallsClient = new FirewallsClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $firewallsClient->list($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $firewallsClient->list($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $firewallsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, array $optionalArgs = []) - { - $request = new ListFirewallsRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, FirewallList::class, $request); - } - - /** - * Updates the specified firewall rule with the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. - * - * Sample code: - * ``` - * $firewallsClient = new FirewallsClient(); - * try { - * $firewall = 'firewall'; - * $firewallResource = new Firewall(); - * $project = 'project'; - * $operationResponse = $firewallsClient->patch($firewall, $firewallResource, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $firewallsClient->patch($firewall, $firewallResource, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $firewallsClient->resumeOperation($operationName, 'patch'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $firewallsClient->close(); - * } - * ``` - * - * @param string $firewall Name of the firewall rule to patch. - * @param Firewall $firewallResource The body resource for this request - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 patch($firewall, $firewallResource, $project, array $optionalArgs = []) - { - $request = new PatchFirewallRequest(); - $requestParamHeaders = []; - $request->setFirewall($firewall); - $request->setFirewallResource($firewallResource); - $request->setProject($project); - $requestParamHeaders['firewall'] = $firewall; - $requestParamHeaders['project'] = $project; - 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('Patch', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Updates the specified firewall rule with the data included in the request. Note that all fields will be updated if using PUT, even fields that are not specified. To update individual fields, please use PATCH instead. - * - * Sample code: - * ``` - * $firewallsClient = new FirewallsClient(); - * try { - * $firewall = 'firewall'; - * $firewallResource = new Firewall(); - * $project = 'project'; - * $operationResponse = $firewallsClient->update($firewall, $firewallResource, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $firewallsClient->update($firewall, $firewallResource, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $firewallsClient->resumeOperation($operationName, 'update'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $firewallsClient->close(); - * } - * ``` - * - * @param string $firewall Name of the firewall rule to update. - * @param Firewall $firewallResource The body resource for this request - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 update($firewall, $firewallResource, $project, array $optionalArgs = []) - { - $request = new UpdateFirewallRequest(); - $requestParamHeaders = []; - $request->setFirewall($firewall); - $request->setFirewallResource($firewallResource); - $request->setProject($project); - $requestParamHeaders['firewall'] = $firewall; - $requestParamHeaders['project'] = $project; - 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('Update', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/ForwardingRulesGapicClient.php b/Compute/src/V1/Gapic/ForwardingRulesGapicClient.php deleted file mode 100644 index 026f0e1b90a5..000000000000 --- a/Compute/src/V1/Gapic/ForwardingRulesGapicClient.php +++ /dev/null @@ -1,874 +0,0 @@ -aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $forwardingRulesClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $forwardingRulesClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\ForwardingRulesClient}. - */ -class ForwardingRulesGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.ForwardingRules'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/forwarding_rules_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/forwarding_rules_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/forwarding_rules_rest_client_config.php', - ], - ], - 'operationsClientClass' => RegionOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an RegionOperationsClient object with the same endpoint as $this. - * - * @return RegionOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetRegionOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteRegionOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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); - } - - /** - * Retrieves an aggregated list of forwarding rules. To prevent failure, Google recommends that you set the `returnPartialSuccess` parameter to `true`. - * - * Sample code: - * ``` - * $forwardingRulesClient = new ForwardingRulesClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $forwardingRulesClient->aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $forwardingRulesClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $forwardingRulesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type bool $includeAllScopes - * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type int $serviceProjectNumber - * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable 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 aggregatedList($project, array $optionalArgs = []) - { - $request = new AggregatedListForwardingRulesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['includeAllScopes'])) { - $request->setIncludeAllScopes($optionalArgs['includeAllScopes']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - if (isset($optionalArgs['serviceProjectNumber'])) { - $request->setServiceProjectNumber($optionalArgs['serviceProjectNumber']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('AggregatedList', $optionalArgs, ForwardingRuleAggregatedList::class, $request); - } - - /** - * Deletes the specified ForwardingRule resource. - * - * Sample code: - * ``` - * $forwardingRulesClient = new ForwardingRulesClient(); - * try { - * $forwardingRule = 'forwarding_rule'; - * $project = 'project'; - * $region = 'region'; - * $operationResponse = $forwardingRulesClient->delete($forwardingRule, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $forwardingRulesClient->delete($forwardingRule, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $forwardingRulesClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $forwardingRulesClient->close(); - * } - * ``` - * - * @param string $forwardingRule Name of the ForwardingRule resource to delete. - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($forwardingRule, $project, $region, array $optionalArgs = []) - { - $request = new DeleteForwardingRuleRequest(); - $requestParamHeaders = []; - $request->setForwardingRule($forwardingRule); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['forwarding_rule'] = $forwardingRule; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns the specified ForwardingRule resource. - * - * Sample code: - * ``` - * $forwardingRulesClient = new ForwardingRulesClient(); - * try { - * $forwardingRule = 'forwarding_rule'; - * $project = 'project'; - * $region = 'region'; - * $response = $forwardingRulesClient->get($forwardingRule, $project, $region); - * } finally { - * $forwardingRulesClient->close(); - * } - * ``` - * - * @param string $forwardingRule Name of the ForwardingRule resource to return. - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\ForwardingRule - * - * @throws ApiException if the remote call fails - */ - public function get($forwardingRule, $project, $region, array $optionalArgs = []) - { - $request = new GetForwardingRuleRequest(); - $requestParamHeaders = []; - $request->setForwardingRule($forwardingRule); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['forwarding_rule'] = $forwardingRule; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', ForwardingRule::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates a ForwardingRule resource in the specified project and region using the data included in the request. - * - * Sample code: - * ``` - * $forwardingRulesClient = new ForwardingRulesClient(); - * try { - * $forwardingRuleResource = new ForwardingRule(); - * $project = 'project'; - * $region = 'region'; - * $operationResponse = $forwardingRulesClient->insert($forwardingRuleResource, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $forwardingRulesClient->insert($forwardingRuleResource, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $forwardingRulesClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $forwardingRulesClient->close(); - * } - * ``` - * - * @param ForwardingRule $forwardingRuleResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 insert($forwardingRuleResource, $project, $region, array $optionalArgs = []) - { - $request = new InsertForwardingRuleRequest(); - $requestParamHeaders = []; - $request->setForwardingRuleResource($forwardingRuleResource); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Retrieves a list of ForwardingRule resources available to the specified project and region. - * - * Sample code: - * ``` - * $forwardingRulesClient = new ForwardingRulesClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * // Iterate over pages of elements - * $pagedResponse = $forwardingRulesClient->list($project, $region); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $forwardingRulesClient->list($project, $region); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $forwardingRulesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, $region, array $optionalArgs = []) - { - $request = new ListForwardingRulesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, ForwardingRuleList::class, $request); - } - - /** - * Updates the specified forwarding rule with the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. Currently, you can only patch the network_tier field. - * - * Sample code: - * ``` - * $forwardingRulesClient = new ForwardingRulesClient(); - * try { - * $forwardingRule = 'forwarding_rule'; - * $forwardingRuleResource = new ForwardingRule(); - * $project = 'project'; - * $region = 'region'; - * $operationResponse = $forwardingRulesClient->patch($forwardingRule, $forwardingRuleResource, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $forwardingRulesClient->patch($forwardingRule, $forwardingRuleResource, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $forwardingRulesClient->resumeOperation($operationName, 'patch'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $forwardingRulesClient->close(); - * } - * ``` - * - * @param string $forwardingRule Name of the ForwardingRule resource to patch. - * @param ForwardingRule $forwardingRuleResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 patch($forwardingRule, $forwardingRuleResource, $project, $region, array $optionalArgs = []) - { - $request = new PatchForwardingRuleRequest(); - $requestParamHeaders = []; - $request->setForwardingRule($forwardingRule); - $request->setForwardingRuleResource($forwardingRuleResource); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['forwarding_rule'] = $forwardingRule; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('Patch', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Sets the labels on the specified resource. To learn more about labels, read the Labeling Resources documentation. - * - * Sample code: - * ``` - * $forwardingRulesClient = new ForwardingRulesClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $regionSetLabelsRequestResource = new RegionSetLabelsRequest(); - * $resource = 'resource'; - * $operationResponse = $forwardingRulesClient->setLabels($project, $region, $regionSetLabelsRequestResource, $resource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $forwardingRulesClient->setLabels($project, $region, $regionSetLabelsRequestResource, $resource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $forwardingRulesClient->resumeOperation($operationName, 'setLabels'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $forwardingRulesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region The region for this request. - * @param RegionSetLabelsRequest $regionSetLabelsRequestResource The body resource for this request - * @param string $resource Name or id of the resource for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 setLabels($project, $region, $regionSetLabelsRequestResource, $resource, array $optionalArgs = []) - { - $request = new SetLabelsForwardingRuleRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setRegionSetLabelsRequestResource($regionSetLabelsRequestResource); - $request->setResource($resource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['resource'] = $resource; - 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('SetLabels', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Changes target URL for forwarding rule. The new target should be of the same type as the old target. - * - * Sample code: - * ``` - * $forwardingRulesClient = new ForwardingRulesClient(); - * try { - * $forwardingRule = 'forwarding_rule'; - * $project = 'project'; - * $region = 'region'; - * $targetReferenceResource = new TargetReference(); - * $operationResponse = $forwardingRulesClient->setTarget($forwardingRule, $project, $region, $targetReferenceResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $forwardingRulesClient->setTarget($forwardingRule, $project, $region, $targetReferenceResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $forwardingRulesClient->resumeOperation($operationName, 'setTarget'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $forwardingRulesClient->close(); - * } - * ``` - * - * @param string $forwardingRule Name of the ForwardingRule resource in which target is to be set. - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param TargetReference $targetReferenceResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 setTarget($forwardingRule, $project, $region, $targetReferenceResource, array $optionalArgs = []) - { - $request = new SetTargetForwardingRuleRequest(); - $requestParamHeaders = []; - $request->setForwardingRule($forwardingRule); - $request->setProject($project); - $request->setRegion($region); - $request->setTargetReferenceResource($targetReferenceResource); - $requestParamHeaders['forwarding_rule'] = $forwardingRule; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('SetTarget', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/GlobalAddressesGapicClient.php b/Compute/src/V1/Gapic/GlobalAddressesGapicClient.php deleted file mode 100644 index 099fa9936a72..000000000000 --- a/Compute/src/V1/Gapic/GlobalAddressesGapicClient.php +++ /dev/null @@ -1,677 +0,0 @@ -delete($address, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $globalAddressesClient->delete($address, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $globalAddressesClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $globalAddressesClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\GlobalAddressesClient}. - */ -class GlobalAddressesGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.GlobalAddresses'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/global_addresses_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/global_addresses_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/global_addresses_rest_client_config.php', - ], - ], - 'operationsClientClass' => GlobalOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an GlobalOperationsClient object with the same endpoint as $this. - * - * @return GlobalOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetGlobalOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteGlobalOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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 the specified address resource. - * - * Sample code: - * ``` - * $globalAddressesClient = new GlobalAddressesClient(); - * try { - * $address = 'address'; - * $project = 'project'; - * $operationResponse = $globalAddressesClient->delete($address, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $globalAddressesClient->delete($address, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $globalAddressesClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $globalAddressesClient->close(); - * } - * ``` - * - * @param string $address Name of the address resource to delete. - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($address, $project, array $optionalArgs = []) - { - $request = new DeleteGlobalAddressRequest(); - $requestParamHeaders = []; - $request->setAddress($address); - $request->setProject($project); - $requestParamHeaders['address'] = $address; - $requestParamHeaders['project'] = $project; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns the specified address resource. - * - * Sample code: - * ``` - * $globalAddressesClient = new GlobalAddressesClient(); - * try { - * $address = 'address'; - * $project = 'project'; - * $response = $globalAddressesClient->get($address, $project); - * } finally { - * $globalAddressesClient->close(); - * } - * ``` - * - * @param string $address Name of the address resource to return. - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Address - * - * @throws ApiException if the remote call fails - */ - public function get($address, $project, array $optionalArgs = []) - { - $request = new GetGlobalAddressRequest(); - $requestParamHeaders = []; - $request->setAddress($address); - $request->setProject($project); - $requestParamHeaders['address'] = $address; - $requestParamHeaders['project'] = $project; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', Address::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates an address resource in the specified project by using the data included in the request. - * - * Sample code: - * ``` - * $globalAddressesClient = new GlobalAddressesClient(); - * try { - * $addressResource = new Address(); - * $project = 'project'; - * $operationResponse = $globalAddressesClient->insert($addressResource, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $globalAddressesClient->insert($addressResource, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $globalAddressesClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $globalAddressesClient->close(); - * } - * ``` - * - * @param Address $addressResource The body resource for this request - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 insert($addressResource, $project, array $optionalArgs = []) - { - $request = new InsertGlobalAddressRequest(); - $requestParamHeaders = []; - $request->setAddressResource($addressResource); - $request->setProject($project); - $requestParamHeaders['project'] = $project; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Retrieves a list of global addresses. - * - * Sample code: - * ``` - * $globalAddressesClient = new GlobalAddressesClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $globalAddressesClient->list($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $globalAddressesClient->list($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $globalAddressesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, array $optionalArgs = []) - { - $request = new ListGlobalAddressesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, AddressList::class, $request); - } - - /** - * Moves the specified address resource from one project to another project. - * - * Sample code: - * ``` - * $globalAddressesClient = new GlobalAddressesClient(); - * try { - * $address = 'address'; - * $globalAddressesMoveRequestResource = new GlobalAddressesMoveRequest(); - * $project = 'project'; - * $operationResponse = $globalAddressesClient->move($address, $globalAddressesMoveRequestResource, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $globalAddressesClient->move($address, $globalAddressesMoveRequestResource, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $globalAddressesClient->resumeOperation($operationName, 'move'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $globalAddressesClient->close(); - * } - * ``` - * - * @param string $address Name of the address resource to move. - * @param GlobalAddressesMoveRequest $globalAddressesMoveRequestResource The body resource for this request - * @param string $project Source project ID which the Address is moved from. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 move($address, $globalAddressesMoveRequestResource, $project, array $optionalArgs = []) - { - $request = new MoveGlobalAddressRequest(); - $requestParamHeaders = []; - $request->setAddress($address); - $request->setGlobalAddressesMoveRequestResource($globalAddressesMoveRequestResource); - $request->setProject($project); - $requestParamHeaders['address'] = $address; - $requestParamHeaders['project'] = $project; - 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('Move', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Sets the labels on a GlobalAddress. To learn more about labels, read the Labeling Resources documentation. - * - * Sample code: - * ``` - * $globalAddressesClient = new GlobalAddressesClient(); - * try { - * $globalSetLabelsRequestResource = new GlobalSetLabelsRequest(); - * $project = 'project'; - * $resource = 'resource'; - * $operationResponse = $globalAddressesClient->setLabels($globalSetLabelsRequestResource, $project, $resource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $globalAddressesClient->setLabels($globalSetLabelsRequestResource, $project, $resource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $globalAddressesClient->resumeOperation($operationName, 'setLabels'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $globalAddressesClient->close(); - * } - * ``` - * - * @param GlobalSetLabelsRequest $globalSetLabelsRequestResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $resource Name or id of the resource for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 setLabels($globalSetLabelsRequestResource, $project, $resource, array $optionalArgs = []) - { - $request = new SetLabelsGlobalAddressRequest(); - $requestParamHeaders = []; - $request->setGlobalSetLabelsRequestResource($globalSetLabelsRequestResource); - $request->setProject($project); - $request->setResource($resource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['resource'] = $resource; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('SetLabels', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/GlobalForwardingRulesGapicClient.php b/Compute/src/V1/Gapic/GlobalForwardingRulesGapicClient.php deleted file mode 100644 index ae7f8584a7fe..000000000000 --- a/Compute/src/V1/Gapic/GlobalForwardingRulesGapicClient.php +++ /dev/null @@ -1,753 +0,0 @@ -delete($forwardingRule, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $globalForwardingRulesClient->delete($forwardingRule, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $globalForwardingRulesClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $globalForwardingRulesClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\GlobalForwardingRulesClient}. - */ -class GlobalForwardingRulesGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.GlobalForwardingRules'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/global_forwarding_rules_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/global_forwarding_rules_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/global_forwarding_rules_rest_client_config.php', - ], - ], - 'operationsClientClass' => GlobalOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an GlobalOperationsClient object with the same endpoint as $this. - * - * @return GlobalOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetGlobalOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteGlobalOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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 the specified GlobalForwardingRule resource. - * - * Sample code: - * ``` - * $globalForwardingRulesClient = new GlobalForwardingRulesClient(); - * try { - * $forwardingRule = 'forwarding_rule'; - * $project = 'project'; - * $operationResponse = $globalForwardingRulesClient->delete($forwardingRule, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $globalForwardingRulesClient->delete($forwardingRule, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $globalForwardingRulesClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $globalForwardingRulesClient->close(); - * } - * ``` - * - * @param string $forwardingRule Name of the ForwardingRule resource to delete. - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($forwardingRule, $project, array $optionalArgs = []) - { - $request = new DeleteGlobalForwardingRuleRequest(); - $requestParamHeaders = []; - $request->setForwardingRule($forwardingRule); - $request->setProject($project); - $requestParamHeaders['forwarding_rule'] = $forwardingRule; - $requestParamHeaders['project'] = $project; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns the specified GlobalForwardingRule resource. Gets a list of available forwarding rules by making a list() request. - * - * Sample code: - * ``` - * $globalForwardingRulesClient = new GlobalForwardingRulesClient(); - * try { - * $forwardingRule = 'forwarding_rule'; - * $project = 'project'; - * $response = $globalForwardingRulesClient->get($forwardingRule, $project); - * } finally { - * $globalForwardingRulesClient->close(); - * } - * ``` - * - * @param string $forwardingRule Name of the ForwardingRule resource to return. - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\ForwardingRule - * - * @throws ApiException if the remote call fails - */ - public function get($forwardingRule, $project, array $optionalArgs = []) - { - $request = new GetGlobalForwardingRuleRequest(); - $requestParamHeaders = []; - $request->setForwardingRule($forwardingRule); - $request->setProject($project); - $requestParamHeaders['forwarding_rule'] = $forwardingRule; - $requestParamHeaders['project'] = $project; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', ForwardingRule::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates a GlobalForwardingRule resource in the specified project using the data included in the request. - * - * Sample code: - * ``` - * $globalForwardingRulesClient = new GlobalForwardingRulesClient(); - * try { - * $forwardingRuleResource = new ForwardingRule(); - * $project = 'project'; - * $operationResponse = $globalForwardingRulesClient->insert($forwardingRuleResource, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $globalForwardingRulesClient->insert($forwardingRuleResource, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $globalForwardingRulesClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $globalForwardingRulesClient->close(); - * } - * ``` - * - * @param ForwardingRule $forwardingRuleResource The body resource for this request - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 insert($forwardingRuleResource, $project, array $optionalArgs = []) - { - $request = new InsertGlobalForwardingRuleRequest(); - $requestParamHeaders = []; - $request->setForwardingRuleResource($forwardingRuleResource); - $request->setProject($project); - $requestParamHeaders['project'] = $project; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Retrieves a list of GlobalForwardingRule resources available to the specified project. - * - * Sample code: - * ``` - * $globalForwardingRulesClient = new GlobalForwardingRulesClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $globalForwardingRulesClient->list($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $globalForwardingRulesClient->list($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $globalForwardingRulesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, array $optionalArgs = []) - { - $request = new ListGlobalForwardingRulesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, ForwardingRuleList::class, $request); - } - - /** - * Updates the specified forwarding rule with the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. Currently, you can only patch the network_tier field. - * - * Sample code: - * ``` - * $globalForwardingRulesClient = new GlobalForwardingRulesClient(); - * try { - * $forwardingRule = 'forwarding_rule'; - * $forwardingRuleResource = new ForwardingRule(); - * $project = 'project'; - * $operationResponse = $globalForwardingRulesClient->patch($forwardingRule, $forwardingRuleResource, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $globalForwardingRulesClient->patch($forwardingRule, $forwardingRuleResource, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $globalForwardingRulesClient->resumeOperation($operationName, 'patch'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $globalForwardingRulesClient->close(); - * } - * ``` - * - * @param string $forwardingRule Name of the ForwardingRule resource to patch. - * @param ForwardingRule $forwardingRuleResource The body resource for this request - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 patch($forwardingRule, $forwardingRuleResource, $project, array $optionalArgs = []) - { - $request = new PatchGlobalForwardingRuleRequest(); - $requestParamHeaders = []; - $request->setForwardingRule($forwardingRule); - $request->setForwardingRuleResource($forwardingRuleResource); - $request->setProject($project); - $requestParamHeaders['forwarding_rule'] = $forwardingRule; - $requestParamHeaders['project'] = $project; - 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('Patch', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Sets the labels on the specified resource. To learn more about labels, read the Labeling resources documentation. - * - * Sample code: - * ``` - * $globalForwardingRulesClient = new GlobalForwardingRulesClient(); - * try { - * $globalSetLabelsRequestResource = new GlobalSetLabelsRequest(); - * $project = 'project'; - * $resource = 'resource'; - * $operationResponse = $globalForwardingRulesClient->setLabels($globalSetLabelsRequestResource, $project, $resource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $globalForwardingRulesClient->setLabels($globalSetLabelsRequestResource, $project, $resource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $globalForwardingRulesClient->resumeOperation($operationName, 'setLabels'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $globalForwardingRulesClient->close(); - * } - * ``` - * - * @param GlobalSetLabelsRequest $globalSetLabelsRequestResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $resource Name or id of the resource for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 setLabels($globalSetLabelsRequestResource, $project, $resource, array $optionalArgs = []) - { - $request = new SetLabelsGlobalForwardingRuleRequest(); - $requestParamHeaders = []; - $request->setGlobalSetLabelsRequestResource($globalSetLabelsRequestResource); - $request->setProject($project); - $request->setResource($resource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['resource'] = $resource; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('SetLabels', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Changes target URL for the GlobalForwardingRule resource. The new target should be of the same type as the old target. - * - * Sample code: - * ``` - * $globalForwardingRulesClient = new GlobalForwardingRulesClient(); - * try { - * $forwardingRule = 'forwarding_rule'; - * $project = 'project'; - * $targetReferenceResource = new TargetReference(); - * $operationResponse = $globalForwardingRulesClient->setTarget($forwardingRule, $project, $targetReferenceResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $globalForwardingRulesClient->setTarget($forwardingRule, $project, $targetReferenceResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $globalForwardingRulesClient->resumeOperation($operationName, 'setTarget'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $globalForwardingRulesClient->close(); - * } - * ``` - * - * @param string $forwardingRule Name of the ForwardingRule resource in which target is to be set. - * @param string $project Project ID for this request. - * @param TargetReference $targetReferenceResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 setTarget($forwardingRule, $project, $targetReferenceResource, array $optionalArgs = []) - { - $request = new SetTargetGlobalForwardingRuleRequest(); - $requestParamHeaders = []; - $request->setForwardingRule($forwardingRule); - $request->setProject($project); - $request->setTargetReferenceResource($targetReferenceResource); - $requestParamHeaders['forwarding_rule'] = $forwardingRule; - $requestParamHeaders['project'] = $project; - 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('SetTarget', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/GlobalNetworkEndpointGroupsGapicClient.php b/Compute/src/V1/Gapic/GlobalNetworkEndpointGroupsGapicClient.php deleted file mode 100644 index 7ad43c65e519..000000000000 --- a/Compute/src/V1/Gapic/GlobalNetworkEndpointGroupsGapicClient.php +++ /dev/null @@ -1,774 +0,0 @@ -attachNetworkEndpoints($globalNetworkEndpointGroupsAttachEndpointsRequestResource, $networkEndpointGroup, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $globalNetworkEndpointGroupsClient->attachNetworkEndpoints($globalNetworkEndpointGroupsAttachEndpointsRequestResource, $networkEndpointGroup, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $globalNetworkEndpointGroupsClient->resumeOperation($operationName, 'attachNetworkEndpoints'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $globalNetworkEndpointGroupsClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\GlobalNetworkEndpointGroupsClient}. - */ -class GlobalNetworkEndpointGroupsGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.GlobalNetworkEndpointGroups'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/global_network_endpoint_groups_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/global_network_endpoint_groups_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/global_network_endpoint_groups_rest_client_config.php', - ], - ], - 'operationsClientClass' => GlobalOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an GlobalOperationsClient object with the same endpoint as $this. - * - * @return GlobalOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetGlobalOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteGlobalOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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); - } - - /** - * Attach a network endpoint to the specified network endpoint group. - * - * Sample code: - * ``` - * $globalNetworkEndpointGroupsClient = new GlobalNetworkEndpointGroupsClient(); - * try { - * $globalNetworkEndpointGroupsAttachEndpointsRequestResource = new GlobalNetworkEndpointGroupsAttachEndpointsRequest(); - * $networkEndpointGroup = 'network_endpoint_group'; - * $project = 'project'; - * $operationResponse = $globalNetworkEndpointGroupsClient->attachNetworkEndpoints($globalNetworkEndpointGroupsAttachEndpointsRequestResource, $networkEndpointGroup, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $globalNetworkEndpointGroupsClient->attachNetworkEndpoints($globalNetworkEndpointGroupsAttachEndpointsRequestResource, $networkEndpointGroup, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $globalNetworkEndpointGroupsClient->resumeOperation($operationName, 'attachNetworkEndpoints'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $globalNetworkEndpointGroupsClient->close(); - * } - * ``` - * - * @param GlobalNetworkEndpointGroupsAttachEndpointsRequest $globalNetworkEndpointGroupsAttachEndpointsRequestResource The body resource for this request - * @param string $networkEndpointGroup The name of the network endpoint group where you are attaching network endpoints to. It should comply with RFC1035. - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 attachNetworkEndpoints($globalNetworkEndpointGroupsAttachEndpointsRequestResource, $networkEndpointGroup, $project, array $optionalArgs = []) - { - $request = new AttachNetworkEndpointsGlobalNetworkEndpointGroupRequest(); - $requestParamHeaders = []; - $request->setGlobalNetworkEndpointGroupsAttachEndpointsRequestResource($globalNetworkEndpointGroupsAttachEndpointsRequestResource); - $request->setNetworkEndpointGroup($networkEndpointGroup); - $request->setProject($project); - $requestParamHeaders['network_endpoint_group'] = $networkEndpointGroup; - $requestParamHeaders['project'] = $project; - 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('AttachNetworkEndpoints', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Deletes the specified network endpoint group.Note that the NEG cannot be deleted if there are backend services referencing it. - * - * Sample code: - * ``` - * $globalNetworkEndpointGroupsClient = new GlobalNetworkEndpointGroupsClient(); - * try { - * $networkEndpointGroup = 'network_endpoint_group'; - * $project = 'project'; - * $operationResponse = $globalNetworkEndpointGroupsClient->delete($networkEndpointGroup, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $globalNetworkEndpointGroupsClient->delete($networkEndpointGroup, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $globalNetworkEndpointGroupsClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $globalNetworkEndpointGroupsClient->close(); - * } - * ``` - * - * @param string $networkEndpointGroup The name of the network endpoint group to delete. It should comply with RFC1035. - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($networkEndpointGroup, $project, array $optionalArgs = []) - { - $request = new DeleteGlobalNetworkEndpointGroupRequest(); - $requestParamHeaders = []; - $request->setNetworkEndpointGroup($networkEndpointGroup); - $request->setProject($project); - $requestParamHeaders['network_endpoint_group'] = $networkEndpointGroup; - $requestParamHeaders['project'] = $project; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Detach the network endpoint from the specified network endpoint group. - * - * Sample code: - * ``` - * $globalNetworkEndpointGroupsClient = new GlobalNetworkEndpointGroupsClient(); - * try { - * $globalNetworkEndpointGroupsDetachEndpointsRequestResource = new GlobalNetworkEndpointGroupsDetachEndpointsRequest(); - * $networkEndpointGroup = 'network_endpoint_group'; - * $project = 'project'; - * $operationResponse = $globalNetworkEndpointGroupsClient->detachNetworkEndpoints($globalNetworkEndpointGroupsDetachEndpointsRequestResource, $networkEndpointGroup, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $globalNetworkEndpointGroupsClient->detachNetworkEndpoints($globalNetworkEndpointGroupsDetachEndpointsRequestResource, $networkEndpointGroup, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $globalNetworkEndpointGroupsClient->resumeOperation($operationName, 'detachNetworkEndpoints'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $globalNetworkEndpointGroupsClient->close(); - * } - * ``` - * - * @param GlobalNetworkEndpointGroupsDetachEndpointsRequest $globalNetworkEndpointGroupsDetachEndpointsRequestResource The body resource for this request - * @param string $networkEndpointGroup The name of the network endpoint group where you are removing network endpoints. It should comply with RFC1035. - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 detachNetworkEndpoints($globalNetworkEndpointGroupsDetachEndpointsRequestResource, $networkEndpointGroup, $project, array $optionalArgs = []) - { - $request = new DetachNetworkEndpointsGlobalNetworkEndpointGroupRequest(); - $requestParamHeaders = []; - $request->setGlobalNetworkEndpointGroupsDetachEndpointsRequestResource($globalNetworkEndpointGroupsDetachEndpointsRequestResource); - $request->setNetworkEndpointGroup($networkEndpointGroup); - $request->setProject($project); - $requestParamHeaders['network_endpoint_group'] = $networkEndpointGroup; - $requestParamHeaders['project'] = $project; - 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('DetachNetworkEndpoints', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns the specified network endpoint group. - * - * Sample code: - * ``` - * $globalNetworkEndpointGroupsClient = new GlobalNetworkEndpointGroupsClient(); - * try { - * $networkEndpointGroup = 'network_endpoint_group'; - * $project = 'project'; - * $response = $globalNetworkEndpointGroupsClient->get($networkEndpointGroup, $project); - * } finally { - * $globalNetworkEndpointGroupsClient->close(); - * } - * ``` - * - * @param string $networkEndpointGroup The name of the network endpoint group. It should comply with RFC1035. - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\NetworkEndpointGroup - * - * @throws ApiException if the remote call fails - */ - public function get($networkEndpointGroup, $project, array $optionalArgs = []) - { - $request = new GetGlobalNetworkEndpointGroupRequest(); - $requestParamHeaders = []; - $request->setNetworkEndpointGroup($networkEndpointGroup); - $request->setProject($project); - $requestParamHeaders['network_endpoint_group'] = $networkEndpointGroup; - $requestParamHeaders['project'] = $project; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', NetworkEndpointGroup::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates a network endpoint group in the specified project using the parameters that are included in the request. - * - * Sample code: - * ``` - * $globalNetworkEndpointGroupsClient = new GlobalNetworkEndpointGroupsClient(); - * try { - * $networkEndpointGroupResource = new NetworkEndpointGroup(); - * $project = 'project'; - * $operationResponse = $globalNetworkEndpointGroupsClient->insert($networkEndpointGroupResource, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $globalNetworkEndpointGroupsClient->insert($networkEndpointGroupResource, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $globalNetworkEndpointGroupsClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $globalNetworkEndpointGroupsClient->close(); - * } - * ``` - * - * @param NetworkEndpointGroup $networkEndpointGroupResource The body resource for this request - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 insert($networkEndpointGroupResource, $project, array $optionalArgs = []) - { - $request = new InsertGlobalNetworkEndpointGroupRequest(); - $requestParamHeaders = []; - $request->setNetworkEndpointGroupResource($networkEndpointGroupResource); - $request->setProject($project); - $requestParamHeaders['project'] = $project; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Retrieves the list of network endpoint groups that are located in the specified project. - * - * Sample code: - * ``` - * $globalNetworkEndpointGroupsClient = new GlobalNetworkEndpointGroupsClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $globalNetworkEndpointGroupsClient->list($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $globalNetworkEndpointGroupsClient->list($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $globalNetworkEndpointGroupsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, array $optionalArgs = []) - { - $request = new ListGlobalNetworkEndpointGroupsRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, NetworkEndpointGroupList::class, $request); - } - - /** - * Lists the network endpoints in the specified network endpoint group. - * - * Sample code: - * ``` - * $globalNetworkEndpointGroupsClient = new GlobalNetworkEndpointGroupsClient(); - * try { - * $networkEndpointGroup = 'network_endpoint_group'; - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $globalNetworkEndpointGroupsClient->listNetworkEndpoints($networkEndpointGroup, $project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $globalNetworkEndpointGroupsClient->listNetworkEndpoints($networkEndpointGroup, $project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $globalNetworkEndpointGroupsClient->close(); - * } - * ``` - * - * @param string $networkEndpointGroup The name of the network endpoint group from which you want to generate a list of included network endpoints. It should comply with RFC1035. - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 listNetworkEndpoints($networkEndpointGroup, $project, array $optionalArgs = []) - { - $request = new ListNetworkEndpointsGlobalNetworkEndpointGroupsRequest(); - $requestParamHeaders = []; - $request->setNetworkEndpointGroup($networkEndpointGroup); - $request->setProject($project); - $requestParamHeaders['network_endpoint_group'] = $networkEndpointGroup; - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('ListNetworkEndpoints', $optionalArgs, NetworkEndpointGroupsListNetworkEndpoints::class, $request); - } -} diff --git a/Compute/src/V1/Gapic/GlobalOperationsGapicClient.php b/Compute/src/V1/Gapic/GlobalOperationsGapicClient.php deleted file mode 100644 index 8230cd17901d..000000000000 --- a/Compute/src/V1/Gapic/GlobalOperationsGapicClient.php +++ /dev/null @@ -1,502 +0,0 @@ -aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $globalOperationsClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $globalOperationsClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\GlobalOperationsClient}. - */ -class GlobalOperationsGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.GlobalOperations'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/global_operations_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/global_operations_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/global_operations_rest_client_config.php', - ], - ], - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * 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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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); - } - - /** - * Retrieves an aggregated list of all operations. To prevent failure, Google recommends that you set the `returnPartialSuccess` parameter to `true`. - * - * Sample code: - * ``` - * $globalOperationsClient = new GlobalOperationsClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $globalOperationsClient->aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $globalOperationsClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $globalOperationsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type bool $includeAllScopes - * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type int $serviceProjectNumber - * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable 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 aggregatedList($project, array $optionalArgs = []) - { - $request = new AggregatedListGlobalOperationsRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['includeAllScopes'])) { - $request->setIncludeAllScopes($optionalArgs['includeAllScopes']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - if (isset($optionalArgs['serviceProjectNumber'])) { - $request->setServiceProjectNumber($optionalArgs['serviceProjectNumber']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('AggregatedList', $optionalArgs, OperationAggregatedList::class, $request); - } - - /** - * Deletes the specified Operations resource. - * - * Sample code: - * ``` - * $globalOperationsClient = new GlobalOperationsClient(); - * try { - * $operation = 'operation'; - * $project = 'project'; - * $response = $globalOperationsClient->delete($operation, $project); - * } finally { - * $globalOperationsClient->close(); - * } - * ``` - * - * @param string $operation Name of the Operations resource to delete, or its unique numeric identifier. - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\DeleteGlobalOperationResponse - * - * @throws ApiException if the remote call fails - */ - public function delete($operation, $project, array $optionalArgs = []) - { - $request = new DeleteGlobalOperationRequest(); - $requestParamHeaders = []; - $request->setOperation($operation); - $request->setProject($project); - $requestParamHeaders['operation'] = $operation; - $requestParamHeaders['project'] = $project; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Delete', DeleteGlobalOperationResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Retrieves the specified Operations resource. - * - * Sample code: - * ``` - * $globalOperationsClient = new GlobalOperationsClient(); - * try { - * $operation = 'operation'; - * $project = 'project'; - * $response = $globalOperationsClient->get($operation, $project); - * } finally { - * $globalOperationsClient->close(); - * } - * ``` - * - * @param string $operation Name of the Operations resource to return, or its unique numeric identifier. - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Operation - * - * @throws ApiException if the remote call fails - */ - public function get($operation, $project, array $optionalArgs = []) - { - $request = new GetGlobalOperationRequest(); - $requestParamHeaders = []; - $request->setOperation($operation); - $request->setProject($project); - $requestParamHeaders['operation'] = $operation; - $requestParamHeaders['project'] = $project; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', Operation::class, $optionalArgs, $request)->wait(); - } - - /** - * Retrieves a list of Operation resources contained within the specified project. - * - * Sample code: - * ``` - * $globalOperationsClient = new GlobalOperationsClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $globalOperationsClient->list($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $globalOperationsClient->list($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $globalOperationsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, array $optionalArgs = []) - { - $request = new ListGlobalOperationsRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, OperationList::class, $request); - } - - /** - * Waits for the specified Operation resource to return as `DONE` or for the request to approach the 2 minute deadline, and retrieves the specified Operation resource. This method differs from the `GET` method in that it waits for no more than the default deadline (2 minutes) and then returns the current state of the operation, which might be `DONE` or still in progress. This method is called on a best-effort basis. Specifically: - In uncommon cases, when the server is overloaded, the request might return before the default deadline is reached, or might return after zero seconds. - If the default deadline is reached, there is no guarantee that the operation is actually done when the method returns. Be prepared to retry if the operation is not `DONE`. - * - * Sample code: - * ``` - * $globalOperationsClient = new GlobalOperationsClient(); - * try { - * $operation = 'operation'; - * $project = 'project'; - * $response = $globalOperationsClient->wait($operation, $project); - * } finally { - * $globalOperationsClient->close(); - * } - * ``` - * - * @param string $operation Name of the Operations resource to return, or its unique numeric identifier. - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Operation - * - * @throws ApiException if the remote call fails - */ - public function wait($operation, $project, array $optionalArgs = []) - { - $request = new WaitGlobalOperationRequest(); - $requestParamHeaders = []; - $request->setOperation($operation); - $request->setProject($project); - $requestParamHeaders['operation'] = $operation; - $requestParamHeaders['project'] = $project; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Wait', Operation::class, $optionalArgs, $request)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/GlobalOrganizationOperationsGapicClient.php b/Compute/src/V1/Gapic/GlobalOrganizationOperationsGapicClient.php deleted file mode 100644 index f463c7c69986..000000000000 --- a/Compute/src/V1/Gapic/GlobalOrganizationOperationsGapicClient.php +++ /dev/null @@ -1,351 +0,0 @@ -delete($operation); - * } finally { - * $globalOrganizationOperationsClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\GlobalOrganizationOperationsClient}. - */ -class GlobalOrganizationOperationsGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.GlobalOrganizationOperations'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/global_organization_operations_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/global_organization_operations_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/global_organization_operations_rest_client_config.php', - ], - ], - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * 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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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); - } - - /** - * Deletes the specified Operations resource. - * - * Sample code: - * ``` - * $globalOrganizationOperationsClient = new GlobalOrganizationOperationsClient(); - * try { - * $operation = 'operation'; - * $response = $globalOrganizationOperationsClient->delete($operation); - * } finally { - * $globalOrganizationOperationsClient->close(); - * } - * ``` - * - * @param string $operation Name of the Operations resource to delete, or its unique numeric identifier. - * @param array $optionalArgs { - * Optional. - * - * @type string $parentId - * Parent ID for this request. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\DeleteGlobalOrganizationOperationResponse - * - * @throws ApiException if the remote call fails - */ - public function delete($operation, array $optionalArgs = []) - { - $request = new DeleteGlobalOrganizationOperationRequest(); - $requestParamHeaders = []; - $request->setOperation($operation); - $requestParamHeaders['operation'] = $operation; - if (isset($optionalArgs['parentId'])) { - $request->setParentId($optionalArgs['parentId']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Delete', DeleteGlobalOrganizationOperationResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Retrieves the specified Operations resource. Gets a list of operations by making a `list()` request. - * - * Sample code: - * ``` - * $globalOrganizationOperationsClient = new GlobalOrganizationOperationsClient(); - * try { - * $operation = 'operation'; - * $response = $globalOrganizationOperationsClient->get($operation); - * } finally { - * $globalOrganizationOperationsClient->close(); - * } - * ``` - * - * @param string $operation Name of the Operations resource to return. Parent is derived from this field. - * @param array $optionalArgs { - * Optional. - * - * @type string $parentId - * Parent ID for this request. Not used. Parent is derived from resource_id. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Operation - * - * @throws ApiException if the remote call fails - */ - public function get($operation, array $optionalArgs = []) - { - $request = new GetGlobalOrganizationOperationRequest(); - $requestParamHeaders = []; - $request->setOperation($operation); - $requestParamHeaders['operation'] = $operation; - if (isset($optionalArgs['parentId'])) { - $request->setParentId($optionalArgs['parentId']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', Operation::class, $optionalArgs, $request)->wait(); - } - - /** - * Retrieves a list of Operation resources contained within the specified organization. - * - * Sample code: - * ``` - * $globalOrganizationOperationsClient = new GlobalOrganizationOperationsClient(); - * try { - * // Iterate over pages of elements - * $pagedResponse = $globalOrganizationOperationsClient->list(); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $globalOrganizationOperationsClient->list(); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $globalOrganizationOperationsClient->close(); - * } - * ``` - * - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $parentId - * Parent ID for this request. - * @type bool $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list(array $optionalArgs = []) - { - $request = new ListGlobalOrganizationOperationsRequest(); - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['parentId'])) { - $request->setParentId($optionalArgs['parentId']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - return $this->getPagedListResponse('List', $optionalArgs, OperationList::class, $request); - } -} diff --git a/Compute/src/V1/Gapic/GlobalPublicDelegatedPrefixesGapicClient.php b/Compute/src/V1/Gapic/GlobalPublicDelegatedPrefixesGapicClient.php deleted file mode 100644 index b956cacc1b98..000000000000 --- a/Compute/src/V1/Gapic/GlobalPublicDelegatedPrefixesGapicClient.php +++ /dev/null @@ -1,605 +0,0 @@ -delete($project, $publicDelegatedPrefix); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $globalPublicDelegatedPrefixesClient->delete($project, $publicDelegatedPrefix); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $globalPublicDelegatedPrefixesClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $globalPublicDelegatedPrefixesClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\GlobalPublicDelegatedPrefixesClient}. - */ -class GlobalPublicDelegatedPrefixesGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.GlobalPublicDelegatedPrefixes'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/global_public_delegated_prefixes_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/global_public_delegated_prefixes_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/global_public_delegated_prefixes_rest_client_config.php', - ], - ], - 'operationsClientClass' => GlobalOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an GlobalOperationsClient object with the same endpoint as $this. - * - * @return GlobalOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetGlobalOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteGlobalOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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 the specified global PublicDelegatedPrefix. - * - * Sample code: - * ``` - * $globalPublicDelegatedPrefixesClient = new GlobalPublicDelegatedPrefixesClient(); - * try { - * $project = 'project'; - * $publicDelegatedPrefix = 'public_delegated_prefix'; - * $operationResponse = $globalPublicDelegatedPrefixesClient->delete($project, $publicDelegatedPrefix); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $globalPublicDelegatedPrefixesClient->delete($project, $publicDelegatedPrefix); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $globalPublicDelegatedPrefixesClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $globalPublicDelegatedPrefixesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $publicDelegatedPrefix Name of the PublicDelegatedPrefix resource to delete. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($project, $publicDelegatedPrefix, array $optionalArgs = []) - { - $request = new DeleteGlobalPublicDelegatedPrefixeRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setPublicDelegatedPrefix($publicDelegatedPrefix); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['public_delegated_prefix'] = $publicDelegatedPrefix; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns the specified global PublicDelegatedPrefix resource. - * - * Sample code: - * ``` - * $globalPublicDelegatedPrefixesClient = new GlobalPublicDelegatedPrefixesClient(); - * try { - * $project = 'project'; - * $publicDelegatedPrefix = 'public_delegated_prefix'; - * $response = $globalPublicDelegatedPrefixesClient->get($project, $publicDelegatedPrefix); - * } finally { - * $globalPublicDelegatedPrefixesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $publicDelegatedPrefix Name of the PublicDelegatedPrefix resource to return. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\PublicDelegatedPrefix - * - * @throws ApiException if the remote call fails - */ - public function get($project, $publicDelegatedPrefix, array $optionalArgs = []) - { - $request = new GetGlobalPublicDelegatedPrefixeRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setPublicDelegatedPrefix($publicDelegatedPrefix); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['public_delegated_prefix'] = $publicDelegatedPrefix; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', PublicDelegatedPrefix::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates a global PublicDelegatedPrefix in the specified project using the parameters that are included in the request. - * - * Sample code: - * ``` - * $globalPublicDelegatedPrefixesClient = new GlobalPublicDelegatedPrefixesClient(); - * try { - * $project = 'project'; - * $publicDelegatedPrefixResource = new PublicDelegatedPrefix(); - * $operationResponse = $globalPublicDelegatedPrefixesClient->insert($project, $publicDelegatedPrefixResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $globalPublicDelegatedPrefixesClient->insert($project, $publicDelegatedPrefixResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $globalPublicDelegatedPrefixesClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $globalPublicDelegatedPrefixesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param PublicDelegatedPrefix $publicDelegatedPrefixResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 insert($project, $publicDelegatedPrefixResource, array $optionalArgs = []) - { - $request = new InsertGlobalPublicDelegatedPrefixeRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setPublicDelegatedPrefixResource($publicDelegatedPrefixResource); - $requestParamHeaders['project'] = $project; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Lists the global PublicDelegatedPrefixes for a project. - * - * Sample code: - * ``` - * $globalPublicDelegatedPrefixesClient = new GlobalPublicDelegatedPrefixesClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $globalPublicDelegatedPrefixesClient->list($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $globalPublicDelegatedPrefixesClient->list($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $globalPublicDelegatedPrefixesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, array $optionalArgs = []) - { - $request = new ListGlobalPublicDelegatedPrefixesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, PublicDelegatedPrefixList::class, $request); - } - - /** - * Patches the specified global PublicDelegatedPrefix resource with the data included in the request. This method supports PATCH semantics and uses JSON merge patch format and processing rules. - * - * Sample code: - * ``` - * $globalPublicDelegatedPrefixesClient = new GlobalPublicDelegatedPrefixesClient(); - * try { - * $project = 'project'; - * $publicDelegatedPrefix = 'public_delegated_prefix'; - * $publicDelegatedPrefixResource = new PublicDelegatedPrefix(); - * $operationResponse = $globalPublicDelegatedPrefixesClient->patch($project, $publicDelegatedPrefix, $publicDelegatedPrefixResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $globalPublicDelegatedPrefixesClient->patch($project, $publicDelegatedPrefix, $publicDelegatedPrefixResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $globalPublicDelegatedPrefixesClient->resumeOperation($operationName, 'patch'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $globalPublicDelegatedPrefixesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $publicDelegatedPrefix Name of the PublicDelegatedPrefix resource to patch. - * @param PublicDelegatedPrefix $publicDelegatedPrefixResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 patch($project, $publicDelegatedPrefix, $publicDelegatedPrefixResource, array $optionalArgs = []) - { - $request = new PatchGlobalPublicDelegatedPrefixeRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setPublicDelegatedPrefix($publicDelegatedPrefix); - $request->setPublicDelegatedPrefixResource($publicDelegatedPrefixResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['public_delegated_prefix'] = $publicDelegatedPrefix; - 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('Patch', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/HealthChecksGapicClient.php b/Compute/src/V1/Gapic/HealthChecksGapicClient.php deleted file mode 100644 index 15469ca0f1e1..000000000000 --- a/Compute/src/V1/Gapic/HealthChecksGapicClient.php +++ /dev/null @@ -1,767 +0,0 @@ -aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $healthChecksClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $healthChecksClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\HealthChecksClient}. - */ -class HealthChecksGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.HealthChecks'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/health_checks_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/health_checks_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/health_checks_rest_client_config.php', - ], - ], - 'operationsClientClass' => GlobalOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an GlobalOperationsClient object with the same endpoint as $this. - * - * @return GlobalOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetGlobalOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteGlobalOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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); - } - - /** - * Retrieves the list of all HealthCheck resources, regional and global, available to the specified project. To prevent failure, Google recommends that you set the `returnPartialSuccess` parameter to `true`. - * - * Sample code: - * ``` - * $healthChecksClient = new HealthChecksClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $healthChecksClient->aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $healthChecksClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $healthChecksClient->close(); - * } - * ``` - * - * @param string $project Name of the project scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type bool $includeAllScopes - * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type int $serviceProjectNumber - * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable 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 aggregatedList($project, array $optionalArgs = []) - { - $request = new AggregatedListHealthChecksRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['includeAllScopes'])) { - $request->setIncludeAllScopes($optionalArgs['includeAllScopes']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - if (isset($optionalArgs['serviceProjectNumber'])) { - $request->setServiceProjectNumber($optionalArgs['serviceProjectNumber']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('AggregatedList', $optionalArgs, HealthChecksAggregatedList::class, $request); - } - - /** - * Deletes the specified HealthCheck resource. - * - * Sample code: - * ``` - * $healthChecksClient = new HealthChecksClient(); - * try { - * $healthCheck = 'health_check'; - * $project = 'project'; - * $operationResponse = $healthChecksClient->delete($healthCheck, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $healthChecksClient->delete($healthCheck, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $healthChecksClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $healthChecksClient->close(); - * } - * ``` - * - * @param string $healthCheck Name of the HealthCheck resource to delete. - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($healthCheck, $project, array $optionalArgs = []) - { - $request = new DeleteHealthCheckRequest(); - $requestParamHeaders = []; - $request->setHealthCheck($healthCheck); - $request->setProject($project); - $requestParamHeaders['health_check'] = $healthCheck; - $requestParamHeaders['project'] = $project; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns the specified HealthCheck resource. - * - * Sample code: - * ``` - * $healthChecksClient = new HealthChecksClient(); - * try { - * $healthCheck = 'health_check'; - * $project = 'project'; - * $response = $healthChecksClient->get($healthCheck, $project); - * } finally { - * $healthChecksClient->close(); - * } - * ``` - * - * @param string $healthCheck Name of the HealthCheck resource to return. - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\HealthCheck - * - * @throws ApiException if the remote call fails - */ - public function get($healthCheck, $project, array $optionalArgs = []) - { - $request = new GetHealthCheckRequest(); - $requestParamHeaders = []; - $request->setHealthCheck($healthCheck); - $request->setProject($project); - $requestParamHeaders['health_check'] = $healthCheck; - $requestParamHeaders['project'] = $project; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', HealthCheck::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates a HealthCheck resource in the specified project using the data included in the request. - * - * Sample code: - * ``` - * $healthChecksClient = new HealthChecksClient(); - * try { - * $healthCheckResource = new HealthCheck(); - * $project = 'project'; - * $operationResponse = $healthChecksClient->insert($healthCheckResource, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $healthChecksClient->insert($healthCheckResource, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $healthChecksClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $healthChecksClient->close(); - * } - * ``` - * - * @param HealthCheck $healthCheckResource The body resource for this request - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 insert($healthCheckResource, $project, array $optionalArgs = []) - { - $request = new InsertHealthCheckRequest(); - $requestParamHeaders = []; - $request->setHealthCheckResource($healthCheckResource); - $request->setProject($project); - $requestParamHeaders['project'] = $project; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Retrieves the list of HealthCheck resources available to the specified project. - * - * Sample code: - * ``` - * $healthChecksClient = new HealthChecksClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $healthChecksClient->list($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $healthChecksClient->list($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $healthChecksClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, array $optionalArgs = []) - { - $request = new ListHealthChecksRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, HealthCheckList::class, $request); - } - - /** - * Updates a HealthCheck resource in the specified project using the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. - * - * Sample code: - * ``` - * $healthChecksClient = new HealthChecksClient(); - * try { - * $healthCheck = 'health_check'; - * $healthCheckResource = new HealthCheck(); - * $project = 'project'; - * $operationResponse = $healthChecksClient->patch($healthCheck, $healthCheckResource, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $healthChecksClient->patch($healthCheck, $healthCheckResource, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $healthChecksClient->resumeOperation($operationName, 'patch'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $healthChecksClient->close(); - * } - * ``` - * - * @param string $healthCheck Name of the HealthCheck resource to patch. - * @param HealthCheck $healthCheckResource The body resource for this request - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 patch($healthCheck, $healthCheckResource, $project, array $optionalArgs = []) - { - $request = new PatchHealthCheckRequest(); - $requestParamHeaders = []; - $request->setHealthCheck($healthCheck); - $request->setHealthCheckResource($healthCheckResource); - $request->setProject($project); - $requestParamHeaders['health_check'] = $healthCheck; - $requestParamHeaders['project'] = $project; - 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('Patch', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Updates a HealthCheck resource in the specified project using the data included in the request. - * - * Sample code: - * ``` - * $healthChecksClient = new HealthChecksClient(); - * try { - * $healthCheck = 'health_check'; - * $healthCheckResource = new HealthCheck(); - * $project = 'project'; - * $operationResponse = $healthChecksClient->update($healthCheck, $healthCheckResource, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $healthChecksClient->update($healthCheck, $healthCheckResource, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $healthChecksClient->resumeOperation($operationName, 'update'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $healthChecksClient->close(); - * } - * ``` - * - * @param string $healthCheck Name of the HealthCheck resource to update. - * @param HealthCheck $healthCheckResource The body resource for this request - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 update($healthCheck, $healthCheckResource, $project, array $optionalArgs = []) - { - $request = new UpdateHealthCheckRequest(); - $requestParamHeaders = []; - $request->setHealthCheck($healthCheck); - $request->setHealthCheckResource($healthCheckResource); - $request->setProject($project); - $requestParamHeaders['health_check'] = $healthCheck; - $requestParamHeaders['project'] = $project; - 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('Update', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/ImageFamilyViewsGapicClient.php b/Compute/src/V1/Gapic/ImageFamilyViewsGapicClient.php deleted file mode 100644 index 980c6c163c08..000000000000 --- a/Compute/src/V1/Gapic/ImageFamilyViewsGapicClient.php +++ /dev/null @@ -1,224 +0,0 @@ -get($family, $project, $zone); - * } finally { - * $imageFamilyViewsClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\ImageFamilyViewsClient}. - */ -class ImageFamilyViewsGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.ImageFamilyViews'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute.readonly', - 'https://www.googleapis.com/auth/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/image_family_views_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/image_family_views_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/image_family_views_rest_client_config.php', - ], - ], - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * 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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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); - } - - /** - * Returns the latest image that is part of an image family, is not deprecated and is rolled out in the specified zone. - * - * Sample code: - * ``` - * $imageFamilyViewsClient = new ImageFamilyViewsClient(); - * try { - * $family = 'family'; - * $project = 'project'; - * $zone = 'zone'; - * $response = $imageFamilyViewsClient->get($family, $project, $zone); - * } finally { - * $imageFamilyViewsClient->close(); - * } - * ``` - * - * @param string $family Name of the image family to search for. - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\ImageFamilyView - * - * @throws ApiException if the remote call fails - */ - public function get($family, $project, $zone, array $optionalArgs = []) - { - $request = new GetImageFamilyViewRequest(); - $requestParamHeaders = []; - $request->setFamily($family); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['family'] = $family; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', ImageFamilyView::class, $optionalArgs, $request)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/ImagesGapicClient.php b/Compute/src/V1/Gapic/ImagesGapicClient.php deleted file mode 100644 index 51a90bcbf7d9..000000000000 --- a/Compute/src/V1/Gapic/ImagesGapicClient.php +++ /dev/null @@ -1,951 +0,0 @@ -delete($image, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $imagesClient->delete($image, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $imagesClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $imagesClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\ImagesClient}. - */ -class ImagesGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.Images'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/images_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/images_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/images_rest_client_config.php', - ], - ], - 'operationsClientClass' => GlobalOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an GlobalOperationsClient object with the same endpoint as $this. - * - * @return GlobalOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetGlobalOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteGlobalOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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 the specified image. - * - * Sample code: - * ``` - * $imagesClient = new ImagesClient(); - * try { - * $image = 'image'; - * $project = 'project'; - * $operationResponse = $imagesClient->delete($image, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $imagesClient->delete($image, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $imagesClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $imagesClient->close(); - * } - * ``` - * - * @param string $image Name of the image resource to delete. - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($image, $project, array $optionalArgs = []) - { - $request = new DeleteImageRequest(); - $requestParamHeaders = []; - $request->setImage($image); - $request->setProject($project); - $requestParamHeaders['image'] = $image; - $requestParamHeaders['project'] = $project; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Sets the deprecation status of an image. If an empty request body is given, clears the deprecation status instead. - * - * Sample code: - * ``` - * $imagesClient = new ImagesClient(); - * try { - * $deprecationStatusResource = new DeprecationStatus(); - * $image = 'image'; - * $project = 'project'; - * $operationResponse = $imagesClient->deprecate($deprecationStatusResource, $image, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $imagesClient->deprecate($deprecationStatusResource, $image, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $imagesClient->resumeOperation($operationName, 'deprecate'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $imagesClient->close(); - * } - * ``` - * - * @param DeprecationStatus $deprecationStatusResource The body resource for this request - * @param string $image Image name. - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 deprecate($deprecationStatusResource, $image, $project, array $optionalArgs = []) - { - $request = new DeprecateImageRequest(); - $requestParamHeaders = []; - $request->setDeprecationStatusResource($deprecationStatusResource); - $request->setImage($image); - $request->setProject($project); - $requestParamHeaders['image'] = $image; - $requestParamHeaders['project'] = $project; - 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('Deprecate', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns the specified image. - * - * Sample code: - * ``` - * $imagesClient = new ImagesClient(); - * try { - * $image = 'image'; - * $project = 'project'; - * $response = $imagesClient->get($image, $project); - * } finally { - * $imagesClient->close(); - * } - * ``` - * - * @param string $image Name of the image resource to return. - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Image - * - * @throws ApiException if the remote call fails - */ - public function get($image, $project, array $optionalArgs = []) - { - $request = new GetImageRequest(); - $requestParamHeaders = []; - $request->setImage($image); - $request->setProject($project); - $requestParamHeaders['image'] = $image; - $requestParamHeaders['project'] = $project; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', Image::class, $optionalArgs, $request)->wait(); - } - - /** - * Returns the latest image that is part of an image family and is not deprecated. For more information on image families, see Public image families documentation. - * - * Sample code: - * ``` - * $imagesClient = new ImagesClient(); - * try { - * $family = 'family'; - * $project = 'project'; - * $response = $imagesClient->getFromFamily($family, $project); - * } finally { - * $imagesClient->close(); - * } - * ``` - * - * @param string $family Name of the image family to search for. - * @param string $project The image project that the image belongs to. For example, to get a CentOS image, specify centos-cloud as the image project. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Image - * - * @throws ApiException if the remote call fails - */ - public function getFromFamily($family, $project, array $optionalArgs = []) - { - $request = new GetFromFamilyImageRequest(); - $requestParamHeaders = []; - $request->setFamily($family); - $request->setProject($project); - $requestParamHeaders['family'] = $family; - $requestParamHeaders['project'] = $project; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetFromFamily', Image::class, $optionalArgs, $request)->wait(); - } - - /** - * Gets the access control policy for a resource. May be empty if no such policy or resource exists. - * - * Sample code: - * ``` - * $imagesClient = new ImagesClient(); - * try { - * $project = 'project'; - * $resource = 'resource'; - * $response = $imagesClient->getIamPolicy($project, $resource); - * } finally { - * $imagesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $resource Name or id of the resource for this request. - * @param array $optionalArgs { - * Optional. - * - * @type int $optionsRequestedPolicyVersion - * Requested IAM Policy version. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function getIamPolicy($project, $resource, array $optionalArgs = []) - { - $request = new GetIamPolicyImageRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setResource($resource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['optionsRequestedPolicyVersion'])) { - $request->setOptionsRequestedPolicyVersion($optionalArgs['optionsRequestedPolicyVersion']); - } - - $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(); - } - - /** - * Creates an image in the specified project using the data included in the request. - * - * Sample code: - * ``` - * $imagesClient = new ImagesClient(); - * try { - * $imageResource = new Image(); - * $project = 'project'; - * $operationResponse = $imagesClient->insert($imageResource, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $imagesClient->insert($imageResource, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $imagesClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $imagesClient->close(); - * } - * ``` - * - * @param Image $imageResource The body resource for this request - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type bool $forceCreate - * Force image creation if true. - * @type string $requestId - * 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. 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 insert($imageResource, $project, array $optionalArgs = []) - { - $request = new InsertImageRequest(); - $requestParamHeaders = []; - $request->setImageResource($imageResource); - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['forceCreate'])) { - $request->setForceCreate($optionalArgs['forceCreate']); - } - - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Retrieves the list of custom images available to the specified project. Custom images are images you create that belong to your project. This method does not get any images that belong to other projects, including publicly-available images, like Debian 8. If you want to get a list of publicly-available images, use this method to make a request to the respective image project, such as debian-cloud or windows-cloud. - * - * Sample code: - * ``` - * $imagesClient = new ImagesClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $imagesClient->list($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $imagesClient->list($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $imagesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, array $optionalArgs = []) - { - $request = new ListImagesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, ImageList::class, $request); - } - - /** - * Patches the specified image with the data included in the request. Only the following fields can be modified: family, description, deprecation status. - * - * Sample code: - * ``` - * $imagesClient = new ImagesClient(); - * try { - * $image = 'image'; - * $imageResource = new Image(); - * $project = 'project'; - * $operationResponse = $imagesClient->patch($image, $imageResource, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $imagesClient->patch($image, $imageResource, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $imagesClient->resumeOperation($operationName, 'patch'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $imagesClient->close(); - * } - * ``` - * - * @param string $image Name of the image resource to patch. - * @param Image $imageResource The body resource for this request - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 patch($image, $imageResource, $project, array $optionalArgs = []) - { - $request = new PatchImageRequest(); - $requestParamHeaders = []; - $request->setImage($image); - $request->setImageResource($imageResource); - $request->setProject($project); - $requestParamHeaders['image'] = $image; - $requestParamHeaders['project'] = $project; - 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('Patch', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Sets the access control policy on the specified resource. Replaces any existing policy. - * - * Sample code: - * ``` - * $imagesClient = new ImagesClient(); - * try { - * $globalSetPolicyRequestResource = new GlobalSetPolicyRequest(); - * $project = 'project'; - * $resource = 'resource'; - * $response = $imagesClient->setIamPolicy($globalSetPolicyRequestResource, $project, $resource); - * } finally { - * $imagesClient->close(); - * } - * ``` - * - * @param GlobalSetPolicyRequest $globalSetPolicyRequestResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $resource Name or id of the resource for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function setIamPolicy($globalSetPolicyRequestResource, $project, $resource, array $optionalArgs = []) - { - $request = new SetIamPolicyImageRequest(); - $requestParamHeaders = []; - $request->setGlobalSetPolicyRequestResource($globalSetPolicyRequestResource); - $request->setProject($project); - $request->setResource($resource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['resource'] = $resource; - $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(); - } - - /** - * Sets the labels on an image. To learn more about labels, read the Labeling Resources documentation. - * - * Sample code: - * ``` - * $imagesClient = new ImagesClient(); - * try { - * $globalSetLabelsRequestResource = new GlobalSetLabelsRequest(); - * $project = 'project'; - * $resource = 'resource'; - * $operationResponse = $imagesClient->setLabels($globalSetLabelsRequestResource, $project, $resource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $imagesClient->setLabels($globalSetLabelsRequestResource, $project, $resource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $imagesClient->resumeOperation($operationName, 'setLabels'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $imagesClient->close(); - * } - * ``` - * - * @param GlobalSetLabelsRequest $globalSetLabelsRequestResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $resource Name or id of the resource for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 setLabels($globalSetLabelsRequestResource, $project, $resource, array $optionalArgs = []) - { - $request = new SetLabelsImageRequest(); - $requestParamHeaders = []; - $request->setGlobalSetLabelsRequestResource($globalSetLabelsRequestResource); - $request->setProject($project); - $request->setResource($resource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['resource'] = $resource; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('SetLabels', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns permissions that a caller has on the specified resource. - * - * Sample code: - * ``` - * $imagesClient = new ImagesClient(); - * try { - * $project = 'project'; - * $resource = 'resource'; - * $testPermissionsRequestResource = new TestPermissionsRequest(); - * $response = $imagesClient->testIamPermissions($project, $resource, $testPermissionsRequestResource); - * } finally { - * $imagesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $resource Name or id of the resource for this request. - * @param TestPermissionsRequest $testPermissionsRequestResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\TestPermissionsResponse - * - * @throws ApiException if the remote call fails - */ - public function testIamPermissions($project, $resource, $testPermissionsRequestResource, array $optionalArgs = []) - { - $request = new TestIamPermissionsImageRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setResource($resource); - $request->setTestPermissionsRequestResource($testPermissionsRequestResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['resource'] = $resource; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('TestIamPermissions', TestPermissionsResponse::class, $optionalArgs, $request)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/InstanceGroupManagerResizeRequestsGapicClient.php b/Compute/src/V1/Gapic/InstanceGroupManagerResizeRequestsGapicClient.php deleted file mode 100644 index 34ac2edc71fc..000000000000 --- a/Compute/src/V1/Gapic/InstanceGroupManagerResizeRequestsGapicClient.php +++ /dev/null @@ -1,645 +0,0 @@ -cancel($instanceGroupManager, $project, $resizeRequest, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instanceGroupManagerResizeRequestsClient->cancel($instanceGroupManager, $project, $resizeRequest, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instanceGroupManagerResizeRequestsClient->resumeOperation($operationName, 'cancel'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instanceGroupManagerResizeRequestsClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\InstanceGroupManagerResizeRequestsClient}. - */ -class InstanceGroupManagerResizeRequestsGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.InstanceGroupManagerResizeRequests'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/instance_group_manager_resize_requests_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/instance_group_manager_resize_requests_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/instance_group_manager_resize_requests_rest_client_config.php', - ], - ], - 'operationsClientClass' => ZoneOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an ZoneOperationsClient object with the same endpoint as $this. - * - * @return ZoneOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getZone', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetZoneOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteZoneOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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 the specified resize request and removes it from the queue. Cancelled resize request does no longer wait for the resources to be provisioned. Cancel is only possible for requests that are accepted in the queue. - * - * Sample code: - * ``` - * $instanceGroupManagerResizeRequestsClient = new InstanceGroupManagerResizeRequestsClient(); - * try { - * $instanceGroupManager = 'instance_group_manager'; - * $project = 'project'; - * $resizeRequest = 'resize_request'; - * $zone = 'zone'; - * $operationResponse = $instanceGroupManagerResizeRequestsClient->cancel($instanceGroupManager, $project, $resizeRequest, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instanceGroupManagerResizeRequestsClient->cancel($instanceGroupManager, $project, $resizeRequest, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instanceGroupManagerResizeRequestsClient->resumeOperation($operationName, 'cancel'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instanceGroupManagerResizeRequestsClient->close(); - * } - * ``` - * - * @param string $instanceGroupManager The name of the managed instance group. The name should conform to RFC1035 or be a resource ID. - * @param string $project Project ID for this request. - * @param string $resizeRequest The name of the resize request to cancel. The name should conform to RFC1035 or be a resource ID. - * @param string $zone The name of the zone where the managed instance group is located. The name should conform to RFC1035. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 cancel($instanceGroupManager, $project, $resizeRequest, $zone, array $optionalArgs = []) - { - $request = new CancelInstanceGroupManagerResizeRequestRequest(); - $requestParamHeaders = []; - $request->setInstanceGroupManager($instanceGroupManager); - $request->setProject($project); - $request->setResizeRequest($resizeRequest); - $request->setZone($zone); - $requestParamHeaders['instance_group_manager'] = $instanceGroupManager; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['resize_request'] = $resizeRequest; - $requestParamHeaders['zone'] = $zone; - 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('Cancel', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Deletes the specified, inactive resize request. Requests that are still active cannot be deleted. Deleting request does not delete instances that were provisioned previously. - * - * Sample code: - * ``` - * $instanceGroupManagerResizeRequestsClient = new InstanceGroupManagerResizeRequestsClient(); - * try { - * $instanceGroupManager = 'instance_group_manager'; - * $project = 'project'; - * $resizeRequest = 'resize_request'; - * $zone = 'zone'; - * $operationResponse = $instanceGroupManagerResizeRequestsClient->delete($instanceGroupManager, $project, $resizeRequest, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instanceGroupManagerResizeRequestsClient->delete($instanceGroupManager, $project, $resizeRequest, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instanceGroupManagerResizeRequestsClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instanceGroupManagerResizeRequestsClient->close(); - * } - * ``` - * - * @param string $instanceGroupManager The name of the managed instance group. The name should conform to RFC1035 or be a resource ID. - * @param string $project Project ID for this request. - * @param string $resizeRequest The name of the resize request to delete. The name should conform to RFC1035 or be a resource ID. - * @param string $zone The name of the zone where the managed instance group is located. The name should conform to RFC1035. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($instanceGroupManager, $project, $resizeRequest, $zone, array $optionalArgs = []) - { - $request = new DeleteInstanceGroupManagerResizeRequestRequest(); - $requestParamHeaders = []; - $request->setInstanceGroupManager($instanceGroupManager); - $request->setProject($project); - $request->setResizeRequest($resizeRequest); - $request->setZone($zone); - $requestParamHeaders['instance_group_manager'] = $instanceGroupManager; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['resize_request'] = $resizeRequest; - $requestParamHeaders['zone'] = $zone; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns all of the details about the specified resize request. - * - * Sample code: - * ``` - * $instanceGroupManagerResizeRequestsClient = new InstanceGroupManagerResizeRequestsClient(); - * try { - * $instanceGroupManager = 'instance_group_manager'; - * $project = 'project'; - * $resizeRequest = 'resize_request'; - * $zone = 'zone'; - * $response = $instanceGroupManagerResizeRequestsClient->get($instanceGroupManager, $project, $resizeRequest, $zone); - * } finally { - * $instanceGroupManagerResizeRequestsClient->close(); - * } - * ``` - * - * @param string $instanceGroupManager The name of the managed instance group. Name should conform to RFC1035 or be a resource ID. - * @param string $project Project ID for this request. - * @param string $resizeRequest The name of the resize request. Name should conform to RFC1035 or be a resource ID. - * @param string $zone Name of the href="/compute/docs/regions-zones/#available">zone scoping this request. Name should conform to RFC1035. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\InstanceGroupManagerResizeRequest - * - * @throws ApiException if the remote call fails - */ - public function get($instanceGroupManager, $project, $resizeRequest, $zone, array $optionalArgs = []) - { - $request = new GetInstanceGroupManagerResizeRequestRequest(); - $requestParamHeaders = []; - $request->setInstanceGroupManager($instanceGroupManager); - $request->setProject($project); - $request->setResizeRequest($resizeRequest); - $request->setZone($zone); - $requestParamHeaders['instance_group_manager'] = $instanceGroupManager; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['resize_request'] = $resizeRequest; - $requestParamHeaders['zone'] = $zone; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', InstanceGroupManagerResizeRequest::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates a new resize request that starts provisioning VMs immediately or queues VM creation. - * - * Sample code: - * ``` - * $instanceGroupManagerResizeRequestsClient = new InstanceGroupManagerResizeRequestsClient(); - * try { - * $instanceGroupManager = 'instance_group_manager'; - * $instanceGroupManagerResizeRequestResource = new InstanceGroupManagerResizeRequest(); - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $instanceGroupManagerResizeRequestsClient->insert($instanceGroupManager, $instanceGroupManagerResizeRequestResource, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instanceGroupManagerResizeRequestsClient->insert($instanceGroupManager, $instanceGroupManagerResizeRequestResource, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instanceGroupManagerResizeRequestsClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instanceGroupManagerResizeRequestsClient->close(); - * } - * ``` - * - * @param string $instanceGroupManager The name of the managed instance group to which the resize request will be added. Name should conform to RFC1035 or be a resource ID. - * @param InstanceGroupManagerResizeRequest $instanceGroupManagerResizeRequestResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $zone The name of the zone where the managed instance group is located and where the resize request will be created. Name should conform to RFC1035. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 insert($instanceGroupManager, $instanceGroupManagerResizeRequestResource, $project, $zone, array $optionalArgs = []) - { - $request = new InsertInstanceGroupManagerResizeRequestRequest(); - $requestParamHeaders = []; - $request->setInstanceGroupManager($instanceGroupManager); - $request->setInstanceGroupManagerResizeRequestResource($instanceGroupManagerResizeRequestResource); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['instance_group_manager'] = $instanceGroupManager; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Retrieves a list of resize requests that are contained in the managed instance group. - * - * Sample code: - * ``` - * $instanceGroupManagerResizeRequestsClient = new InstanceGroupManagerResizeRequestsClient(); - * try { - * $instanceGroupManager = 'instance_group_manager'; - * $project = 'project'; - * $zone = 'zone'; - * // Iterate over pages of elements - * $pagedResponse = $instanceGroupManagerResizeRequestsClient->list($instanceGroupManager, $project, $zone); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $instanceGroupManagerResizeRequestsClient->list($instanceGroupManager, $project, $zone); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $instanceGroupManagerResizeRequestsClient->close(); - * } - * ``` - * - * @param string $instanceGroupManager The name of the managed instance group. The name should conform to RFC1035. - * @param string $project Project ID for this request. - * @param string $zone The name of the zone where the managed instance group is located. The name should conform to RFC1035. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($instanceGroupManager, $project, $zone, array $optionalArgs = []) - { - $request = new ListInstanceGroupManagerResizeRequestsRequest(); - $requestParamHeaders = []; - $request->setInstanceGroupManager($instanceGroupManager); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['instance_group_manager'] = $instanceGroupManager; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, InstanceGroupManagerResizeRequestsListResponse::class, $request); - } -} diff --git a/Compute/src/V1/Gapic/InstanceGroupManagersGapicClient.php b/Compute/src/V1/Gapic/InstanceGroupManagersGapicClient.php deleted file mode 100644 index a8de4eaf8593..000000000000 --- a/Compute/src/V1/Gapic/InstanceGroupManagersGapicClient.php +++ /dev/null @@ -1,2210 +0,0 @@ -abandonInstances($instanceGroupManager, $instanceGroupManagersAbandonInstancesRequestResource, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instanceGroupManagersClient->abandonInstances($instanceGroupManager, $instanceGroupManagersAbandonInstancesRequestResource, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instanceGroupManagersClient->resumeOperation($operationName, 'abandonInstances'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instanceGroupManagersClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\InstanceGroupManagersClient}. - */ -class InstanceGroupManagersGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.InstanceGroupManagers'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/instance_group_managers_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/instance_group_managers_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/instance_group_managers_rest_client_config.php', - ], - ], - 'operationsClientClass' => ZoneOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an ZoneOperationsClient object with the same endpoint as $this. - * - * @return ZoneOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getZone', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetZoneOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteZoneOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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); - } - - /** - * Flags the specified instances to be removed from the managed instance group. Abandoning an instance does not delete the instance, but it does remove the instance from any target pools that are applied by the managed instance group. This method reduces the targetSize of the managed instance group by the number of instances that you abandon. This operation is marked as DONE when the action is scheduled even if the instances have not yet been removed from the group. You must separately verify the status of the abandoning action with the listmanagedinstances method. If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is removed or deleted. You can specify a maximum of 1000 instances with this method per request. - * - * Sample code: - * ``` - * $instanceGroupManagersClient = new InstanceGroupManagersClient(); - * try { - * $instanceGroupManager = 'instance_group_manager'; - * $instanceGroupManagersAbandonInstancesRequestResource = new InstanceGroupManagersAbandonInstancesRequest(); - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $instanceGroupManagersClient->abandonInstances($instanceGroupManager, $instanceGroupManagersAbandonInstancesRequestResource, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instanceGroupManagersClient->abandonInstances($instanceGroupManager, $instanceGroupManagersAbandonInstancesRequestResource, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instanceGroupManagersClient->resumeOperation($operationName, 'abandonInstances'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instanceGroupManagersClient->close(); - * } - * ``` - * - * @param string $instanceGroupManager The name of the managed instance group. - * @param InstanceGroupManagersAbandonInstancesRequest $instanceGroupManagersAbandonInstancesRequestResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $zone The name of the zone where the managed instance group is located. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 abandonInstances($instanceGroupManager, $instanceGroupManagersAbandonInstancesRequestResource, $project, $zone, array $optionalArgs = []) - { - $request = new AbandonInstancesInstanceGroupManagerRequest(); - $requestParamHeaders = []; - $request->setInstanceGroupManager($instanceGroupManager); - $request->setInstanceGroupManagersAbandonInstancesRequestResource($instanceGroupManagersAbandonInstancesRequestResource); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['instance_group_manager'] = $instanceGroupManager; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('AbandonInstances', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Retrieves the list of managed instance groups and groups them by zone. To prevent failure, Google recommends that you set the `returnPartialSuccess` parameter to `true`. - * - * Sample code: - * ``` - * $instanceGroupManagersClient = new InstanceGroupManagersClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $instanceGroupManagersClient->aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $instanceGroupManagersClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $instanceGroupManagersClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type bool $includeAllScopes - * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type int $serviceProjectNumber - * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable 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 aggregatedList($project, array $optionalArgs = []) - { - $request = new AggregatedListInstanceGroupManagersRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['includeAllScopes'])) { - $request->setIncludeAllScopes($optionalArgs['includeAllScopes']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - if (isset($optionalArgs['serviceProjectNumber'])) { - $request->setServiceProjectNumber($optionalArgs['serviceProjectNumber']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('AggregatedList', $optionalArgs, InstanceGroupManagerAggregatedList::class, $request); - } - - /** - * Applies changes to selected instances on the managed instance group. This method can be used to apply new overrides and/or new versions. - * - * Sample code: - * ``` - * $instanceGroupManagersClient = new InstanceGroupManagersClient(); - * try { - * $instanceGroupManager = 'instance_group_manager'; - * $instanceGroupManagersApplyUpdatesRequestResource = new InstanceGroupManagersApplyUpdatesRequest(); - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $instanceGroupManagersClient->applyUpdatesToInstances($instanceGroupManager, $instanceGroupManagersApplyUpdatesRequestResource, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instanceGroupManagersClient->applyUpdatesToInstances($instanceGroupManager, $instanceGroupManagersApplyUpdatesRequestResource, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instanceGroupManagersClient->resumeOperation($operationName, 'applyUpdatesToInstances'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instanceGroupManagersClient->close(); - * } - * ``` - * - * @param string $instanceGroupManager The name of the managed instance group, should conform to RFC1035. - * @param InstanceGroupManagersApplyUpdatesRequest $instanceGroupManagersApplyUpdatesRequestResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $zone The name of the zone where the managed instance group is located. Should conform to RFC1035. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 applyUpdatesToInstances($instanceGroupManager, $instanceGroupManagersApplyUpdatesRequestResource, $project, $zone, array $optionalArgs = []) - { - $request = new ApplyUpdatesToInstancesInstanceGroupManagerRequest(); - $requestParamHeaders = []; - $request->setInstanceGroupManager($instanceGroupManager); - $request->setInstanceGroupManagersApplyUpdatesRequestResource($instanceGroupManagersApplyUpdatesRequestResource); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['instance_group_manager'] = $instanceGroupManager; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('ApplyUpdatesToInstances', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Creates instances with per-instance configurations in this managed instance group. Instances are created using the current instance template. The create instances operation is marked DONE if the createInstances request is successful. The underlying actions take additional time. You must separately verify the status of the creating or actions with the listmanagedinstances method. - * - * Sample code: - * ``` - * $instanceGroupManagersClient = new InstanceGroupManagersClient(); - * try { - * $instanceGroupManager = 'instance_group_manager'; - * $instanceGroupManagersCreateInstancesRequestResource = new InstanceGroupManagersCreateInstancesRequest(); - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $instanceGroupManagersClient->createInstances($instanceGroupManager, $instanceGroupManagersCreateInstancesRequestResource, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instanceGroupManagersClient->createInstances($instanceGroupManager, $instanceGroupManagersCreateInstancesRequestResource, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instanceGroupManagersClient->resumeOperation($operationName, 'createInstances'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instanceGroupManagersClient->close(); - * } - * ``` - * - * @param string $instanceGroupManager The name of the managed instance group. It should conform to RFC1035. - * @param InstanceGroupManagersCreateInstancesRequest $instanceGroupManagersCreateInstancesRequestResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $zone The name of the zone where the managed instance group is located. It should conform to RFC1035. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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. 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 createInstances($instanceGroupManager, $instanceGroupManagersCreateInstancesRequestResource, $project, $zone, array $optionalArgs = []) - { - $request = new CreateInstancesInstanceGroupManagerRequest(); - $requestParamHeaders = []; - $request->setInstanceGroupManager($instanceGroupManager); - $request->setInstanceGroupManagersCreateInstancesRequestResource($instanceGroupManagersCreateInstancesRequestResource); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['instance_group_manager'] = $instanceGroupManager; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('CreateInstances', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Deletes the specified managed instance group and all of the instances in that group. Note that the instance group must not belong to a backend service. Read Deleting an instance group for more information. - * - * Sample code: - * ``` - * $instanceGroupManagersClient = new InstanceGroupManagersClient(); - * try { - * $instanceGroupManager = 'instance_group_manager'; - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $instanceGroupManagersClient->delete($instanceGroupManager, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instanceGroupManagersClient->delete($instanceGroupManager, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instanceGroupManagersClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instanceGroupManagersClient->close(); - * } - * ``` - * - * @param string $instanceGroupManager The name of the managed instance group to delete. - * @param string $project Project ID for this request. - * @param string $zone The name of the zone where the managed instance group is located. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($instanceGroupManager, $project, $zone, array $optionalArgs = []) - { - $request = new DeleteInstanceGroupManagerRequest(); - $requestParamHeaders = []; - $request->setInstanceGroupManager($instanceGroupManager); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['instance_group_manager'] = $instanceGroupManager; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Flags the specified instances in the managed instance group for immediate deletion. The instances are also removed from any target pools of which they were a member. This method reduces the targetSize of the managed instance group by the number of instances that you delete. This operation is marked as DONE when the action is scheduled even if the instances are still being deleted. You must separately verify the status of the deleting action with the listmanagedinstances method. If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is removed or deleted. You can specify a maximum of 1000 instances with this method per request. - * - * Sample code: - * ``` - * $instanceGroupManagersClient = new InstanceGroupManagersClient(); - * try { - * $instanceGroupManager = 'instance_group_manager'; - * $instanceGroupManagersDeleteInstancesRequestResource = new InstanceGroupManagersDeleteInstancesRequest(); - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $instanceGroupManagersClient->deleteInstances($instanceGroupManager, $instanceGroupManagersDeleteInstancesRequestResource, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instanceGroupManagersClient->deleteInstances($instanceGroupManager, $instanceGroupManagersDeleteInstancesRequestResource, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instanceGroupManagersClient->resumeOperation($operationName, 'deleteInstances'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instanceGroupManagersClient->close(); - * } - * ``` - * - * @param string $instanceGroupManager The name of the managed instance group. - * @param InstanceGroupManagersDeleteInstancesRequest $instanceGroupManagersDeleteInstancesRequestResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $zone The name of the zone where the managed instance group is located. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 deleteInstances($instanceGroupManager, $instanceGroupManagersDeleteInstancesRequestResource, $project, $zone, array $optionalArgs = []) - { - $request = new DeleteInstancesInstanceGroupManagerRequest(); - $requestParamHeaders = []; - $request->setInstanceGroupManager($instanceGroupManager); - $request->setInstanceGroupManagersDeleteInstancesRequestResource($instanceGroupManagersDeleteInstancesRequestResource); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['instance_group_manager'] = $instanceGroupManager; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('DeleteInstances', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Deletes selected per-instance configurations for the managed instance group. - * - * Sample code: - * ``` - * $instanceGroupManagersClient = new InstanceGroupManagersClient(); - * try { - * $instanceGroupManager = 'instance_group_manager'; - * $instanceGroupManagersDeletePerInstanceConfigsReqResource = new InstanceGroupManagersDeletePerInstanceConfigsReq(); - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $instanceGroupManagersClient->deletePerInstanceConfigs($instanceGroupManager, $instanceGroupManagersDeletePerInstanceConfigsReqResource, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instanceGroupManagersClient->deletePerInstanceConfigs($instanceGroupManager, $instanceGroupManagersDeletePerInstanceConfigsReqResource, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instanceGroupManagersClient->resumeOperation($operationName, 'deletePerInstanceConfigs'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instanceGroupManagersClient->close(); - * } - * ``` - * - * @param string $instanceGroupManager The name of the managed instance group. It should conform to RFC1035. - * @param InstanceGroupManagersDeletePerInstanceConfigsReq $instanceGroupManagersDeletePerInstanceConfigsReqResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $zone The name of the zone where the managed instance group is located. It should conform to RFC1035. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 deletePerInstanceConfigs($instanceGroupManager, $instanceGroupManagersDeletePerInstanceConfigsReqResource, $project, $zone, array $optionalArgs = []) - { - $request = new DeletePerInstanceConfigsInstanceGroupManagerRequest(); - $requestParamHeaders = []; - $request->setInstanceGroupManager($instanceGroupManager); - $request->setInstanceGroupManagersDeletePerInstanceConfigsReqResource($instanceGroupManagersDeletePerInstanceConfigsReqResource); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['instance_group_manager'] = $instanceGroupManager; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('DeletePerInstanceConfigs', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns all of the details about the specified managed instance group. - * - * Sample code: - * ``` - * $instanceGroupManagersClient = new InstanceGroupManagersClient(); - * try { - * $instanceGroupManager = 'instance_group_manager'; - * $project = 'project'; - * $zone = 'zone'; - * $response = $instanceGroupManagersClient->get($instanceGroupManager, $project, $zone); - * } finally { - * $instanceGroupManagersClient->close(); - * } - * ``` - * - * @param string $instanceGroupManager The name of the managed instance group. - * @param string $project Project ID for this request. - * @param string $zone The name of the zone where the managed instance group is located. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\InstanceGroupManager - * - * @throws ApiException if the remote call fails - */ - public function get($instanceGroupManager, $project, $zone, array $optionalArgs = []) - { - $request = new GetInstanceGroupManagerRequest(); - $requestParamHeaders = []; - $request->setInstanceGroupManager($instanceGroupManager); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['instance_group_manager'] = $instanceGroupManager; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', InstanceGroupManager::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates a managed instance group using the information that you specify in the request. After the group is created, instances in the group are created using the specified instance template. This operation is marked as DONE when the group is created even if the instances in the group have not yet been created. You must separately verify the status of the individual instances with the listmanagedinstances method. A managed instance group can have up to 1000 VM instances per group. Please contact Cloud Support if you need an increase in this limit. - * - * Sample code: - * ``` - * $instanceGroupManagersClient = new InstanceGroupManagersClient(); - * try { - * $instanceGroupManagerResource = new InstanceGroupManager(); - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $instanceGroupManagersClient->insert($instanceGroupManagerResource, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instanceGroupManagersClient->insert($instanceGroupManagerResource, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instanceGroupManagersClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instanceGroupManagersClient->close(); - * } - * ``` - * - * @param InstanceGroupManager $instanceGroupManagerResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $zone The name of the zone where you want to create the managed instance group. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 insert($instanceGroupManagerResource, $project, $zone, array $optionalArgs = []) - { - $request = new InsertInstanceGroupManagerRequest(); - $requestParamHeaders = []; - $request->setInstanceGroupManagerResource($instanceGroupManagerResource); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Retrieves a list of managed instance groups that are contained within the specified project and zone. - * - * Sample code: - * ``` - * $instanceGroupManagersClient = new InstanceGroupManagersClient(); - * try { - * $project = 'project'; - * $zone = 'zone'; - * // Iterate over pages of elements - * $pagedResponse = $instanceGroupManagersClient->list($project, $zone); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $instanceGroupManagersClient->list($project, $zone); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $instanceGroupManagersClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $zone The name of the zone where the managed instance group is located. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, $zone, array $optionalArgs = []) - { - $request = new ListInstanceGroupManagersRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, InstanceGroupManagerList::class, $request); - } - - /** - * Lists all errors thrown by actions on instances for a given managed instance group. The filter and orderBy query parameters are not supported. - * - * Sample code: - * ``` - * $instanceGroupManagersClient = new InstanceGroupManagersClient(); - * try { - * $instanceGroupManager = 'instance_group_manager'; - * $project = 'project'; - * $zone = 'zone'; - * // Iterate over pages of elements - * $pagedResponse = $instanceGroupManagersClient->listErrors($instanceGroupManager, $project, $zone); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $instanceGroupManagersClient->listErrors($instanceGroupManager, $project, $zone); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $instanceGroupManagersClient->close(); - * } - * ``` - * - * @param string $instanceGroupManager The name of the managed instance group. It must be a string that meets the requirements in RFC1035, or an unsigned long integer: must match regexp pattern: (?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?)|1-9{0,19}. - * @param string $project Project ID for this request. - * @param string $zone The name of the zone where the managed instance group is located. It should conform to RFC1035. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 listErrors($instanceGroupManager, $project, $zone, array $optionalArgs = []) - { - $request = new ListErrorsInstanceGroupManagersRequest(); - $requestParamHeaders = []; - $request->setInstanceGroupManager($instanceGroupManager); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['instance_group_manager'] = $instanceGroupManager; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('ListErrors', $optionalArgs, InstanceGroupManagersListErrorsResponse::class, $request); - } - - /** - * Lists all of the instances in the managed instance group. Each instance in the list has a currentAction, which indicates the action that the managed instance group is performing on the instance. For example, if the group is still creating an instance, the currentAction is CREATING. If a previous action failed, the list displays the errors for that failed action. The orderBy query parameter is not supported. The `pageToken` query parameter is supported only if the group's `listManagedInstancesResults` field is set to `PAGINATED`. - * - * Sample code: - * ``` - * $instanceGroupManagersClient = new InstanceGroupManagersClient(); - * try { - * $instanceGroupManager = 'instance_group_manager'; - * $project = 'project'; - * $zone = 'zone'; - * // Iterate over pages of elements - * $pagedResponse = $instanceGroupManagersClient->listManagedInstances($instanceGroupManager, $project, $zone); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $instanceGroupManagersClient->listManagedInstances($instanceGroupManager, $project, $zone); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $instanceGroupManagersClient->close(); - * } - * ``` - * - * @param string $instanceGroupManager The name of the managed instance group. - * @param string $project Project ID for this request. - * @param string $zone The name of the zone where the managed instance group is located. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 listManagedInstances($instanceGroupManager, $project, $zone, array $optionalArgs = []) - { - $request = new ListManagedInstancesInstanceGroupManagersRequest(); - $requestParamHeaders = []; - $request->setInstanceGroupManager($instanceGroupManager); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['instance_group_manager'] = $instanceGroupManager; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('ListManagedInstances', $optionalArgs, InstanceGroupManagersListManagedInstancesResponse::class, $request); - } - - /** - * Lists all of the per-instance configurations defined for the managed instance group. The orderBy query parameter is not supported. - * - * Sample code: - * ``` - * $instanceGroupManagersClient = new InstanceGroupManagersClient(); - * try { - * $instanceGroupManager = 'instance_group_manager'; - * $project = 'project'; - * $zone = 'zone'; - * // Iterate over pages of elements - * $pagedResponse = $instanceGroupManagersClient->listPerInstanceConfigs($instanceGroupManager, $project, $zone); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $instanceGroupManagersClient->listPerInstanceConfigs($instanceGroupManager, $project, $zone); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $instanceGroupManagersClient->close(); - * } - * ``` - * - * @param string $instanceGroupManager The name of the managed instance group. It should conform to RFC1035. - * @param string $project Project ID for this request. - * @param string $zone The name of the zone where the managed instance group is located. It should conform to RFC1035. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 listPerInstanceConfigs($instanceGroupManager, $project, $zone, array $optionalArgs = []) - { - $request = new ListPerInstanceConfigsInstanceGroupManagersRequest(); - $requestParamHeaders = []; - $request->setInstanceGroupManager($instanceGroupManager); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['instance_group_manager'] = $instanceGroupManager; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('ListPerInstanceConfigs', $optionalArgs, InstanceGroupManagersListPerInstanceConfigsResp::class, $request); - } - - /** - * Updates a managed instance group using the information that you specify in the request. This operation is marked as DONE when the group is patched even if the instances in the group are still in the process of being patched. You must separately verify the status of the individual instances with the listManagedInstances method. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. If you update your group to specify a new template or instance configuration, it's possible that your intended specification for each VM in the group is different from the current state of that VM. To learn how to apply an updated configuration to the VMs in a MIG, see Updating instances in a MIG. - * - * Sample code: - * ``` - * $instanceGroupManagersClient = new InstanceGroupManagersClient(); - * try { - * $instanceGroupManager = 'instance_group_manager'; - * $instanceGroupManagerResource = new InstanceGroupManager(); - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $instanceGroupManagersClient->patch($instanceGroupManager, $instanceGroupManagerResource, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instanceGroupManagersClient->patch($instanceGroupManager, $instanceGroupManagerResource, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instanceGroupManagersClient->resumeOperation($operationName, 'patch'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instanceGroupManagersClient->close(); - * } - * ``` - * - * @param string $instanceGroupManager The name of the instance group manager. - * @param InstanceGroupManager $instanceGroupManagerResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $zone The name of the zone where you want to create the managed instance group. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 patch($instanceGroupManager, $instanceGroupManagerResource, $project, $zone, array $optionalArgs = []) - { - $request = new PatchInstanceGroupManagerRequest(); - $requestParamHeaders = []; - $request->setInstanceGroupManager($instanceGroupManager); - $request->setInstanceGroupManagerResource($instanceGroupManagerResource); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['instance_group_manager'] = $instanceGroupManager; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('Patch', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Inserts or patches per-instance configurations for the managed instance group. perInstanceConfig.name serves as a key used to distinguish whether to perform insert or patch. - * - * Sample code: - * ``` - * $instanceGroupManagersClient = new InstanceGroupManagersClient(); - * try { - * $instanceGroupManager = 'instance_group_manager'; - * $instanceGroupManagersPatchPerInstanceConfigsReqResource = new InstanceGroupManagersPatchPerInstanceConfigsReq(); - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $instanceGroupManagersClient->patchPerInstanceConfigs($instanceGroupManager, $instanceGroupManagersPatchPerInstanceConfigsReqResource, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instanceGroupManagersClient->patchPerInstanceConfigs($instanceGroupManager, $instanceGroupManagersPatchPerInstanceConfigsReqResource, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instanceGroupManagersClient->resumeOperation($operationName, 'patchPerInstanceConfigs'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instanceGroupManagersClient->close(); - * } - * ``` - * - * @param string $instanceGroupManager The name of the managed instance group. It should conform to RFC1035. - * @param InstanceGroupManagersPatchPerInstanceConfigsReq $instanceGroupManagersPatchPerInstanceConfigsReqResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $zone The name of the zone where the managed instance group is located. It should conform to RFC1035. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 patchPerInstanceConfigs($instanceGroupManager, $instanceGroupManagersPatchPerInstanceConfigsReqResource, $project, $zone, array $optionalArgs = []) - { - $request = new PatchPerInstanceConfigsInstanceGroupManagerRequest(); - $requestParamHeaders = []; - $request->setInstanceGroupManager($instanceGroupManager); - $request->setInstanceGroupManagersPatchPerInstanceConfigsReqResource($instanceGroupManagersPatchPerInstanceConfigsReqResource); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['instance_group_manager'] = $instanceGroupManager; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('PatchPerInstanceConfigs', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Flags the specified VM instances in the managed instance group to be immediately recreated. Each instance is recreated using the group's current configuration. This operation is marked as DONE when the flag is set even if the instances have not yet been recreated. You must separately verify the status of each instance by checking its currentAction field; for more information, see Checking the status of managed instances. If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is removed or deleted. You can specify a maximum of 1000 instances with this method per request. - * - * Sample code: - * ``` - * $instanceGroupManagersClient = new InstanceGroupManagersClient(); - * try { - * $instanceGroupManager = 'instance_group_manager'; - * $instanceGroupManagersRecreateInstancesRequestResource = new InstanceGroupManagersRecreateInstancesRequest(); - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $instanceGroupManagersClient->recreateInstances($instanceGroupManager, $instanceGroupManagersRecreateInstancesRequestResource, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instanceGroupManagersClient->recreateInstances($instanceGroupManager, $instanceGroupManagersRecreateInstancesRequestResource, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instanceGroupManagersClient->resumeOperation($operationName, 'recreateInstances'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instanceGroupManagersClient->close(); - * } - * ``` - * - * @param string $instanceGroupManager The name of the managed instance group. - * @param InstanceGroupManagersRecreateInstancesRequest $instanceGroupManagersRecreateInstancesRequestResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $zone The name of the zone where the managed instance group is located. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 recreateInstances($instanceGroupManager, $instanceGroupManagersRecreateInstancesRequestResource, $project, $zone, array $optionalArgs = []) - { - $request = new RecreateInstancesInstanceGroupManagerRequest(); - $requestParamHeaders = []; - $request->setInstanceGroupManager($instanceGroupManager); - $request->setInstanceGroupManagersRecreateInstancesRequestResource($instanceGroupManagersRecreateInstancesRequestResource); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['instance_group_manager'] = $instanceGroupManager; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('RecreateInstances', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Resizes the managed instance group. If you increase the size, the group creates new instances using the current instance template. If you decrease the size, the group deletes instances. The resize operation is marked DONE when the resize actions are scheduled even if the group has not yet added or deleted any instances. You must separately verify the status of the creating or deleting actions with the listmanagedinstances method. When resizing down, the instance group arbitrarily chooses the order in which VMs are deleted. The group takes into account some VM attributes when making the selection including: + The status of the VM instance. + The health of the VM instance. + The instance template version the VM is based on. + For regional managed instance groups, the location of the VM instance. This list is subject to change. If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is removed or deleted. - * - * Sample code: - * ``` - * $instanceGroupManagersClient = new InstanceGroupManagersClient(); - * try { - * $instanceGroupManager = 'instance_group_manager'; - * $project = 'project'; - * $size = 0; - * $zone = 'zone'; - * $operationResponse = $instanceGroupManagersClient->resize($instanceGroupManager, $project, $size, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instanceGroupManagersClient->resize($instanceGroupManager, $project, $size, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instanceGroupManagersClient->resumeOperation($operationName, 'resize'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instanceGroupManagersClient->close(); - * } - * ``` - * - * @param string $instanceGroupManager The name of the managed instance group. - * @param string $project Project ID for this request. - * @param int $size The number of running instances that the managed instance group should maintain at any given time. The group automatically adds or removes instances to maintain the number of instances specified by this parameter. - * @param string $zone The name of the zone where the managed instance group is located. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 resize($instanceGroupManager, $project, $size, $zone, array $optionalArgs = []) - { - $request = new ResizeInstanceGroupManagerRequest(); - $requestParamHeaders = []; - $request->setInstanceGroupManager($instanceGroupManager); - $request->setProject($project); - $request->setSize($size); - $request->setZone($zone); - $requestParamHeaders['instance_group_manager'] = $instanceGroupManager; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('Resize', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Flags the specified instances in the managed instance group to be resumed. This method increases the targetSize and decreases the targetSuspendedSize of the managed instance group by the number of instances that you resume. The resumeInstances operation is marked DONE if the resumeInstances request is successful. The underlying actions take additional time. You must separately verify the status of the RESUMING action with the listmanagedinstances method. In this request, you can only specify instances that are suspended. For example, if an instance was previously suspended using the suspendInstances method, it can be resumed using the resumeInstances method. If a health check is attached to the managed instance group, the specified instances will be verified as healthy after they are resumed. You can specify a maximum of 1000 instances with this method per request. - * - * Sample code: - * ``` - * $instanceGroupManagersClient = new InstanceGroupManagersClient(); - * try { - * $instanceGroupManager = 'instance_group_manager'; - * $instanceGroupManagersResumeInstancesRequestResource = new InstanceGroupManagersResumeInstancesRequest(); - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $instanceGroupManagersClient->resumeInstances($instanceGroupManager, $instanceGroupManagersResumeInstancesRequestResource, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instanceGroupManagersClient->resumeInstances($instanceGroupManager, $instanceGroupManagersResumeInstancesRequestResource, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instanceGroupManagersClient->resumeOperation($operationName, 'resumeInstances'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instanceGroupManagersClient->close(); - * } - * ``` - * - * @param string $instanceGroupManager The name of the managed instance group. - * @param InstanceGroupManagersResumeInstancesRequest $instanceGroupManagersResumeInstancesRequestResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $zone The name of the zone where the managed instance group is located. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 resumeInstances($instanceGroupManager, $instanceGroupManagersResumeInstancesRequestResource, $project, $zone, array $optionalArgs = []) - { - $request = new ResumeInstancesInstanceGroupManagerRequest(); - $requestParamHeaders = []; - $request->setInstanceGroupManager($instanceGroupManager); - $request->setInstanceGroupManagersResumeInstancesRequestResource($instanceGroupManagersResumeInstancesRequestResource); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['instance_group_manager'] = $instanceGroupManager; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('ResumeInstances', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Specifies the instance template to use when creating new instances in this group. The templates for existing instances in the group do not change unless you run recreateInstances, run applyUpdatesToInstances, or set the group's updatePolicy.type to PROACTIVE. - * - * Sample code: - * ``` - * $instanceGroupManagersClient = new InstanceGroupManagersClient(); - * try { - * $instanceGroupManager = 'instance_group_manager'; - * $instanceGroupManagersSetInstanceTemplateRequestResource = new InstanceGroupManagersSetInstanceTemplateRequest(); - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $instanceGroupManagersClient->setInstanceTemplate($instanceGroupManager, $instanceGroupManagersSetInstanceTemplateRequestResource, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instanceGroupManagersClient->setInstanceTemplate($instanceGroupManager, $instanceGroupManagersSetInstanceTemplateRequestResource, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instanceGroupManagersClient->resumeOperation($operationName, 'setInstanceTemplate'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instanceGroupManagersClient->close(); - * } - * ``` - * - * @param string $instanceGroupManager The name of the managed instance group. - * @param InstanceGroupManagersSetInstanceTemplateRequest $instanceGroupManagersSetInstanceTemplateRequestResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $zone The name of the zone where the managed instance group is located. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 setInstanceTemplate($instanceGroupManager, $instanceGroupManagersSetInstanceTemplateRequestResource, $project, $zone, array $optionalArgs = []) - { - $request = new SetInstanceTemplateInstanceGroupManagerRequest(); - $requestParamHeaders = []; - $request->setInstanceGroupManager($instanceGroupManager); - $request->setInstanceGroupManagersSetInstanceTemplateRequestResource($instanceGroupManagersSetInstanceTemplateRequestResource); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['instance_group_manager'] = $instanceGroupManager; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('SetInstanceTemplate', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Modifies the target pools to which all instances in this managed instance group are assigned. The target pools automatically apply to all of the instances in the managed instance group. This operation is marked DONE when you make the request even if the instances have not yet been added to their target pools. The change might take some time to apply to all of the instances in the group depending on the size of the group. - * - * Sample code: - * ``` - * $instanceGroupManagersClient = new InstanceGroupManagersClient(); - * try { - * $instanceGroupManager = 'instance_group_manager'; - * $instanceGroupManagersSetTargetPoolsRequestResource = new InstanceGroupManagersSetTargetPoolsRequest(); - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $instanceGroupManagersClient->setTargetPools($instanceGroupManager, $instanceGroupManagersSetTargetPoolsRequestResource, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instanceGroupManagersClient->setTargetPools($instanceGroupManager, $instanceGroupManagersSetTargetPoolsRequestResource, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instanceGroupManagersClient->resumeOperation($operationName, 'setTargetPools'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instanceGroupManagersClient->close(); - * } - * ``` - * - * @param string $instanceGroupManager The name of the managed instance group. - * @param InstanceGroupManagersSetTargetPoolsRequest $instanceGroupManagersSetTargetPoolsRequestResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $zone The name of the zone where the managed instance group is located. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 setTargetPools($instanceGroupManager, $instanceGroupManagersSetTargetPoolsRequestResource, $project, $zone, array $optionalArgs = []) - { - $request = new SetTargetPoolsInstanceGroupManagerRequest(); - $requestParamHeaders = []; - $request->setInstanceGroupManager($instanceGroupManager); - $request->setInstanceGroupManagersSetTargetPoolsRequestResource($instanceGroupManagersSetTargetPoolsRequestResource); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['instance_group_manager'] = $instanceGroupManager; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('SetTargetPools', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Flags the specified instances in the managed instance group to be started. This method increases the targetSize and decreases the targetStoppedSize of the managed instance group by the number of instances that you start. The startInstances operation is marked DONE if the startInstances request is successful. The underlying actions take additional time. You must separately verify the status of the STARTING action with the listmanagedinstances method. In this request, you can only specify instances that are stopped. For example, if an instance was previously stopped using the stopInstances method, it can be started using the startInstances method. If a health check is attached to the managed instance group, the specified instances will be verified as healthy after they are started. You can specify a maximum of 1000 instances with this method per request. - * - * Sample code: - * ``` - * $instanceGroupManagersClient = new InstanceGroupManagersClient(); - * try { - * $instanceGroupManager = 'instance_group_manager'; - * $instanceGroupManagersStartInstancesRequestResource = new InstanceGroupManagersStartInstancesRequest(); - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $instanceGroupManagersClient->startInstances($instanceGroupManager, $instanceGroupManagersStartInstancesRequestResource, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instanceGroupManagersClient->startInstances($instanceGroupManager, $instanceGroupManagersStartInstancesRequestResource, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instanceGroupManagersClient->resumeOperation($operationName, 'startInstances'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instanceGroupManagersClient->close(); - * } - * ``` - * - * @param string $instanceGroupManager The name of the managed instance group. - * @param InstanceGroupManagersStartInstancesRequest $instanceGroupManagersStartInstancesRequestResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $zone The name of the zone where the managed instance group is located. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 startInstances($instanceGroupManager, $instanceGroupManagersStartInstancesRequestResource, $project, $zone, array $optionalArgs = []) - { - $request = new StartInstancesInstanceGroupManagerRequest(); - $requestParamHeaders = []; - $request->setInstanceGroupManager($instanceGroupManager); - $request->setInstanceGroupManagersStartInstancesRequestResource($instanceGroupManagersStartInstancesRequestResource); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['instance_group_manager'] = $instanceGroupManager; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('StartInstances', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Flags the specified instances in the managed instance group to be immediately stopped. You can only specify instances that are running in this request. This method reduces the targetSize and increases the targetStoppedSize of the managed instance group by the number of instances that you stop. The stopInstances operation is marked DONE if the stopInstances request is successful. The underlying actions take additional time. You must separately verify the status of the STOPPING action with the listmanagedinstances method. If the standbyPolicy.initialDelaySec field is set, the group delays stopping the instances until initialDelaySec have passed from instance.creationTimestamp (that is, when the instance was created). This delay gives your application time to set itself up and initialize on the instance. If more than initialDelaySec seconds have passed since instance.creationTimestamp when this method is called, there will be zero delay. If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is stopped. Stopped instances can be started using the startInstances method. You can specify a maximum of 1000 instances with this method per request. - * - * Sample code: - * ``` - * $instanceGroupManagersClient = new InstanceGroupManagersClient(); - * try { - * $instanceGroupManager = 'instance_group_manager'; - * $instanceGroupManagersStopInstancesRequestResource = new InstanceGroupManagersStopInstancesRequest(); - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $instanceGroupManagersClient->stopInstances($instanceGroupManager, $instanceGroupManagersStopInstancesRequestResource, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instanceGroupManagersClient->stopInstances($instanceGroupManager, $instanceGroupManagersStopInstancesRequestResource, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instanceGroupManagersClient->resumeOperation($operationName, 'stopInstances'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instanceGroupManagersClient->close(); - * } - * ``` - * - * @param string $instanceGroupManager The name of the managed instance group. - * @param InstanceGroupManagersStopInstancesRequest $instanceGroupManagersStopInstancesRequestResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $zone The name of the zone where the managed instance group is located. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 stopInstances($instanceGroupManager, $instanceGroupManagersStopInstancesRequestResource, $project, $zone, array $optionalArgs = []) - { - $request = new StopInstancesInstanceGroupManagerRequest(); - $requestParamHeaders = []; - $request->setInstanceGroupManager($instanceGroupManager); - $request->setInstanceGroupManagersStopInstancesRequestResource($instanceGroupManagersStopInstancesRequestResource); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['instance_group_manager'] = $instanceGroupManager; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('StopInstances', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Flags the specified instances in the managed instance group to be immediately suspended. You can only specify instances that are running in this request. This method reduces the targetSize and increases the targetSuspendedSize of the managed instance group by the number of instances that you suspend. The suspendInstances operation is marked DONE if the suspendInstances request is successful. The underlying actions take additional time. You must separately verify the status of the SUSPENDING action with the listmanagedinstances method. If the standbyPolicy.initialDelaySec field is set, the group delays suspension of the instances until initialDelaySec have passed from instance.creationTimestamp (that is, when the instance was created). This delay gives your application time to set itself up and initialize on the instance. If more than initialDelaySec seconds have passed since instance.creationTimestamp when this method is called, there will be zero delay. If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is suspended. Suspended instances can be resumed using the resumeInstances method. You can specify a maximum of 1000 instances with this method per request. - * - * Sample code: - * ``` - * $instanceGroupManagersClient = new InstanceGroupManagersClient(); - * try { - * $instanceGroupManager = 'instance_group_manager'; - * $instanceGroupManagersSuspendInstancesRequestResource = new InstanceGroupManagersSuspendInstancesRequest(); - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $instanceGroupManagersClient->suspendInstances($instanceGroupManager, $instanceGroupManagersSuspendInstancesRequestResource, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instanceGroupManagersClient->suspendInstances($instanceGroupManager, $instanceGroupManagersSuspendInstancesRequestResource, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instanceGroupManagersClient->resumeOperation($operationName, 'suspendInstances'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instanceGroupManagersClient->close(); - * } - * ``` - * - * @param string $instanceGroupManager The name of the managed instance group. - * @param InstanceGroupManagersSuspendInstancesRequest $instanceGroupManagersSuspendInstancesRequestResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $zone The name of the zone where the managed instance group is located. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 suspendInstances($instanceGroupManager, $instanceGroupManagersSuspendInstancesRequestResource, $project, $zone, array $optionalArgs = []) - { - $request = new SuspendInstancesInstanceGroupManagerRequest(); - $requestParamHeaders = []; - $request->setInstanceGroupManager($instanceGroupManager); - $request->setInstanceGroupManagersSuspendInstancesRequestResource($instanceGroupManagersSuspendInstancesRequestResource); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['instance_group_manager'] = $instanceGroupManager; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('SuspendInstances', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Inserts or updates per-instance configurations for the managed instance group. perInstanceConfig.name serves as a key used to distinguish whether to perform insert or patch. - * - * Sample code: - * ``` - * $instanceGroupManagersClient = new InstanceGroupManagersClient(); - * try { - * $instanceGroupManager = 'instance_group_manager'; - * $instanceGroupManagersUpdatePerInstanceConfigsReqResource = new InstanceGroupManagersUpdatePerInstanceConfigsReq(); - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $instanceGroupManagersClient->updatePerInstanceConfigs($instanceGroupManager, $instanceGroupManagersUpdatePerInstanceConfigsReqResource, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instanceGroupManagersClient->updatePerInstanceConfigs($instanceGroupManager, $instanceGroupManagersUpdatePerInstanceConfigsReqResource, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instanceGroupManagersClient->resumeOperation($operationName, 'updatePerInstanceConfigs'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instanceGroupManagersClient->close(); - * } - * ``` - * - * @param string $instanceGroupManager The name of the managed instance group. It should conform to RFC1035. - * @param InstanceGroupManagersUpdatePerInstanceConfigsReq $instanceGroupManagersUpdatePerInstanceConfigsReqResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $zone The name of the zone where the managed instance group is located. It should conform to RFC1035. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 updatePerInstanceConfigs($instanceGroupManager, $instanceGroupManagersUpdatePerInstanceConfigsReqResource, $project, $zone, array $optionalArgs = []) - { - $request = new UpdatePerInstanceConfigsInstanceGroupManagerRequest(); - $requestParamHeaders = []; - $request->setInstanceGroupManager($instanceGroupManager); - $request->setInstanceGroupManagersUpdatePerInstanceConfigsReqResource($instanceGroupManagersUpdatePerInstanceConfigsReqResource); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['instance_group_manager'] = $instanceGroupManager; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('UpdatePerInstanceConfigs', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/InstanceGroupsGapicClient.php b/Compute/src/V1/Gapic/InstanceGroupsGapicClient.php deleted file mode 100644 index 4e7425353d58..000000000000 --- a/Compute/src/V1/Gapic/InstanceGroupsGapicClient.php +++ /dev/null @@ -1,987 +0,0 @@ -addInstances($instanceGroup, $instanceGroupsAddInstancesRequestResource, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instanceGroupsClient->addInstances($instanceGroup, $instanceGroupsAddInstancesRequestResource, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instanceGroupsClient->resumeOperation($operationName, 'addInstances'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instanceGroupsClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\InstanceGroupsClient}. - */ -class InstanceGroupsGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.InstanceGroups'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/instance_groups_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/instance_groups_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/instance_groups_rest_client_config.php', - ], - ], - 'operationsClientClass' => ZoneOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an ZoneOperationsClient object with the same endpoint as $this. - * - * @return ZoneOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getZone', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetZoneOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteZoneOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method for the - * supported options. - * @type callable $clientCertSource - * A callable which returns the client cert as a string. This can be used to - * provide a certificate and private key to the transport layer for mTLS. - * } - * - * @throws ValidationException - */ - public function __construct(array $options = []) - { - $clientOptions = $this->buildClientOptions($options); - $this->setClientOptions($clientOptions); - $this->operationsClient = $this->createOperationsClient($clientOptions); - } - - /** - * Adds a list of instances to the specified instance group. All of the instances in the instance group must be in the same network/subnetwork. Read Adding instances for more information. - * - * Sample code: - * ``` - * $instanceGroupsClient = new InstanceGroupsClient(); - * try { - * $instanceGroup = 'instance_group'; - * $instanceGroupsAddInstancesRequestResource = new InstanceGroupsAddInstancesRequest(); - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $instanceGroupsClient->addInstances($instanceGroup, $instanceGroupsAddInstancesRequestResource, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instanceGroupsClient->addInstances($instanceGroup, $instanceGroupsAddInstancesRequestResource, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instanceGroupsClient->resumeOperation($operationName, 'addInstances'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instanceGroupsClient->close(); - * } - * ``` - * - * @param string $instanceGroup The name of the instance group where you are adding instances. - * @param InstanceGroupsAddInstancesRequest $instanceGroupsAddInstancesRequestResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $zone The name of the zone where the instance group is located. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 addInstances($instanceGroup, $instanceGroupsAddInstancesRequestResource, $project, $zone, array $optionalArgs = []) - { - $request = new AddInstancesInstanceGroupRequest(); - $requestParamHeaders = []; - $request->setInstanceGroup($instanceGroup); - $request->setInstanceGroupsAddInstancesRequestResource($instanceGroupsAddInstancesRequestResource); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['instance_group'] = $instanceGroup; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('AddInstances', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Retrieves the list of instance groups and sorts them by zone. To prevent failure, Google recommends that you set the `returnPartialSuccess` parameter to `true`. - * - * Sample code: - * ``` - * $instanceGroupsClient = new InstanceGroupsClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $instanceGroupsClient->aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $instanceGroupsClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $instanceGroupsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type bool $includeAllScopes - * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type int $serviceProjectNumber - * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable 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 aggregatedList($project, array $optionalArgs = []) - { - $request = new AggregatedListInstanceGroupsRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['includeAllScopes'])) { - $request->setIncludeAllScopes($optionalArgs['includeAllScopes']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - if (isset($optionalArgs['serviceProjectNumber'])) { - $request->setServiceProjectNumber($optionalArgs['serviceProjectNumber']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('AggregatedList', $optionalArgs, InstanceGroupAggregatedList::class, $request); - } - - /** - * Deletes the specified instance group. The instances in the group are not deleted. Note that instance group must not belong to a backend service. Read Deleting an instance group for more information. - * - * Sample code: - * ``` - * $instanceGroupsClient = new InstanceGroupsClient(); - * try { - * $instanceGroup = 'instance_group'; - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $instanceGroupsClient->delete($instanceGroup, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instanceGroupsClient->delete($instanceGroup, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instanceGroupsClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instanceGroupsClient->close(); - * } - * ``` - * - * @param string $instanceGroup The name of the instance group to delete. - * @param string $project Project ID for this request. - * @param string $zone The name of the zone where the instance group is located. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($instanceGroup, $project, $zone, array $optionalArgs = []) - { - $request = new DeleteInstanceGroupRequest(); - $requestParamHeaders = []; - $request->setInstanceGroup($instanceGroup); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['instance_group'] = $instanceGroup; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns the specified zonal instance group. Get a list of available zonal instance groups by making a list() request. For managed instance groups, use the instanceGroupManagers or regionInstanceGroupManagers methods instead. - * - * Sample code: - * ``` - * $instanceGroupsClient = new InstanceGroupsClient(); - * try { - * $instanceGroup = 'instance_group'; - * $project = 'project'; - * $zone = 'zone'; - * $response = $instanceGroupsClient->get($instanceGroup, $project, $zone); - * } finally { - * $instanceGroupsClient->close(); - * } - * ``` - * - * @param string $instanceGroup The name of the instance group. - * @param string $project Project ID for this request. - * @param string $zone The name of the zone where the instance group is located. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\InstanceGroup - * - * @throws ApiException if the remote call fails - */ - public function get($instanceGroup, $project, $zone, array $optionalArgs = []) - { - $request = new GetInstanceGroupRequest(); - $requestParamHeaders = []; - $request->setInstanceGroup($instanceGroup); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['instance_group'] = $instanceGroup; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', InstanceGroup::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates an instance group in the specified project using the parameters that are included in the request. - * - * Sample code: - * ``` - * $instanceGroupsClient = new InstanceGroupsClient(); - * try { - * $instanceGroupResource = new InstanceGroup(); - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $instanceGroupsClient->insert($instanceGroupResource, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instanceGroupsClient->insert($instanceGroupResource, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instanceGroupsClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instanceGroupsClient->close(); - * } - * ``` - * - * @param InstanceGroup $instanceGroupResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $zone The name of the zone where you want to create the instance group. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 insert($instanceGroupResource, $project, $zone, array $optionalArgs = []) - { - $request = new InsertInstanceGroupRequest(); - $requestParamHeaders = []; - $request->setInstanceGroupResource($instanceGroupResource); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Retrieves the list of zonal instance group resources contained within the specified zone. For managed instance groups, use the instanceGroupManagers or regionInstanceGroupManagers methods instead. - * - * Sample code: - * ``` - * $instanceGroupsClient = new InstanceGroupsClient(); - * try { - * $project = 'project'; - * $zone = 'zone'; - * // Iterate over pages of elements - * $pagedResponse = $instanceGroupsClient->list($project, $zone); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $instanceGroupsClient->list($project, $zone); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $instanceGroupsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $zone The name of the zone where the instance group is located. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, $zone, array $optionalArgs = []) - { - $request = new ListInstanceGroupsRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, InstanceGroupList::class, $request); - } - - /** - * Lists the instances in the specified instance group. The orderBy query parameter is not supported. The filter query parameter is supported, but only for expressions that use `eq` (equal) or `ne` (not equal) operators. - * - * Sample code: - * ``` - * $instanceGroupsClient = new InstanceGroupsClient(); - * try { - * $instanceGroup = 'instance_group'; - * $instanceGroupsListInstancesRequestResource = new InstanceGroupsListInstancesRequest(); - * $project = 'project'; - * $zone = 'zone'; - * // Iterate over pages of elements - * $pagedResponse = $instanceGroupsClient->listInstances($instanceGroup, $instanceGroupsListInstancesRequestResource, $project, $zone); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $instanceGroupsClient->listInstances($instanceGroup, $instanceGroupsListInstancesRequestResource, $project, $zone); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $instanceGroupsClient->close(); - * } - * ``` - * - * @param string $instanceGroup The name of the instance group from which you want to generate a list of included instances. - * @param InstanceGroupsListInstancesRequest $instanceGroupsListInstancesRequestResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $zone The name of the zone where the instance group is located. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 listInstances($instanceGroup, $instanceGroupsListInstancesRequestResource, $project, $zone, array $optionalArgs = []) - { - $request = new ListInstancesInstanceGroupsRequest(); - $requestParamHeaders = []; - $request->setInstanceGroup($instanceGroup); - $request->setInstanceGroupsListInstancesRequestResource($instanceGroupsListInstancesRequestResource); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['instance_group'] = $instanceGroup; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('ListInstances', $optionalArgs, InstanceGroupsListInstances::class, $request); - } - - /** - * Removes one or more instances from the specified instance group, but does not delete those instances. If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration before the VM instance is removed or deleted. - * - * Sample code: - * ``` - * $instanceGroupsClient = new InstanceGroupsClient(); - * try { - * $instanceGroup = 'instance_group'; - * $instanceGroupsRemoveInstancesRequestResource = new InstanceGroupsRemoveInstancesRequest(); - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $instanceGroupsClient->removeInstances($instanceGroup, $instanceGroupsRemoveInstancesRequestResource, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instanceGroupsClient->removeInstances($instanceGroup, $instanceGroupsRemoveInstancesRequestResource, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instanceGroupsClient->resumeOperation($operationName, 'removeInstances'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instanceGroupsClient->close(); - * } - * ``` - * - * @param string $instanceGroup The name of the instance group where the specified instances will be removed. - * @param InstanceGroupsRemoveInstancesRequest $instanceGroupsRemoveInstancesRequestResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $zone The name of the zone where the instance group is located. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 removeInstances($instanceGroup, $instanceGroupsRemoveInstancesRequestResource, $project, $zone, array $optionalArgs = []) - { - $request = new RemoveInstancesInstanceGroupRequest(); - $requestParamHeaders = []; - $request->setInstanceGroup($instanceGroup); - $request->setInstanceGroupsRemoveInstancesRequestResource($instanceGroupsRemoveInstancesRequestResource); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['instance_group'] = $instanceGroup; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('RemoveInstances', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Sets the named ports for the specified instance group. - * - * Sample code: - * ``` - * $instanceGroupsClient = new InstanceGroupsClient(); - * try { - * $instanceGroup = 'instance_group'; - * $instanceGroupsSetNamedPortsRequestResource = new InstanceGroupsSetNamedPortsRequest(); - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $instanceGroupsClient->setNamedPorts($instanceGroup, $instanceGroupsSetNamedPortsRequestResource, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instanceGroupsClient->setNamedPorts($instanceGroup, $instanceGroupsSetNamedPortsRequestResource, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instanceGroupsClient->resumeOperation($operationName, 'setNamedPorts'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instanceGroupsClient->close(); - * } - * ``` - * - * @param string $instanceGroup The name of the instance group where the named ports are updated. - * @param InstanceGroupsSetNamedPortsRequest $instanceGroupsSetNamedPortsRequestResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $zone The name of the zone where the instance group is located. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 setNamedPorts($instanceGroup, $instanceGroupsSetNamedPortsRequestResource, $project, $zone, array $optionalArgs = []) - { - $request = new SetNamedPortsInstanceGroupRequest(); - $requestParamHeaders = []; - $request->setInstanceGroup($instanceGroup); - $request->setInstanceGroupsSetNamedPortsRequestResource($instanceGroupsSetNamedPortsRequestResource); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['instance_group'] = $instanceGroup; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('SetNamedPorts', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/InstanceSettingsServiceGapicClient.php b/Compute/src/V1/Gapic/InstanceSettingsServiceGapicClient.php deleted file mode 100644 index 8b1d4e31b062..000000000000 --- a/Compute/src/V1/Gapic/InstanceSettingsServiceGapicClient.php +++ /dev/null @@ -1,358 +0,0 @@ -get($project, $zone); - * } finally { - * $instanceSettingsServiceClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\InstanceSettingsServiceClient}. - */ -class InstanceSettingsServiceGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.InstanceSettingsService'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/instance_settings_service_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/instance_settings_service_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/instance_settings_service_rest_client_config.php', - ], - ], - 'operationsClientClass' => ZoneOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an ZoneOperationsClient object with the same endpoint as $this. - * - * @return ZoneOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getZone', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetZoneOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteZoneOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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); - } - - /** - * Get Instance settings. - * - * Sample code: - * ``` - * $instanceSettingsServiceClient = new InstanceSettingsServiceClient(); - * try { - * $project = 'project'; - * $zone = 'zone'; - * $response = $instanceSettingsServiceClient->get($project, $zone); - * } finally { - * $instanceSettingsServiceClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $zone Name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\InstanceSettings - * - * @throws ApiException if the remote call fails - */ - public function get($project, $zone, array $optionalArgs = []) - { - $request = new GetInstanceSettingRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', InstanceSettings::class, $optionalArgs, $request)->wait(); - } - - /** - * Patch Instance settings - * - * Sample code: - * ``` - * $instanceSettingsServiceClient = new InstanceSettingsServiceClient(); - * try { - * $instanceSettingsResource = new InstanceSettings(); - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $instanceSettingsServiceClient->patch($instanceSettingsResource, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instanceSettingsServiceClient->patch($instanceSettingsResource, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instanceSettingsServiceClient->resumeOperation($operationName, 'patch'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instanceSettingsServiceClient->close(); - * } - * ``` - * - * @param InstanceSettings $instanceSettingsResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $zone The zone scoping this request. It should conform to RFC1035. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 $updateMask - * update_mask indicates fields to be updated as part of this request. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 patch($instanceSettingsResource, $project, $zone, array $optionalArgs = []) - { - $request = new PatchInstanceSettingRequest(); - $requestParamHeaders = []; - $request->setInstanceSettingsResource($instanceSettingsResource); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('Patch', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/InstanceTemplatesGapicClient.php b/Compute/src/V1/Gapic/InstanceTemplatesGapicClient.php deleted file mode 100644 index 9f5ff323ea71..000000000000 --- a/Compute/src/V1/Gapic/InstanceTemplatesGapicClient.php +++ /dev/null @@ -1,763 +0,0 @@ -aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $instanceTemplatesClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $instanceTemplatesClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\InstanceTemplatesClient}. - */ -class InstanceTemplatesGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.InstanceTemplates'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/instance_templates_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/instance_templates_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/instance_templates_rest_client_config.php', - ], - ], - 'operationsClientClass' => GlobalOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an GlobalOperationsClient object with the same endpoint as $this. - * - * @return GlobalOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetGlobalOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteGlobalOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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); - } - - /** - * Retrieves the list of all InstanceTemplates resources, regional and global, available to the specified project. To prevent failure, Google recommends that you set the `returnPartialSuccess` parameter to `true`. - * - * Sample code: - * ``` - * $instanceTemplatesClient = new InstanceTemplatesClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $instanceTemplatesClient->aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $instanceTemplatesClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $instanceTemplatesClient->close(); - * } - * ``` - * - * @param string $project Name of the project scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type bool $includeAllScopes - * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type int $serviceProjectNumber - * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable 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 aggregatedList($project, array $optionalArgs = []) - { - $request = new AggregatedListInstanceTemplatesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['includeAllScopes'])) { - $request->setIncludeAllScopes($optionalArgs['includeAllScopes']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - if (isset($optionalArgs['serviceProjectNumber'])) { - $request->setServiceProjectNumber($optionalArgs['serviceProjectNumber']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('AggregatedList', $optionalArgs, InstanceTemplateAggregatedList::class, $request); - } - - /** - * Deletes the specified instance template. Deleting an instance template is permanent and cannot be undone. It is not possible to delete templates that are already in use by a managed instance group. - * - * Sample code: - * ``` - * $instanceTemplatesClient = new InstanceTemplatesClient(); - * try { - * $instanceTemplate = 'instance_template'; - * $project = 'project'; - * $operationResponse = $instanceTemplatesClient->delete($instanceTemplate, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instanceTemplatesClient->delete($instanceTemplate, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instanceTemplatesClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instanceTemplatesClient->close(); - * } - * ``` - * - * @param string $instanceTemplate The name of the instance template to delete. - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($instanceTemplate, $project, array $optionalArgs = []) - { - $request = new DeleteInstanceTemplateRequest(); - $requestParamHeaders = []; - $request->setInstanceTemplate($instanceTemplate); - $request->setProject($project); - $requestParamHeaders['instance_template'] = $instanceTemplate; - $requestParamHeaders['project'] = $project; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns the specified instance template. - * - * Sample code: - * ``` - * $instanceTemplatesClient = new InstanceTemplatesClient(); - * try { - * $instanceTemplate = 'instance_template'; - * $project = 'project'; - * $response = $instanceTemplatesClient->get($instanceTemplate, $project); - * } finally { - * $instanceTemplatesClient->close(); - * } - * ``` - * - * @param string $instanceTemplate The name of the instance template. - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\InstanceTemplate - * - * @throws ApiException if the remote call fails - */ - public function get($instanceTemplate, $project, array $optionalArgs = []) - { - $request = new GetInstanceTemplateRequest(); - $requestParamHeaders = []; - $request->setInstanceTemplate($instanceTemplate); - $request->setProject($project); - $requestParamHeaders['instance_template'] = $instanceTemplate; - $requestParamHeaders['project'] = $project; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', InstanceTemplate::class, $optionalArgs, $request)->wait(); - } - - /** - * Gets the access control policy for a resource. May be empty if no such policy or resource exists. - * - * Sample code: - * ``` - * $instanceTemplatesClient = new InstanceTemplatesClient(); - * try { - * $project = 'project'; - * $resource = 'resource'; - * $response = $instanceTemplatesClient->getIamPolicy($project, $resource); - * } finally { - * $instanceTemplatesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $resource Name or id of the resource for this request. - * @param array $optionalArgs { - * Optional. - * - * @type int $optionsRequestedPolicyVersion - * Requested IAM Policy version. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function getIamPolicy($project, $resource, array $optionalArgs = []) - { - $request = new GetIamPolicyInstanceTemplateRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setResource($resource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['optionsRequestedPolicyVersion'])) { - $request->setOptionsRequestedPolicyVersion($optionalArgs['optionsRequestedPolicyVersion']); - } - - $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(); - } - - /** - * Creates an instance template in the specified project using the data that is included in the request. If you are creating a new template to update an existing instance group, your new instance template must use the same network or, if applicable, the same subnetwork as the original template. - * - * Sample code: - * ``` - * $instanceTemplatesClient = new InstanceTemplatesClient(); - * try { - * $instanceTemplateResource = new InstanceTemplate(); - * $project = 'project'; - * $operationResponse = $instanceTemplatesClient->insert($instanceTemplateResource, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instanceTemplatesClient->insert($instanceTemplateResource, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instanceTemplatesClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instanceTemplatesClient->close(); - * } - * ``` - * - * @param InstanceTemplate $instanceTemplateResource The body resource for this request - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 insert($instanceTemplateResource, $project, array $optionalArgs = []) - { - $request = new InsertInstanceTemplateRequest(); - $requestParamHeaders = []; - $request->setInstanceTemplateResource($instanceTemplateResource); - $request->setProject($project); - $requestParamHeaders['project'] = $project; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Retrieves a list of instance templates that are contained within the specified project. - * - * Sample code: - * ``` - * $instanceTemplatesClient = new InstanceTemplatesClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $instanceTemplatesClient->list($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $instanceTemplatesClient->list($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $instanceTemplatesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, array $optionalArgs = []) - { - $request = new ListInstanceTemplatesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, InstanceTemplateList::class, $request); - } - - /** - * Sets the access control policy on the specified resource. Replaces any existing policy. - * - * Sample code: - * ``` - * $instanceTemplatesClient = new InstanceTemplatesClient(); - * try { - * $globalSetPolicyRequestResource = new GlobalSetPolicyRequest(); - * $project = 'project'; - * $resource = 'resource'; - * $response = $instanceTemplatesClient->setIamPolicy($globalSetPolicyRequestResource, $project, $resource); - * } finally { - * $instanceTemplatesClient->close(); - * } - * ``` - * - * @param GlobalSetPolicyRequest $globalSetPolicyRequestResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $resource Name or id of the resource for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function setIamPolicy($globalSetPolicyRequestResource, $project, $resource, array $optionalArgs = []) - { - $request = new SetIamPolicyInstanceTemplateRequest(); - $requestParamHeaders = []; - $request->setGlobalSetPolicyRequestResource($globalSetPolicyRequestResource); - $request->setProject($project); - $request->setResource($resource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['resource'] = $resource; - $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 resource. - * - * Sample code: - * ``` - * $instanceTemplatesClient = new InstanceTemplatesClient(); - * try { - * $project = 'project'; - * $resource = 'resource'; - * $testPermissionsRequestResource = new TestPermissionsRequest(); - * $response = $instanceTemplatesClient->testIamPermissions($project, $resource, $testPermissionsRequestResource); - * } finally { - * $instanceTemplatesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $resource Name or id of the resource for this request. - * @param TestPermissionsRequest $testPermissionsRequestResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\TestPermissionsResponse - * - * @throws ApiException if the remote call fails - */ - public function testIamPermissions($project, $resource, $testPermissionsRequestResource, array $optionalArgs = []) - { - $request = new TestIamPermissionsInstanceTemplateRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setResource($resource); - $request->setTestPermissionsRequestResource($testPermissionsRequestResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['resource'] = $resource; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('TestIamPermissions', TestPermissionsResponse::class, $optionalArgs, $request)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/InstancesGapicClient.php b/Compute/src/V1/Gapic/InstancesGapicClient.php deleted file mode 100644 index 32bf97b2b25e..000000000000 --- a/Compute/src/V1/Gapic/InstancesGapicClient.php +++ /dev/null @@ -1,4006 +0,0 @@ -addAccessConfig($accessConfigResource, $instance, $networkInterface, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instancesClient->addAccessConfig($accessConfigResource, $instance, $networkInterface, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instancesClient->resumeOperation($operationName, 'addAccessConfig'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instancesClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\InstancesClient}. - */ -class InstancesGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.Instances'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/instances_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/instances_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/instances_rest_client_config.php', - ], - ], - 'operationsClientClass' => ZoneOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an ZoneOperationsClient object with the same endpoint as $this. - * - * @return ZoneOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getZone', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetZoneOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteZoneOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method for the - * supported options. - * @type callable $clientCertSource - * A callable which returns the client cert as a string. This can be used to - * provide a certificate and private key to the transport layer for mTLS. - * } - * - * @throws ValidationException - */ - public function __construct(array $options = []) - { - $clientOptions = $this->buildClientOptions($options); - $this->setClientOptions($clientOptions); - $this->operationsClient = $this->createOperationsClient($clientOptions); - } - - /** - * Adds an access config to an instance's network interface. - * - * Sample code: - * ``` - * $instancesClient = new InstancesClient(); - * try { - * $accessConfigResource = new AccessConfig(); - * $instance = 'instance'; - * $networkInterface = 'network_interface'; - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $instancesClient->addAccessConfig($accessConfigResource, $instance, $networkInterface, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instancesClient->addAccessConfig($accessConfigResource, $instance, $networkInterface, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instancesClient->resumeOperation($operationName, 'addAccessConfig'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instancesClient->close(); - * } - * ``` - * - * @param AccessConfig $accessConfigResource The body resource for this request - * @param string $instance The instance name for this request. - * @param string $networkInterface The name of the network interface to add to this instance. - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 addAccessConfig($accessConfigResource, $instance, $networkInterface, $project, $zone, array $optionalArgs = []) - { - $request = new AddAccessConfigInstanceRequest(); - $requestParamHeaders = []; - $request->setAccessConfigResource($accessConfigResource); - $request->setInstance($instance); - $request->setNetworkInterface($networkInterface); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['instance'] = $instance; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('AddAccessConfig', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Adds existing resource policies to an instance. You can only add one policy right now which will be applied to this instance for scheduling live migrations. - * - * Sample code: - * ``` - * $instancesClient = new InstancesClient(); - * try { - * $instance = 'instance'; - * $instancesAddResourcePoliciesRequestResource = new InstancesAddResourcePoliciesRequest(); - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $instancesClient->addResourcePolicies($instance, $instancesAddResourcePoliciesRequestResource, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instancesClient->addResourcePolicies($instance, $instancesAddResourcePoliciesRequestResource, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instancesClient->resumeOperation($operationName, 'addResourcePolicies'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instancesClient->close(); - * } - * ``` - * - * @param string $instance The instance name for this request. - * @param InstancesAddResourcePoliciesRequest $instancesAddResourcePoliciesRequestResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 addResourcePolicies($instance, $instancesAddResourcePoliciesRequestResource, $project, $zone, array $optionalArgs = []) - { - $request = new AddResourcePoliciesInstanceRequest(); - $requestParamHeaders = []; - $request->setInstance($instance); - $request->setInstancesAddResourcePoliciesRequestResource($instancesAddResourcePoliciesRequestResource); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['instance'] = $instance; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('AddResourcePolicies', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Retrieves an aggregated list of all of the instances in your project across all regions and zones. The performance of this method degrades when a filter is specified on a project that has a very large number of instances. To prevent failure, Google recommends that you set the `returnPartialSuccess` parameter to `true`. - * - * Sample code: - * ``` - * $instancesClient = new InstancesClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $instancesClient->aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $instancesClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $instancesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type bool $includeAllScopes - * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type int $serviceProjectNumber - * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable 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 aggregatedList($project, array $optionalArgs = []) - { - $request = new AggregatedListInstancesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['includeAllScopes'])) { - $request->setIncludeAllScopes($optionalArgs['includeAllScopes']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - if (isset($optionalArgs['serviceProjectNumber'])) { - $request->setServiceProjectNumber($optionalArgs['serviceProjectNumber']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('AggregatedList', $optionalArgs, InstanceAggregatedList::class, $request); - } - - /** - * Attaches an existing Disk resource to an instance. You must first create the disk before you can attach it. It is not possible to create and attach a disk at the same time. For more information, read Adding a persistent disk to your instance. - * - * Sample code: - * ``` - * $instancesClient = new InstancesClient(); - * try { - * $attachedDiskResource = new AttachedDisk(); - * $instance = 'instance'; - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $instancesClient->attachDisk($attachedDiskResource, $instance, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instancesClient->attachDisk($attachedDiskResource, $instance, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instancesClient->resumeOperation($operationName, 'attachDisk'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instancesClient->close(); - * } - * ``` - * - * @param AttachedDisk $attachedDiskResource The body resource for this request - * @param string $instance The instance name for this request. - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type bool $forceAttach - * Whether to force attach the regional disk even if it's currently attached to another instance. If you try to force attach a zonal disk to an instance, you will receive an error. - * @type string $requestId - * 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. 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 attachDisk($attachedDiskResource, $instance, $project, $zone, array $optionalArgs = []) - { - $request = new AttachDiskInstanceRequest(); - $requestParamHeaders = []; - $request->setAttachedDiskResource($attachedDiskResource); - $request->setInstance($instance); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['instance'] = $instance; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - if (isset($optionalArgs['forceAttach'])) { - $request->setForceAttach($optionalArgs['forceAttach']); - } - - 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('AttachDisk', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Creates multiple instances. Count specifies the number of instances to create. For more information, see About bulk creation of VMs. - * - * Sample code: - * ``` - * $instancesClient = new InstancesClient(); - * try { - * $bulkInsertInstanceResourceResource = new BulkInsertInstanceResource(); - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $instancesClient->bulkInsert($bulkInsertInstanceResourceResource, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instancesClient->bulkInsert($bulkInsertInstanceResourceResource, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instancesClient->resumeOperation($operationName, 'bulkInsert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instancesClient->close(); - * } - * ``` - * - * @param BulkInsertInstanceResource $bulkInsertInstanceResourceResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 bulkInsert($bulkInsertInstanceResourceResource, $project, $zone, array $optionalArgs = []) - { - $request = new BulkInsertInstanceRequest(); - $requestParamHeaders = []; - $request->setBulkInsertInstanceResourceResource($bulkInsertInstanceResourceResource); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('BulkInsert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Deletes the specified Instance resource. For more information, see Deleting an instance. - * - * Sample code: - * ``` - * $instancesClient = new InstancesClient(); - * try { - * $instance = 'instance'; - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $instancesClient->delete($instance, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instancesClient->delete($instance, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instancesClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instancesClient->close(); - * } - * ``` - * - * @param string $instance Name of the instance resource to delete. - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($instance, $project, $zone, array $optionalArgs = []) - { - $request = new DeleteInstanceRequest(); - $requestParamHeaders = []; - $request->setInstance($instance); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['instance'] = $instance; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Deletes an access config from an instance's network interface. - * - * Sample code: - * ``` - * $instancesClient = new InstancesClient(); - * try { - * $accessConfig = 'access_config'; - * $instance = 'instance'; - * $networkInterface = 'network_interface'; - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $instancesClient->deleteAccessConfig($accessConfig, $instance, $networkInterface, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instancesClient->deleteAccessConfig($accessConfig, $instance, $networkInterface, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instancesClient->resumeOperation($operationName, 'deleteAccessConfig'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instancesClient->close(); - * } - * ``` - * - * @param string $accessConfig The name of the access config to delete. - * @param string $instance The instance name for this request. - * @param string $networkInterface The name of the network interface. - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 deleteAccessConfig($accessConfig, $instance, $networkInterface, $project, $zone, array $optionalArgs = []) - { - $request = new DeleteAccessConfigInstanceRequest(); - $requestParamHeaders = []; - $request->setAccessConfig($accessConfig); - $request->setInstance($instance); - $request->setNetworkInterface($networkInterface); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['instance'] = $instance; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('DeleteAccessConfig', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Detaches a disk from an instance. - * - * Sample code: - * ``` - * $instancesClient = new InstancesClient(); - * try { - * $deviceName = 'device_name'; - * $instance = 'instance'; - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $instancesClient->detachDisk($deviceName, $instance, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instancesClient->detachDisk($deviceName, $instance, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instancesClient->resumeOperation($operationName, 'detachDisk'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instancesClient->close(); - * } - * ``` - * - * @param string $deviceName The device name of the disk to detach. Make a get() request on the instance to view currently attached disks and device names. - * @param string $instance Instance name for this request. - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 detachDisk($deviceName, $instance, $project, $zone, array $optionalArgs = []) - { - $request = new DetachDiskInstanceRequest(); - $requestParamHeaders = []; - $request->setDeviceName($deviceName); - $request->setInstance($instance); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['instance'] = $instance; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('DetachDisk', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns the specified Instance resource. - * - * Sample code: - * ``` - * $instancesClient = new InstancesClient(); - * try { - * $instance = 'instance'; - * $project = 'project'; - * $zone = 'zone'; - * $response = $instancesClient->get($instance, $project, $zone); - * } finally { - * $instancesClient->close(); - * } - * ``` - * - * @param string $instance Name of the instance resource to return. - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Instance - * - * @throws ApiException if the remote call fails - */ - public function get($instance, $project, $zone, array $optionalArgs = []) - { - $request = new GetInstanceRequest(); - $requestParamHeaders = []; - $request->setInstance($instance); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['instance'] = $instance; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', Instance::class, $optionalArgs, $request)->wait(); - } - - /** - * Returns effective firewalls applied to an interface of the instance. - * - * Sample code: - * ``` - * $instancesClient = new InstancesClient(); - * try { - * $instance = 'instance'; - * $networkInterface = 'network_interface'; - * $project = 'project'; - * $zone = 'zone'; - * $response = $instancesClient->getEffectiveFirewalls($instance, $networkInterface, $project, $zone); - * } finally { - * $instancesClient->close(); - * } - * ``` - * - * @param string $instance Name of the instance scoping this request. - * @param string $networkInterface The name of the network interface to get the effective firewalls. - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\InstancesGetEffectiveFirewallsResponse - * - * @throws ApiException if the remote call fails - */ - public function getEffectiveFirewalls($instance, $networkInterface, $project, $zone, array $optionalArgs = []) - { - $request = new GetEffectiveFirewallsInstanceRequest(); - $requestParamHeaders = []; - $request->setInstance($instance); - $request->setNetworkInterface($networkInterface); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['instance'] = $instance; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetEffectiveFirewalls', InstancesGetEffectiveFirewallsResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Returns the specified guest attributes entry. - * - * Sample code: - * ``` - * $instancesClient = new InstancesClient(); - * try { - * $instance = 'instance'; - * $project = 'project'; - * $zone = 'zone'; - * $response = $instancesClient->getGuestAttributes($instance, $project, $zone); - * } finally { - * $instancesClient->close(); - * } - * ``` - * - * @param string $instance Name of the instance scoping this request. - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $queryPath - * Specifies the guest attributes path to be queried. - * @type string $variableKey - * Specifies the key for the guest attributes entry. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\GuestAttributes - * - * @throws ApiException if the remote call fails - */ - public function getGuestAttributes($instance, $project, $zone, array $optionalArgs = []) - { - $request = new GetGuestAttributesInstanceRequest(); - $requestParamHeaders = []; - $request->setInstance($instance); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['instance'] = $instance; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - if (isset($optionalArgs['queryPath'])) { - $request->setQueryPath($optionalArgs['queryPath']); - } - - if (isset($optionalArgs['variableKey'])) { - $request->setVariableKey($optionalArgs['variableKey']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetGuestAttributes', GuestAttributes::class, $optionalArgs, $request)->wait(); - } - - /** - * Gets the access control policy for a resource. May be empty if no such policy or resource exists. - * - * Sample code: - * ``` - * $instancesClient = new InstancesClient(); - * try { - * $project = 'project'; - * $resource = 'resource'; - * $zone = 'zone'; - * $response = $instancesClient->getIamPolicy($project, $resource, $zone); - * } finally { - * $instancesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $resource Name or id of the resource for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type int $optionsRequestedPolicyVersion - * Requested IAM Policy version. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function getIamPolicy($project, $resource, $zone, array $optionalArgs = []) - { - $request = new GetIamPolicyInstanceRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setResource($resource); - $request->setZone($zone); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['resource'] = $resource; - $requestParamHeaders['zone'] = $zone; - if (isset($optionalArgs['optionsRequestedPolicyVersion'])) { - $request->setOptionsRequestedPolicyVersion($optionalArgs['optionsRequestedPolicyVersion']); - } - - $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(); - } - - /** - * Returns the screenshot from the specified instance. - * - * Sample code: - * ``` - * $instancesClient = new InstancesClient(); - * try { - * $instance = 'instance'; - * $project = 'project'; - * $zone = 'zone'; - * $response = $instancesClient->getScreenshot($instance, $project, $zone); - * } finally { - * $instancesClient->close(); - * } - * ``` - * - * @param string $instance Name of the instance scoping this request. - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Screenshot - * - * @throws ApiException if the remote call fails - */ - public function getScreenshot($instance, $project, $zone, array $optionalArgs = []) - { - $request = new GetScreenshotInstanceRequest(); - $requestParamHeaders = []; - $request->setInstance($instance); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['instance'] = $instance; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetScreenshot', Screenshot::class, $optionalArgs, $request)->wait(); - } - - /** - * Returns the last 1 MB of serial port output from the specified instance. - * - * Sample code: - * ``` - * $instancesClient = new InstancesClient(); - * try { - * $instance = 'instance'; - * $project = 'project'; - * $zone = 'zone'; - * $response = $instancesClient->getSerialPortOutput($instance, $project, $zone); - * } finally { - * $instancesClient->close(); - * } - * ``` - * - * @param string $instance Name of the instance for this request. - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type int $port - * Specifies which COM or serial port to retrieve data from. - * @type int $start - * Specifies the starting byte position of the output to return. To start with the first byte of output to the specified port, omit this field or set it to `0`. If the output for that byte position is available, this field matches the `start` parameter sent with the request. If the amount of serial console output exceeds the size of the buffer (1 MB), the oldest output is discarded and is no longer available. If the requested start position refers to discarded output, the start position is adjusted to the oldest output still available, and the adjusted start position is returned as the `start` property value. You can also provide a negative start position, which translates to the most recent number of bytes written to the serial port. For example, -3 is interpreted as the most recent 3 bytes written to the serial console. Note that the negative start is bounded by the retained buffer size, and the returned serial console output will not exceed the max buffer size. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\SerialPortOutput - * - * @throws ApiException if the remote call fails - */ - public function getSerialPortOutput($instance, $project, $zone, array $optionalArgs = []) - { - $request = new GetSerialPortOutputInstanceRequest(); - $requestParamHeaders = []; - $request->setInstance($instance); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['instance'] = $instance; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - if (isset($optionalArgs['port'])) { - $request->setPort($optionalArgs['port']); - } - - if (isset($optionalArgs['start'])) { - $request->setStart($optionalArgs['start']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetSerialPortOutput', SerialPortOutput::class, $optionalArgs, $request)->wait(); - } - - /** - * Returns the Shielded Instance Identity of an instance - * - * Sample code: - * ``` - * $instancesClient = new InstancesClient(); - * try { - * $instance = 'instance'; - * $project = 'project'; - * $zone = 'zone'; - * $response = $instancesClient->getShieldedInstanceIdentity($instance, $project, $zone); - * } finally { - * $instancesClient->close(); - * } - * ``` - * - * @param string $instance Name or id of the instance scoping this request. - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\ShieldedInstanceIdentity - * - * @throws ApiException if the remote call fails - */ - public function getShieldedInstanceIdentity($instance, $project, $zone, array $optionalArgs = []) - { - $request = new GetShieldedInstanceIdentityInstanceRequest(); - $requestParamHeaders = []; - $request->setInstance($instance); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['instance'] = $instance; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetShieldedInstanceIdentity', ShieldedInstanceIdentity::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates an instance resource in the specified project using the data included in the request. - * - * Sample code: - * ``` - * $instancesClient = new InstancesClient(); - * try { - * $instanceResource = new Instance(); - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $instancesClient->insert($instanceResource, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instancesClient->insert($instanceResource, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instancesClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instancesClient->close(); - * } - * ``` - * - * @param Instance $instanceResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 $sourceInstanceTemplate - * Specifies instance template to create the instance. This field is optional. It can be a full or partial URL. For example, the following are all valid URLs to an instance template: - https://www.googleapis.com/compute/v1/projects/project /global/instanceTemplates/instanceTemplate - projects/project/global/instanceTemplates/instanceTemplate - global/instanceTemplates/instanceTemplate - * @type string $sourceMachineImage - * Specifies the machine image to use to create the instance. This field is optional. It can be a full or partial URL. For example, the following are all valid URLs to a machine image: - https://www.googleapis.com/compute/v1/projects/project/global/global /machineImages/machineImage - projects/project/global/global/machineImages/machineImage - global/machineImages/machineImage - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 insert($instanceResource, $project, $zone, array $optionalArgs = []) - { - $request = new InsertInstanceRequest(); - $requestParamHeaders = []; - $request->setInstanceResource($instanceResource); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - if (isset($optionalArgs['sourceInstanceTemplate'])) { - $request->setSourceInstanceTemplate($optionalArgs['sourceInstanceTemplate']); - } - - if (isset($optionalArgs['sourceMachineImage'])) { - $request->setSourceMachineImage($optionalArgs['sourceMachineImage']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Retrieves the list of instances contained within the specified zone. - * - * Sample code: - * ``` - * $instancesClient = new InstancesClient(); - * try { - * $project = 'project'; - * $zone = 'zone'; - * // Iterate over pages of elements - * $pagedResponse = $instancesClient->list($project, $zone); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $instancesClient->list($project, $zone); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $instancesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, $zone, array $optionalArgs = []) - { - $request = new ListInstancesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, InstanceList::class, $request); - } - - /** - * Retrieves a list of resources that refer to the VM instance specified in the request. For example, if the VM instance is part of a managed or unmanaged instance group, the referrers list includes the instance group. For more information, read Viewing referrers to VM instances. - * - * Sample code: - * ``` - * $instancesClient = new InstancesClient(); - * try { - * $instance = 'instance'; - * $project = 'project'; - * $zone = 'zone'; - * // Iterate over pages of elements - * $pagedResponse = $instancesClient->listReferrers($instance, $project, $zone); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $instancesClient->listReferrers($instance, $project, $zone); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $instancesClient->close(); - * } - * ``` - * - * @param string $instance Name of the target instance scoping this request, or '-' if the request should span over all instances in the container. - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 listReferrers($instance, $project, $zone, array $optionalArgs = []) - { - $request = new ListReferrersInstancesRequest(); - $requestParamHeaders = []; - $request->setInstance($instance); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['instance'] = $instance; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('ListReferrers', $optionalArgs, InstanceListReferrers::class, $request); - } - - /** - * Perform a manual maintenance on the instance. - * - * Sample code: - * ``` - * $instancesClient = new InstancesClient(); - * try { - * $instance = 'instance'; - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $instancesClient->performMaintenance($instance, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instancesClient->performMaintenance($instance, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instancesClient->resumeOperation($operationName, 'performMaintenance'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instancesClient->close(); - * } - * ``` - * - * @param string $instance Name of the instance scoping this request. - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 performMaintenance($instance, $project, $zone, array $optionalArgs = []) - { - $request = new PerformMaintenanceInstanceRequest(); - $requestParamHeaders = []; - $request->setInstance($instance); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['instance'] = $instance; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('PerformMaintenance', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Removes resource policies from an instance. - * - * Sample code: - * ``` - * $instancesClient = new InstancesClient(); - * try { - * $instance = 'instance'; - * $instancesRemoveResourcePoliciesRequestResource = new InstancesRemoveResourcePoliciesRequest(); - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $instancesClient->removeResourcePolicies($instance, $instancesRemoveResourcePoliciesRequestResource, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instancesClient->removeResourcePolicies($instance, $instancesRemoveResourcePoliciesRequestResource, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instancesClient->resumeOperation($operationName, 'removeResourcePolicies'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instancesClient->close(); - * } - * ``` - * - * @param string $instance The instance name for this request. - * @param InstancesRemoveResourcePoliciesRequest $instancesRemoveResourcePoliciesRequestResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 removeResourcePolicies($instance, $instancesRemoveResourcePoliciesRequestResource, $project, $zone, array $optionalArgs = []) - { - $request = new RemoveResourcePoliciesInstanceRequest(); - $requestParamHeaders = []; - $request->setInstance($instance); - $request->setInstancesRemoveResourcePoliciesRequestResource($instancesRemoveResourcePoliciesRequestResource); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['instance'] = $instance; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('RemoveResourcePolicies', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Mark the host as faulty and try to restart the instance on a new host. - * - * Sample code: - * ``` - * $instancesClient = new InstancesClient(); - * try { - * $instance = 'instance'; - * $instancesReportHostAsFaultyRequestResource = new InstancesReportHostAsFaultyRequest(); - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $instancesClient->reportHostAsFaulty($instance, $instancesReportHostAsFaultyRequestResource, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instancesClient->reportHostAsFaulty($instance, $instancesReportHostAsFaultyRequestResource, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instancesClient->resumeOperation($operationName, 'reportHostAsFaulty'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instancesClient->close(); - * } - * ``` - * - * @param string $instance Name of the instance scoping this request. - * @param InstancesReportHostAsFaultyRequest $instancesReportHostAsFaultyRequestResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 reportHostAsFaulty($instance, $instancesReportHostAsFaultyRequestResource, $project, $zone, array $optionalArgs = []) - { - $request = new ReportHostAsFaultyInstanceRequest(); - $requestParamHeaders = []; - $request->setInstance($instance); - $request->setInstancesReportHostAsFaultyRequestResource($instancesReportHostAsFaultyRequestResource); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['instance'] = $instance; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('ReportHostAsFaulty', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Performs a reset on the instance. This is a hard reset. The VM does not do a graceful shutdown. For more information, see Resetting an instance. - * - * Sample code: - * ``` - * $instancesClient = new InstancesClient(); - * try { - * $instance = 'instance'; - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $instancesClient->reset($instance, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instancesClient->reset($instance, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instancesClient->resumeOperation($operationName, 'reset'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instancesClient->close(); - * } - * ``` - * - * @param string $instance Name of the instance scoping this request. - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 reset($instance, $project, $zone, array $optionalArgs = []) - { - $request = new ResetInstanceRequest(); - $requestParamHeaders = []; - $request->setInstance($instance); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['instance'] = $instance; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('Reset', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Resumes an instance that was suspended using the instances().suspend method. - * - * Sample code: - * ``` - * $instancesClient = new InstancesClient(); - * try { - * $instance = 'instance'; - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $instancesClient->resume($instance, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instancesClient->resume($instance, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instancesClient->resumeOperation($operationName, 'resume'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instancesClient->close(); - * } - * ``` - * - * @param string $instance Name of the instance resource to resume. - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 resume($instance, $project, $zone, array $optionalArgs = []) - { - $request = new ResumeInstanceRequest(); - $requestParamHeaders = []; - $request->setInstance($instance); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['instance'] = $instance; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('Resume', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Sends diagnostic interrupt to the instance. - * - * Sample code: - * ``` - * $instancesClient = new InstancesClient(); - * try { - * $instance = 'instance'; - * $project = 'project'; - * $zone = 'zone'; - * $response = $instancesClient->sendDiagnosticInterrupt($instance, $project, $zone); - * } finally { - * $instancesClient->close(); - * } - * ``` - * - * @param string $instance Name of the instance scoping this request. - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\SendDiagnosticInterruptInstanceResponse - * - * @throws ApiException if the remote call fails - */ - public function sendDiagnosticInterrupt($instance, $project, $zone, array $optionalArgs = []) - { - $request = new SendDiagnosticInterruptInstanceRequest(); - $requestParamHeaders = []; - $request->setInstance($instance); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['instance'] = $instance; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('SendDiagnosticInterrupt', SendDiagnosticInterruptInstanceResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Sets deletion protection on the instance. - * - * Sample code: - * ``` - * $instancesClient = new InstancesClient(); - * try { - * $project = 'project'; - * $resource = 'resource'; - * $zone = 'zone'; - * $operationResponse = $instancesClient->setDeletionProtection($project, $resource, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instancesClient->setDeletionProtection($project, $resource, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instancesClient->resumeOperation($operationName, 'setDeletionProtection'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instancesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $resource Name or id of the resource for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type bool $deletionProtection - * Whether the resource should be protected against deletion. - * @type string $requestId - * 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. 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 setDeletionProtection($project, $resource, $zone, array $optionalArgs = []) - { - $request = new SetDeletionProtectionInstanceRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setResource($resource); - $request->setZone($zone); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['resource'] = $resource; - $requestParamHeaders['zone'] = $zone; - if (isset($optionalArgs['deletionProtection'])) { - $request->setDeletionProtection($optionalArgs['deletionProtection']); - } - - 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('SetDeletionProtection', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Sets the auto-delete flag for a disk attached to an instance. - * - * Sample code: - * ``` - * $instancesClient = new InstancesClient(); - * try { - * $autoDelete = false; - * $deviceName = 'device_name'; - * $instance = 'instance'; - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $instancesClient->setDiskAutoDelete($autoDelete, $deviceName, $instance, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instancesClient->setDiskAutoDelete($autoDelete, $deviceName, $instance, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instancesClient->resumeOperation($operationName, 'setDiskAutoDelete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instancesClient->close(); - * } - * ``` - * - * @param bool $autoDelete Whether to auto-delete the disk when the instance is deleted. - * @param string $deviceName The device name of the disk to modify. Make a get() request on the instance to view currently attached disks and device names. - * @param string $instance The instance name for this request. - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 setDiskAutoDelete($autoDelete, $deviceName, $instance, $project, $zone, array $optionalArgs = []) - { - $request = new SetDiskAutoDeleteInstanceRequest(); - $requestParamHeaders = []; - $request->setAutoDelete($autoDelete); - $request->setDeviceName($deviceName); - $request->setInstance($instance); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['instance'] = $instance; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('SetDiskAutoDelete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Sets the access control policy on the specified resource. Replaces any existing policy. - * - * Sample code: - * ``` - * $instancesClient = new InstancesClient(); - * try { - * $project = 'project'; - * $resource = 'resource'; - * $zone = 'zone'; - * $zoneSetPolicyRequestResource = new ZoneSetPolicyRequest(); - * $response = $instancesClient->setIamPolicy($project, $resource, $zone, $zoneSetPolicyRequestResource); - * } finally { - * $instancesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $resource Name or id of the resource for this request. - * @param string $zone The name of the zone for this request. - * @param ZoneSetPolicyRequest $zoneSetPolicyRequestResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function setIamPolicy($project, $resource, $zone, $zoneSetPolicyRequestResource, array $optionalArgs = []) - { - $request = new SetIamPolicyInstanceRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setResource($resource); - $request->setZone($zone); - $request->setZoneSetPolicyRequestResource($zoneSetPolicyRequestResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['resource'] = $resource; - $requestParamHeaders['zone'] = $zone; - $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(); - } - - /** - * Sets labels on an instance. To learn more about labels, read the Labeling Resources documentation. - * - * Sample code: - * ``` - * $instancesClient = new InstancesClient(); - * try { - * $instance = 'instance'; - * $instancesSetLabelsRequestResource = new InstancesSetLabelsRequest(); - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $instancesClient->setLabels($instance, $instancesSetLabelsRequestResource, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instancesClient->setLabels($instance, $instancesSetLabelsRequestResource, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instancesClient->resumeOperation($operationName, 'setLabels'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instancesClient->close(); - * } - * ``` - * - * @param string $instance Name of the instance scoping this request. - * @param InstancesSetLabelsRequest $instancesSetLabelsRequestResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 setLabels($instance, $instancesSetLabelsRequestResource, $project, $zone, array $optionalArgs = []) - { - $request = new SetLabelsInstanceRequest(); - $requestParamHeaders = []; - $request->setInstance($instance); - $request->setInstancesSetLabelsRequestResource($instancesSetLabelsRequestResource); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['instance'] = $instance; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('SetLabels', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Changes the number and/or type of accelerator for a stopped instance to the values specified in the request. - * - * Sample code: - * ``` - * $instancesClient = new InstancesClient(); - * try { - * $instance = 'instance'; - * $instancesSetMachineResourcesRequestResource = new InstancesSetMachineResourcesRequest(); - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $instancesClient->setMachineResources($instance, $instancesSetMachineResourcesRequestResource, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instancesClient->setMachineResources($instance, $instancesSetMachineResourcesRequestResource, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instancesClient->resumeOperation($operationName, 'setMachineResources'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instancesClient->close(); - * } - * ``` - * - * @param string $instance Name of the instance scoping this request. - * @param InstancesSetMachineResourcesRequest $instancesSetMachineResourcesRequestResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 setMachineResources($instance, $instancesSetMachineResourcesRequestResource, $project, $zone, array $optionalArgs = []) - { - $request = new SetMachineResourcesInstanceRequest(); - $requestParamHeaders = []; - $request->setInstance($instance); - $request->setInstancesSetMachineResourcesRequestResource($instancesSetMachineResourcesRequestResource); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['instance'] = $instance; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('SetMachineResources', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Changes the machine type for a stopped instance to the machine type specified in the request. - * - * Sample code: - * ``` - * $instancesClient = new InstancesClient(); - * try { - * $instance = 'instance'; - * $instancesSetMachineTypeRequestResource = new InstancesSetMachineTypeRequest(); - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $instancesClient->setMachineType($instance, $instancesSetMachineTypeRequestResource, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instancesClient->setMachineType($instance, $instancesSetMachineTypeRequestResource, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instancesClient->resumeOperation($operationName, 'setMachineType'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instancesClient->close(); - * } - * ``` - * - * @param string $instance Name of the instance scoping this request. - * @param InstancesSetMachineTypeRequest $instancesSetMachineTypeRequestResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 setMachineType($instance, $instancesSetMachineTypeRequestResource, $project, $zone, array $optionalArgs = []) - { - $request = new SetMachineTypeInstanceRequest(); - $requestParamHeaders = []; - $request->setInstance($instance); - $request->setInstancesSetMachineTypeRequestResource($instancesSetMachineTypeRequestResource); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['instance'] = $instance; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('SetMachineType', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Sets metadata for the specified instance to the data included in the request. - * - * Sample code: - * ``` - * $instancesClient = new InstancesClient(); - * try { - * $instance = 'instance'; - * $metadataResource = new Metadata(); - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $instancesClient->setMetadata($instance, $metadataResource, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instancesClient->setMetadata($instance, $metadataResource, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instancesClient->resumeOperation($operationName, 'setMetadata'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instancesClient->close(); - * } - * ``` - * - * @param string $instance Name of the instance scoping this request. - * @param Metadata $metadataResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 setMetadata($instance, $metadataResource, $project, $zone, array $optionalArgs = []) - { - $request = new SetMetadataInstanceRequest(); - $requestParamHeaders = []; - $request->setInstance($instance); - $request->setMetadataResource($metadataResource); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['instance'] = $instance; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('SetMetadata', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Changes the minimum CPU platform that this instance should use. This method can only be called on a stopped instance. For more information, read Specifying a Minimum CPU Platform. - * - * Sample code: - * ``` - * $instancesClient = new InstancesClient(); - * try { - * $instance = 'instance'; - * $instancesSetMinCpuPlatformRequestResource = new InstancesSetMinCpuPlatformRequest(); - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $instancesClient->setMinCpuPlatform($instance, $instancesSetMinCpuPlatformRequestResource, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instancesClient->setMinCpuPlatform($instance, $instancesSetMinCpuPlatformRequestResource, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instancesClient->resumeOperation($operationName, 'setMinCpuPlatform'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instancesClient->close(); - * } - * ``` - * - * @param string $instance Name of the instance scoping this request. - * @param InstancesSetMinCpuPlatformRequest $instancesSetMinCpuPlatformRequestResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 setMinCpuPlatform($instance, $instancesSetMinCpuPlatformRequestResource, $project, $zone, array $optionalArgs = []) - { - $request = new SetMinCpuPlatformInstanceRequest(); - $requestParamHeaders = []; - $request->setInstance($instance); - $request->setInstancesSetMinCpuPlatformRequestResource($instancesSetMinCpuPlatformRequestResource); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['instance'] = $instance; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('SetMinCpuPlatform', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Sets name of an instance. - * - * Sample code: - * ``` - * $instancesClient = new InstancesClient(); - * try { - * $instance = 'instance'; - * $instancesSetNameRequestResource = new InstancesSetNameRequest(); - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $instancesClient->setName($instance, $instancesSetNameRequestResource, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instancesClient->setName($instance, $instancesSetNameRequestResource, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instancesClient->resumeOperation($operationName, 'setName'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instancesClient->close(); - * } - * ``` - * - * @param string $instance The instance name for this request. - * @param InstancesSetNameRequest $instancesSetNameRequestResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 setName($instance, $instancesSetNameRequestResource, $project, $zone, array $optionalArgs = []) - { - $request = new SetNameInstanceRequest(); - $requestParamHeaders = []; - $request->setInstance($instance); - $request->setInstancesSetNameRequestResource($instancesSetNameRequestResource); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['instance'] = $instance; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('SetName', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Sets an instance's scheduling options. You can only call this method on a stopped instance, that is, a VM instance that is in a `TERMINATED` state. See Instance Life Cycle for more information on the possible instance states. For more information about setting scheduling options for a VM, see Set VM host maintenance policy. - * - * Sample code: - * ``` - * $instancesClient = new InstancesClient(); - * try { - * $instance = 'instance'; - * $project = 'project'; - * $schedulingResource = new Scheduling(); - * $zone = 'zone'; - * $operationResponse = $instancesClient->setScheduling($instance, $project, $schedulingResource, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instancesClient->setScheduling($instance, $project, $schedulingResource, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instancesClient->resumeOperation($operationName, 'setScheduling'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instancesClient->close(); - * } - * ``` - * - * @param string $instance Instance name for this request. - * @param string $project Project ID for this request. - * @param Scheduling $schedulingResource The body resource for this request - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 setScheduling($instance, $project, $schedulingResource, $zone, array $optionalArgs = []) - { - $request = new SetSchedulingInstanceRequest(); - $requestParamHeaders = []; - $request->setInstance($instance); - $request->setProject($project); - $request->setSchedulingResource($schedulingResource); - $request->setZone($zone); - $requestParamHeaders['instance'] = $instance; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('SetScheduling', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Sets the Google Cloud Armor security policy for the specified instance. For more information, see Google Cloud Armor Overview - * - * Sample code: - * ``` - * $instancesClient = new InstancesClient(); - * try { - * $instance = 'instance'; - * $instancesSetSecurityPolicyRequestResource = new InstancesSetSecurityPolicyRequest(); - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $instancesClient->setSecurityPolicy($instance, $instancesSetSecurityPolicyRequestResource, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instancesClient->setSecurityPolicy($instance, $instancesSetSecurityPolicyRequestResource, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instancesClient->resumeOperation($operationName, 'setSecurityPolicy'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instancesClient->close(); - * } - * ``` - * - * @param string $instance Name of the Instance resource to which the security policy should be set. The name should conform to RFC1035. - * @param InstancesSetSecurityPolicyRequest $instancesSetSecurityPolicyRequestResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $zone Name of the zone scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 setSecurityPolicy($instance, $instancesSetSecurityPolicyRequestResource, $project, $zone, array $optionalArgs = []) - { - $request = new SetSecurityPolicyInstanceRequest(); - $requestParamHeaders = []; - $request->setInstance($instance); - $request->setInstancesSetSecurityPolicyRequestResource($instancesSetSecurityPolicyRequestResource); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['instance'] = $instance; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('SetSecurityPolicy', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Sets the service account on the instance. For more information, read Changing the service account and access scopes for an instance. - * - * Sample code: - * ``` - * $instancesClient = new InstancesClient(); - * try { - * $instance = 'instance'; - * $instancesSetServiceAccountRequestResource = new InstancesSetServiceAccountRequest(); - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $instancesClient->setServiceAccount($instance, $instancesSetServiceAccountRequestResource, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instancesClient->setServiceAccount($instance, $instancesSetServiceAccountRequestResource, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instancesClient->resumeOperation($operationName, 'setServiceAccount'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instancesClient->close(); - * } - * ``` - * - * @param string $instance Name of the instance resource to start. - * @param InstancesSetServiceAccountRequest $instancesSetServiceAccountRequestResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 setServiceAccount($instance, $instancesSetServiceAccountRequestResource, $project, $zone, array $optionalArgs = []) - { - $request = new SetServiceAccountInstanceRequest(); - $requestParamHeaders = []; - $request->setInstance($instance); - $request->setInstancesSetServiceAccountRequestResource($instancesSetServiceAccountRequestResource); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['instance'] = $instance; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('SetServiceAccount', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Sets the Shielded Instance integrity policy for an instance. You can only use this method on a running instance. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. - * - * Sample code: - * ``` - * $instancesClient = new InstancesClient(); - * try { - * $instance = 'instance'; - * $project = 'project'; - * $shieldedInstanceIntegrityPolicyResource = new ShieldedInstanceIntegrityPolicy(); - * $zone = 'zone'; - * $operationResponse = $instancesClient->setShieldedInstanceIntegrityPolicy($instance, $project, $shieldedInstanceIntegrityPolicyResource, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instancesClient->setShieldedInstanceIntegrityPolicy($instance, $project, $shieldedInstanceIntegrityPolicyResource, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instancesClient->resumeOperation($operationName, 'setShieldedInstanceIntegrityPolicy'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instancesClient->close(); - * } - * ``` - * - * @param string $instance Name or id of the instance scoping this request. - * @param string $project Project ID for this request. - * @param ShieldedInstanceIntegrityPolicy $shieldedInstanceIntegrityPolicyResource The body resource for this request - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 setShieldedInstanceIntegrityPolicy($instance, $project, $shieldedInstanceIntegrityPolicyResource, $zone, array $optionalArgs = []) - { - $request = new SetShieldedInstanceIntegrityPolicyInstanceRequest(); - $requestParamHeaders = []; - $request->setInstance($instance); - $request->setProject($project); - $request->setShieldedInstanceIntegrityPolicyResource($shieldedInstanceIntegrityPolicyResource); - $request->setZone($zone); - $requestParamHeaders['instance'] = $instance; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('SetShieldedInstanceIntegrityPolicy', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Sets network tags for the specified instance to the data included in the request. - * - * Sample code: - * ``` - * $instancesClient = new InstancesClient(); - * try { - * $instance = 'instance'; - * $project = 'project'; - * $tagsResource = new Tags(); - * $zone = 'zone'; - * $operationResponse = $instancesClient->setTags($instance, $project, $tagsResource, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instancesClient->setTags($instance, $project, $tagsResource, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instancesClient->resumeOperation($operationName, 'setTags'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instancesClient->close(); - * } - * ``` - * - * @param string $instance Name of the instance scoping this request. - * @param string $project Project ID for this request. - * @param Tags $tagsResource The body resource for this request - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 setTags($instance, $project, $tagsResource, $zone, array $optionalArgs = []) - { - $request = new SetTagsInstanceRequest(); - $requestParamHeaders = []; - $request->setInstance($instance); - $request->setProject($project); - $request->setTagsResource($tagsResource); - $request->setZone($zone); - $requestParamHeaders['instance'] = $instance; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('SetTags', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Simulates a host maintenance event on a VM. For more information, see Simulate a host maintenance event. - * - * Sample code: - * ``` - * $instancesClient = new InstancesClient(); - * try { - * $instance = 'instance'; - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $instancesClient->simulateMaintenanceEvent($instance, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instancesClient->simulateMaintenanceEvent($instance, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instancesClient->resumeOperation($operationName, 'simulateMaintenanceEvent'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instancesClient->close(); - * } - * ``` - * - * @param string $instance Name of the instance scoping this request. - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 $withExtendedNotifications - * Determines whether the customers receive notifications before migration. Only applicable to SF vms. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 simulateMaintenanceEvent($instance, $project, $zone, array $optionalArgs = []) - { - $request = new SimulateMaintenanceEventInstanceRequest(); - $requestParamHeaders = []; - $request->setInstance($instance); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['instance'] = $instance; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - if (isset($optionalArgs['withExtendedNotifications'])) { - $request->setWithExtendedNotifications($optionalArgs['withExtendedNotifications']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('SimulateMaintenanceEvent', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Starts an instance that was stopped using the instances().stop method. For more information, see Restart an instance. - * - * Sample code: - * ``` - * $instancesClient = new InstancesClient(); - * try { - * $instance = 'instance'; - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $instancesClient->start($instance, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instancesClient->start($instance, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instancesClient->resumeOperation($operationName, 'start'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instancesClient->close(); - * } - * ``` - * - * @param string $instance Name of the instance resource to start. - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 start($instance, $project, $zone, array $optionalArgs = []) - { - $request = new StartInstanceRequest(); - $requestParamHeaders = []; - $request->setInstance($instance); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['instance'] = $instance; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('Start', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Starts an instance that was stopped using the instances().stop method. For more information, see Restart an instance. - * - * Sample code: - * ``` - * $instancesClient = new InstancesClient(); - * try { - * $instance = 'instance'; - * $instancesStartWithEncryptionKeyRequestResource = new InstancesStartWithEncryptionKeyRequest(); - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $instancesClient->startWithEncryptionKey($instance, $instancesStartWithEncryptionKeyRequestResource, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instancesClient->startWithEncryptionKey($instance, $instancesStartWithEncryptionKeyRequestResource, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instancesClient->resumeOperation($operationName, 'startWithEncryptionKey'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instancesClient->close(); - * } - * ``` - * - * @param string $instance Name of the instance resource to start. - * @param InstancesStartWithEncryptionKeyRequest $instancesStartWithEncryptionKeyRequestResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 startWithEncryptionKey($instance, $instancesStartWithEncryptionKeyRequestResource, $project, $zone, array $optionalArgs = []) - { - $request = new StartWithEncryptionKeyInstanceRequest(); - $requestParamHeaders = []; - $request->setInstance($instance); - $request->setInstancesStartWithEncryptionKeyRequestResource($instancesStartWithEncryptionKeyRequestResource); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['instance'] = $instance; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('StartWithEncryptionKey', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Stops a running instance, shutting it down cleanly, and allows you to restart the instance at a later time. Stopped instances do not incur VM usage charges while they are stopped. However, resources that the VM is using, such as persistent disks and static IP addresses, will continue to be charged until they are deleted. For more information, see Stopping an instance. - * - * Sample code: - * ``` - * $instancesClient = new InstancesClient(); - * try { - * $instance = 'instance'; - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $instancesClient->stop($instance, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instancesClient->stop($instance, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instancesClient->resumeOperation($operationName, 'stop'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instancesClient->close(); - * } - * ``` - * - * @param string $instance Name of the instance resource to stop. - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type bool $discardLocalSsd - * This property is required if the instance has any attached Local SSD disks. If false, Local SSD data will be preserved when the instance is suspended. If true, the contents of any attached Local SSD disks will be discarded. - * @type string $requestId - * 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. 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 stop($instance, $project, $zone, array $optionalArgs = []) - { - $request = new StopInstanceRequest(); - $requestParamHeaders = []; - $request->setInstance($instance); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['instance'] = $instance; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - if (isset($optionalArgs['discardLocalSsd'])) { - $request->setDiscardLocalSsd($optionalArgs['discardLocalSsd']); - } - - 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('Stop', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * This method suspends a running instance, saving its state to persistent storage, and allows you to resume the instance at a later time. Suspended instances have no compute costs (cores or RAM), and incur only storage charges for the saved VM memory and localSSD data. Any charged resources the virtual machine was using, such as persistent disks and static IP addresses, will continue to be charged while the instance is suspended. For more information, see Suspending and resuming an instance. - * - * Sample code: - * ``` - * $instancesClient = new InstancesClient(); - * try { - * $instance = 'instance'; - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $instancesClient->suspend($instance, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instancesClient->suspend($instance, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instancesClient->resumeOperation($operationName, 'suspend'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instancesClient->close(); - * } - * ``` - * - * @param string $instance Name of the instance resource to suspend. - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type bool $discardLocalSsd - * This property is required if the instance has any attached Local SSD disks. If false, Local SSD data will be preserved when the instance is suspended. If true, the contents of any attached Local SSD disks will be discarded. - * @type string $requestId - * 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. 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 suspend($instance, $project, $zone, array $optionalArgs = []) - { - $request = new SuspendInstanceRequest(); - $requestParamHeaders = []; - $request->setInstance($instance); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['instance'] = $instance; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - if (isset($optionalArgs['discardLocalSsd'])) { - $request->setDiscardLocalSsd($optionalArgs['discardLocalSsd']); - } - - 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('Suspend', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns permissions that a caller has on the specified resource. - * - * Sample code: - * ``` - * $instancesClient = new InstancesClient(); - * try { - * $project = 'project'; - * $resource = 'resource'; - * $testPermissionsRequestResource = new TestPermissionsRequest(); - * $zone = 'zone'; - * $response = $instancesClient->testIamPermissions($project, $resource, $testPermissionsRequestResource, $zone); - * } finally { - * $instancesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $resource Name or id of the resource for this request. - * @param TestPermissionsRequest $testPermissionsRequestResource The body resource for this request - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\TestPermissionsResponse - * - * @throws ApiException if the remote call fails - */ - public function testIamPermissions($project, $resource, $testPermissionsRequestResource, $zone, array $optionalArgs = []) - { - $request = new TestIamPermissionsInstanceRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setResource($resource); - $request->setTestPermissionsRequestResource($testPermissionsRequestResource); - $request->setZone($zone); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['resource'] = $resource; - $requestParamHeaders['zone'] = $zone; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('TestIamPermissions', TestPermissionsResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Updates an instance only if the necessary resources are available. This method can update only a specific set of instance properties. See Updating a running instance for a list of updatable instance properties. - * - * Sample code: - * ``` - * $instancesClient = new InstancesClient(); - * try { - * $instance = 'instance'; - * $instanceResource = new Instance(); - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $instancesClient->update($instance, $instanceResource, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instancesClient->update($instance, $instanceResource, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instancesClient->resumeOperation($operationName, 'update'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instancesClient->close(); - * } - * ``` - * - * @param string $instance Name of the instance resource to update. - * @param Instance $instanceResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $minimalAction - * Specifies the action to take when updating an instance even if the updated properties do not require it. If not specified, then Compute Engine acts based on the minimum action that the updated properties require. - * Check the MinimalAction enum for the list of possible values. - * @type string $mostDisruptiveAllowedAction - * Specifies the most disruptive action that can be taken on the instance as part of the update. Compute Engine returns an error if the instance properties require a more disruptive action as part of the instance update. Valid options from lowest to highest are NO_EFFECT, REFRESH, and RESTART. - * Check the MostDisruptiveAllowedAction enum for the list of possible values. - * @type string $requestId - * 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. 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 update($instance, $instanceResource, $project, $zone, array $optionalArgs = []) - { - $request = new UpdateInstanceRequest(); - $requestParamHeaders = []; - $request->setInstance($instance); - $request->setInstanceResource($instanceResource); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['instance'] = $instance; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - if (isset($optionalArgs['minimalAction'])) { - $request->setMinimalAction($optionalArgs['minimalAction']); - } - - if (isset($optionalArgs['mostDisruptiveAllowedAction'])) { - $request->setMostDisruptiveAllowedAction($optionalArgs['mostDisruptiveAllowedAction']); - } - - 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('Update', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Updates the specified access config from an instance's network interface with the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. - * - * Sample code: - * ``` - * $instancesClient = new InstancesClient(); - * try { - * $accessConfigResource = new AccessConfig(); - * $instance = 'instance'; - * $networkInterface = 'network_interface'; - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $instancesClient->updateAccessConfig($accessConfigResource, $instance, $networkInterface, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instancesClient->updateAccessConfig($accessConfigResource, $instance, $networkInterface, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instancesClient->resumeOperation($operationName, 'updateAccessConfig'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instancesClient->close(); - * } - * ``` - * - * @param AccessConfig $accessConfigResource The body resource for this request - * @param string $instance The instance name for this request. - * @param string $networkInterface The name of the network interface where the access config is attached. - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 updateAccessConfig($accessConfigResource, $instance, $networkInterface, $project, $zone, array $optionalArgs = []) - { - $request = new UpdateAccessConfigInstanceRequest(); - $requestParamHeaders = []; - $request->setAccessConfigResource($accessConfigResource); - $request->setInstance($instance); - $request->setNetworkInterface($networkInterface); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['instance'] = $instance; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('UpdateAccessConfig', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Updates the Display config for a VM instance. You can only use this method on a stopped VM instance. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. - * - * Sample code: - * ``` - * $instancesClient = new InstancesClient(); - * try { - * $displayDeviceResource = new DisplayDevice(); - * $instance = 'instance'; - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $instancesClient->updateDisplayDevice($displayDeviceResource, $instance, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instancesClient->updateDisplayDevice($displayDeviceResource, $instance, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instancesClient->resumeOperation($operationName, 'updateDisplayDevice'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instancesClient->close(); - * } - * ``` - * - * @param DisplayDevice $displayDeviceResource The body resource for this request - * @param string $instance Name of the instance scoping this request. - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 updateDisplayDevice($displayDeviceResource, $instance, $project, $zone, array $optionalArgs = []) - { - $request = new UpdateDisplayDeviceInstanceRequest(); - $requestParamHeaders = []; - $request->setDisplayDeviceResource($displayDeviceResource); - $request->setInstance($instance); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['instance'] = $instance; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('UpdateDisplayDevice', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Updates an instance's network interface. This method can only update an interface's alias IP range and attached network. See Modifying alias IP ranges for an existing instance for instructions on changing alias IP ranges. See Migrating a VM between networks for instructions on migrating an interface. This method follows PATCH semantics. - * - * Sample code: - * ``` - * $instancesClient = new InstancesClient(); - * try { - * $instance = 'instance'; - * $networkInterface = 'network_interface'; - * $networkInterfaceResource = new NetworkInterface(); - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $instancesClient->updateNetworkInterface($instance, $networkInterface, $networkInterfaceResource, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instancesClient->updateNetworkInterface($instance, $networkInterface, $networkInterfaceResource, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instancesClient->resumeOperation($operationName, 'updateNetworkInterface'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instancesClient->close(); - * } - * ``` - * - * @param string $instance The instance name for this request. - * @param string $networkInterface The name of the network interface to update. - * @param NetworkInterface $networkInterfaceResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 updateNetworkInterface($instance, $networkInterface, $networkInterfaceResource, $project, $zone, array $optionalArgs = []) - { - $request = new UpdateNetworkInterfaceInstanceRequest(); - $requestParamHeaders = []; - $request->setInstance($instance); - $request->setNetworkInterface($networkInterface); - $request->setNetworkInterfaceResource($networkInterfaceResource); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['instance'] = $instance; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('UpdateNetworkInterface', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Updates the Shielded Instance config for an instance. You can only use this method on a stopped instance. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. - * - * Sample code: - * ``` - * $instancesClient = new InstancesClient(); - * try { - * $instance = 'instance'; - * $project = 'project'; - * $shieldedInstanceConfigResource = new ShieldedInstanceConfig(); - * $zone = 'zone'; - * $operationResponse = $instancesClient->updateShieldedInstanceConfig($instance, $project, $shieldedInstanceConfigResource, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instancesClient->updateShieldedInstanceConfig($instance, $project, $shieldedInstanceConfigResource, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instancesClient->resumeOperation($operationName, 'updateShieldedInstanceConfig'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instancesClient->close(); - * } - * ``` - * - * @param string $instance Name or id of the instance scoping this request. - * @param string $project Project ID for this request. - * @param ShieldedInstanceConfig $shieldedInstanceConfigResource The body resource for this request - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 updateShieldedInstanceConfig($instance, $project, $shieldedInstanceConfigResource, $zone, array $optionalArgs = []) - { - $request = new UpdateShieldedInstanceConfigInstanceRequest(); - $requestParamHeaders = []; - $request->setInstance($instance); - $request->setProject($project); - $request->setShieldedInstanceConfigResource($shieldedInstanceConfigResource); - $request->setZone($zone); - $requestParamHeaders['instance'] = $instance; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('UpdateShieldedInstanceConfig', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/InstantSnapshotsGapicClient.php b/Compute/src/V1/Gapic/InstantSnapshotsGapicClient.php deleted file mode 100644 index 5632a3246af3..000000000000 --- a/Compute/src/V1/Gapic/InstantSnapshotsGapicClient.php +++ /dev/null @@ -1,873 +0,0 @@ -aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $instantSnapshotsClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $instantSnapshotsClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\InstantSnapshotsClient}. - */ -class InstantSnapshotsGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.InstantSnapshots'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/instant_snapshots_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/instant_snapshots_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/instant_snapshots_rest_client_config.php', - ], - ], - 'operationsClientClass' => ZoneOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an ZoneOperationsClient object with the same endpoint as $this. - * - * @return ZoneOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getZone', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetZoneOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteZoneOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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); - } - - /** - * Retrieves an aggregated list of instantSnapshots. To prevent failure, Google recommends that you set the `returnPartialSuccess` parameter to `true`. - * - * Sample code: - * ``` - * $instantSnapshotsClient = new InstantSnapshotsClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $instantSnapshotsClient->aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $instantSnapshotsClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $instantSnapshotsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type bool $includeAllScopes - * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type int $serviceProjectNumber - * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable 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 aggregatedList($project, array $optionalArgs = []) - { - $request = new AggregatedListInstantSnapshotsRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['includeAllScopes'])) { - $request->setIncludeAllScopes($optionalArgs['includeAllScopes']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - if (isset($optionalArgs['serviceProjectNumber'])) { - $request->setServiceProjectNumber($optionalArgs['serviceProjectNumber']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('AggregatedList', $optionalArgs, InstantSnapshotAggregatedList::class, $request); - } - - /** - * Deletes the specified InstantSnapshot resource. Keep in mind that deleting a single instantSnapshot might not necessarily delete all the data on that instantSnapshot. If any data on the instantSnapshot that is marked for deletion is needed for subsequent instantSnapshots, the data will be moved to the next corresponding instantSnapshot. For more information, see Deleting instantSnapshots. - * - * Sample code: - * ``` - * $instantSnapshotsClient = new InstantSnapshotsClient(); - * try { - * $instantSnapshot = 'instant_snapshot'; - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $instantSnapshotsClient->delete($instantSnapshot, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instantSnapshotsClient->delete($instantSnapshot, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instantSnapshotsClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instantSnapshotsClient->close(); - * } - * ``` - * - * @param string $instantSnapshot Name of the InstantSnapshot resource to delete. - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($instantSnapshot, $project, $zone, array $optionalArgs = []) - { - $request = new DeleteInstantSnapshotRequest(); - $requestParamHeaders = []; - $request->setInstantSnapshot($instantSnapshot); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['instant_snapshot'] = $instantSnapshot; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns the specified InstantSnapshot resource in the specified zone. - * - * Sample code: - * ``` - * $instantSnapshotsClient = new InstantSnapshotsClient(); - * try { - * $instantSnapshot = 'instant_snapshot'; - * $project = 'project'; - * $zone = 'zone'; - * $response = $instantSnapshotsClient->get($instantSnapshot, $project, $zone); - * } finally { - * $instantSnapshotsClient->close(); - * } - * ``` - * - * @param string $instantSnapshot Name of the InstantSnapshot resource to return. - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\InstantSnapshot - * - * @throws ApiException if the remote call fails - */ - public function get($instantSnapshot, $project, $zone, array $optionalArgs = []) - { - $request = new GetInstantSnapshotRequest(); - $requestParamHeaders = []; - $request->setInstantSnapshot($instantSnapshot); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['instant_snapshot'] = $instantSnapshot; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', InstantSnapshot::class, $optionalArgs, $request)->wait(); - } - - /** - * Gets the access control policy for a resource. May be empty if no such policy or resource exists. - * - * Sample code: - * ``` - * $instantSnapshotsClient = new InstantSnapshotsClient(); - * try { - * $project = 'project'; - * $resource = 'resource'; - * $zone = 'zone'; - * $response = $instantSnapshotsClient->getIamPolicy($project, $resource, $zone); - * } finally { - * $instantSnapshotsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $resource Name or id of the resource for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type int $optionsRequestedPolicyVersion - * Requested IAM Policy version. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function getIamPolicy($project, $resource, $zone, array $optionalArgs = []) - { - $request = new GetIamPolicyInstantSnapshotRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setResource($resource); - $request->setZone($zone); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['resource'] = $resource; - $requestParamHeaders['zone'] = $zone; - if (isset($optionalArgs['optionsRequestedPolicyVersion'])) { - $request->setOptionsRequestedPolicyVersion($optionalArgs['optionsRequestedPolicyVersion']); - } - - $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(); - } - - /** - * Creates an instant snapshot in the specified zone. - * - * Sample code: - * ``` - * $instantSnapshotsClient = new InstantSnapshotsClient(); - * try { - * $instantSnapshotResource = new InstantSnapshot(); - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $instantSnapshotsClient->insert($instantSnapshotResource, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instantSnapshotsClient->insert($instantSnapshotResource, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instantSnapshotsClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instantSnapshotsClient->close(); - * } - * ``` - * - * @param InstantSnapshot $instantSnapshotResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $zone Name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 insert($instantSnapshotResource, $project, $zone, array $optionalArgs = []) - { - $request = new InsertInstantSnapshotRequest(); - $requestParamHeaders = []; - $request->setInstantSnapshotResource($instantSnapshotResource); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Retrieves the list of InstantSnapshot resources contained within the specified zone. - * - * Sample code: - * ``` - * $instantSnapshotsClient = new InstantSnapshotsClient(); - * try { - * $project = 'project'; - * $zone = 'zone'; - * // Iterate over pages of elements - * $pagedResponse = $instantSnapshotsClient->list($project, $zone); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $instantSnapshotsClient->list($project, $zone); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $instantSnapshotsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, $zone, array $optionalArgs = []) - { - $request = new ListInstantSnapshotsRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, InstantSnapshotList::class, $request); - } - - /** - * Sets the access control policy on the specified resource. Replaces any existing policy. - * - * Sample code: - * ``` - * $instantSnapshotsClient = new InstantSnapshotsClient(); - * try { - * $project = 'project'; - * $resource = 'resource'; - * $zone = 'zone'; - * $zoneSetPolicyRequestResource = new ZoneSetPolicyRequest(); - * $response = $instantSnapshotsClient->setIamPolicy($project, $resource, $zone, $zoneSetPolicyRequestResource); - * } finally { - * $instantSnapshotsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $resource Name or id of the resource for this request. - * @param string $zone The name of the zone for this request. - * @param ZoneSetPolicyRequest $zoneSetPolicyRequestResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function setIamPolicy($project, $resource, $zone, $zoneSetPolicyRequestResource, array $optionalArgs = []) - { - $request = new SetIamPolicyInstantSnapshotRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setResource($resource); - $request->setZone($zone); - $request->setZoneSetPolicyRequestResource($zoneSetPolicyRequestResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['resource'] = $resource; - $requestParamHeaders['zone'] = $zone; - $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(); - } - - /** - * Sets the labels on a instantSnapshot in the given zone. To learn more about labels, read the Labeling Resources documentation. - * - * Sample code: - * ``` - * $instantSnapshotsClient = new InstantSnapshotsClient(); - * try { - * $project = 'project'; - * $resource = 'resource'; - * $zone = 'zone'; - * $zoneSetLabelsRequestResource = new ZoneSetLabelsRequest(); - * $operationResponse = $instantSnapshotsClient->setLabels($project, $resource, $zone, $zoneSetLabelsRequestResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $instantSnapshotsClient->setLabels($project, $resource, $zone, $zoneSetLabelsRequestResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $instantSnapshotsClient->resumeOperation($operationName, 'setLabels'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $instantSnapshotsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $resource Name or id of the resource for this request. - * @param string $zone The name of the zone for this request. - * @param ZoneSetLabelsRequest $zoneSetLabelsRequestResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 setLabels($project, $resource, $zone, $zoneSetLabelsRequestResource, array $optionalArgs = []) - { - $request = new SetLabelsInstantSnapshotRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setResource($resource); - $request->setZone($zone); - $request->setZoneSetLabelsRequestResource($zoneSetLabelsRequestResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['resource'] = $resource; - $requestParamHeaders['zone'] = $zone; - 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('SetLabels', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns permissions that a caller has on the specified resource. - * - * Sample code: - * ``` - * $instantSnapshotsClient = new InstantSnapshotsClient(); - * try { - * $project = 'project'; - * $resource = 'resource'; - * $testPermissionsRequestResource = new TestPermissionsRequest(); - * $zone = 'zone'; - * $response = $instantSnapshotsClient->testIamPermissions($project, $resource, $testPermissionsRequestResource, $zone); - * } finally { - * $instantSnapshotsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $resource Name or id of the resource for this request. - * @param TestPermissionsRequest $testPermissionsRequestResource The body resource for this request - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\TestPermissionsResponse - * - * @throws ApiException if the remote call fails - */ - public function testIamPermissions($project, $resource, $testPermissionsRequestResource, $zone, array $optionalArgs = []) - { - $request = new TestIamPermissionsInstantSnapshotRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setResource($resource); - $request->setTestPermissionsRequestResource($testPermissionsRequestResource); - $request->setZone($zone); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['resource'] = $resource; - $requestParamHeaders['zone'] = $zone; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('TestIamPermissions', TestPermissionsResponse::class, $optionalArgs, $request)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/InterconnectAttachmentGroupsGapicClient.php b/Compute/src/V1/Gapic/InterconnectAttachmentGroupsGapicClient.php deleted file mode 100644 index c777db7fd993..000000000000 --- a/Compute/src/V1/Gapic/InterconnectAttachmentGroupsGapicClient.php +++ /dev/null @@ -1,789 +0,0 @@ -delete($interconnectAttachmentGroup, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $interconnectAttachmentGroupsClient->delete($interconnectAttachmentGroup, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $interconnectAttachmentGroupsClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $interconnectAttachmentGroupsClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\InterconnectAttachmentGroupsClient}. - */ -class InterconnectAttachmentGroupsGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.InterconnectAttachmentGroups'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/interconnect_attachment_groups_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/interconnect_attachment_groups_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/interconnect_attachment_groups_rest_client_config.php', - ], - ], - 'operationsClientClass' => GlobalOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an GlobalOperationsClient object with the same endpoint as $this. - * - * @return GlobalOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetGlobalOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteGlobalOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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 the specified InterconnectAttachmentGroup in the given scope - * - * Sample code: - * ``` - * $interconnectAttachmentGroupsClient = new InterconnectAttachmentGroupsClient(); - * try { - * $interconnectAttachmentGroup = 'interconnect_attachment_group'; - * $project = 'project'; - * $operationResponse = $interconnectAttachmentGroupsClient->delete($interconnectAttachmentGroup, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $interconnectAttachmentGroupsClient->delete($interconnectAttachmentGroup, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $interconnectAttachmentGroupsClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $interconnectAttachmentGroupsClient->close(); - * } - * ``` - * - * @param string $interconnectAttachmentGroup Name of the InterconnectAttachmentGroup resource to delete. - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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). end_interface: MixerMutationRequestBuilder - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 delete($interconnectAttachmentGroup, $project, array $optionalArgs = []) - { - $request = new DeleteInterconnectAttachmentGroupRequest(); - $requestParamHeaders = []; - $request->setInterconnectAttachmentGroup($interconnectAttachmentGroup); - $request->setProject($project); - $requestParamHeaders['interconnect_attachment_group'] = $interconnectAttachmentGroup; - $requestParamHeaders['project'] = $project; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns the specified InterconnectAttachmentGroup resource in the given scope. - * - * Sample code: - * ``` - * $interconnectAttachmentGroupsClient = new InterconnectAttachmentGroupsClient(); - * try { - * $interconnectAttachmentGroup = 'interconnect_attachment_group'; - * $project = 'project'; - * $response = $interconnectAttachmentGroupsClient->get($interconnectAttachmentGroup, $project); - * } finally { - * $interconnectAttachmentGroupsClient->close(); - * } - * ``` - * - * @param string $interconnectAttachmentGroup Name of the InterconnectAttachmentGroup resource to return. - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\InterconnectAttachmentGroup - * - * @throws ApiException if the remote call fails - */ - public function get($interconnectAttachmentGroup, $project, array $optionalArgs = []) - { - $request = new GetInterconnectAttachmentGroupRequest(); - $requestParamHeaders = []; - $request->setInterconnectAttachmentGroup($interconnectAttachmentGroup); - $request->setProject($project); - $requestParamHeaders['interconnect_attachment_group'] = $interconnectAttachmentGroup; - $requestParamHeaders['project'] = $project; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', InterconnectAttachmentGroup::class, $optionalArgs, $request)->wait(); - } - - /** - * Gets the access control policy for a resource. May be empty if no such policy or resource exists. - * - * Sample code: - * ``` - * $interconnectAttachmentGroupsClient = new InterconnectAttachmentGroupsClient(); - * try { - * $project = 'project'; - * $resource = 'resource'; - * $response = $interconnectAttachmentGroupsClient->getIamPolicy($project, $resource); - * } finally { - * $interconnectAttachmentGroupsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $resource Name or id of the resource for this request. - * @param array $optionalArgs { - * Optional. - * - * @type int $optionsRequestedPolicyVersion - * Requested IAM Policy version. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function getIamPolicy($project, $resource, array $optionalArgs = []) - { - $request = new GetIamPolicyInterconnectAttachmentGroupRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setResource($resource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['optionsRequestedPolicyVersion'])) { - $request->setOptionsRequestedPolicyVersion($optionalArgs['optionsRequestedPolicyVersion']); - } - - $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(); - } - - /** - * Returns the InterconnectAttachmentStatuses for the specified InterconnectAttachmentGroup resource. - * - * Sample code: - * ``` - * $interconnectAttachmentGroupsClient = new InterconnectAttachmentGroupsClient(); - * try { - * $interconnectAttachmentGroup = 'interconnect_attachment_group'; - * $project = 'project'; - * $response = $interconnectAttachmentGroupsClient->getOperationalStatus($interconnectAttachmentGroup, $project); - * } finally { - * $interconnectAttachmentGroupsClient->close(); - * } - * ``` - * - * @param string $interconnectAttachmentGroup Name of the interconnectAttachmentGroup resource to query. - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\InterconnectAttachmentGroupsGetOperationalStatusResponse - * - * @throws ApiException if the remote call fails - */ - public function getOperationalStatus($interconnectAttachmentGroup, $project, array $optionalArgs = []) - { - $request = new GetOperationalStatusInterconnectAttachmentGroupRequest(); - $requestParamHeaders = []; - $request->setInterconnectAttachmentGroup($interconnectAttachmentGroup); - $request->setProject($project); - $requestParamHeaders['interconnect_attachment_group'] = $interconnectAttachmentGroup; - $requestParamHeaders['project'] = $project; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetOperationalStatus', InterconnectAttachmentGroupsGetOperationalStatusResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates a InterconnectAttachmentGroup in the specified project in the given scope using the parameters that are included in the request. - * - * Sample code: - * ``` - * $interconnectAttachmentGroupsClient = new InterconnectAttachmentGroupsClient(); - * try { - * $interconnectAttachmentGroupResource = new InterconnectAttachmentGroup(); - * $project = 'project'; - * $operationResponse = $interconnectAttachmentGroupsClient->insert($interconnectAttachmentGroupResource, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $interconnectAttachmentGroupsClient->insert($interconnectAttachmentGroupResource, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $interconnectAttachmentGroupsClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $interconnectAttachmentGroupsClient->close(); - * } - * ``` - * - * @param InterconnectAttachmentGroup $interconnectAttachmentGroupResource The body resource for this request - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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). end_interface: MixerMutationRequestBuilder - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 insert($interconnectAttachmentGroupResource, $project, array $optionalArgs = []) - { - $request = new InsertInterconnectAttachmentGroupRequest(); - $requestParamHeaders = []; - $request->setInterconnectAttachmentGroupResource($interconnectAttachmentGroupResource); - $request->setProject($project); - $requestParamHeaders['project'] = $project; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Lists the InterconnectAttachmentGroups for a project in the given scope. - * - * Sample code: - * ``` - * $interconnectAttachmentGroupsClient = new InterconnectAttachmentGroupsClient(); - * try { - * $project = 'project'; - * $response = $interconnectAttachmentGroupsClient->list($project); - * } finally { - * $interconnectAttachmentGroupsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @type string $pageToken - * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. - * @type bool $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\InterconnectAttachmentGroupsListResponse - * - * @throws ApiException if the remote call fails - */ - public function list($project, array $optionalArgs = []) - { - $request = new ListInterconnectAttachmentGroupsRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('List', InterconnectAttachmentGroupsListResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Patches the specified InterconnectAttachmentGroup resource with the data included in the request. This method supports PATCH semantics and uses JSON merge patch format and processing rules. - * - * Sample code: - * ``` - * $interconnectAttachmentGroupsClient = new InterconnectAttachmentGroupsClient(); - * try { - * $interconnectAttachmentGroup = 'interconnect_attachment_group'; - * $interconnectAttachmentGroupResource = new InterconnectAttachmentGroup(); - * $project = 'project'; - * $operationResponse = $interconnectAttachmentGroupsClient->patch($interconnectAttachmentGroup, $interconnectAttachmentGroupResource, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $interconnectAttachmentGroupsClient->patch($interconnectAttachmentGroup, $interconnectAttachmentGroupResource, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $interconnectAttachmentGroupsClient->resumeOperation($operationName, 'patch'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $interconnectAttachmentGroupsClient->close(); - * } - * ``` - * - * @param string $interconnectAttachmentGroup Name of the InterconnectAttachmentGroup resource to patch. - * @param InterconnectAttachmentGroup $interconnectAttachmentGroupResource The body resource for this request - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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). end_interface: MixerMutationRequestBuilder - * @type string $updateMask - * The list of fields to update. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 patch($interconnectAttachmentGroup, $interconnectAttachmentGroupResource, $project, array $optionalArgs = []) - { - $request = new PatchInterconnectAttachmentGroupRequest(); - $requestParamHeaders = []; - $request->setInterconnectAttachmentGroup($interconnectAttachmentGroup); - $request->setInterconnectAttachmentGroupResource($interconnectAttachmentGroupResource); - $request->setProject($project); - $requestParamHeaders['interconnect_attachment_group'] = $interconnectAttachmentGroup; - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('Patch', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Sets the access control policy on the specified resource. Replaces any existing policy. - * - * Sample code: - * ``` - * $interconnectAttachmentGroupsClient = new InterconnectAttachmentGroupsClient(); - * try { - * $globalSetPolicyRequestResource = new GlobalSetPolicyRequest(); - * $project = 'project'; - * $resource = 'resource'; - * $response = $interconnectAttachmentGroupsClient->setIamPolicy($globalSetPolicyRequestResource, $project, $resource); - * } finally { - * $interconnectAttachmentGroupsClient->close(); - * } - * ``` - * - * @param GlobalSetPolicyRequest $globalSetPolicyRequestResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $resource Name or id of the resource for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function setIamPolicy($globalSetPolicyRequestResource, $project, $resource, array $optionalArgs = []) - { - $request = new SetIamPolicyInterconnectAttachmentGroupRequest(); - $requestParamHeaders = []; - $request->setGlobalSetPolicyRequestResource($globalSetPolicyRequestResource); - $request->setProject($project); - $request->setResource($resource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['resource'] = $resource; - $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 resource. - * - * Sample code: - * ``` - * $interconnectAttachmentGroupsClient = new InterconnectAttachmentGroupsClient(); - * try { - * $project = 'project'; - * $resource = 'resource'; - * $testPermissionsRequestResource = new TestPermissionsRequest(); - * $response = $interconnectAttachmentGroupsClient->testIamPermissions($project, $resource, $testPermissionsRequestResource); - * } finally { - * $interconnectAttachmentGroupsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $resource Name or id of the resource for this request. - * @param TestPermissionsRequest $testPermissionsRequestResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\TestPermissionsResponse - * - * @throws ApiException if the remote call fails - */ - public function testIamPermissions($project, $resource, $testPermissionsRequestResource, array $optionalArgs = []) - { - $request = new TestIamPermissionsInterconnectAttachmentGroupRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setResource($resource); - $request->setTestPermissionsRequestResource($testPermissionsRequestResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['resource'] = $resource; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('TestIamPermissions', TestPermissionsResponse::class, $optionalArgs, $request)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/InterconnectAttachmentsGapicClient.php b/Compute/src/V1/Gapic/InterconnectAttachmentsGapicClient.php deleted file mode 100644 index 9e12bca5b457..000000000000 --- a/Compute/src/V1/Gapic/InterconnectAttachmentsGapicClient.php +++ /dev/null @@ -1,799 +0,0 @@ -aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $interconnectAttachmentsClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $interconnectAttachmentsClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\InterconnectAttachmentsClient}. - */ -class InterconnectAttachmentsGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.InterconnectAttachments'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/interconnect_attachments_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/interconnect_attachments_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/interconnect_attachments_rest_client_config.php', - ], - ], - 'operationsClientClass' => RegionOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an RegionOperationsClient object with the same endpoint as $this. - * - * @return RegionOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetRegionOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteRegionOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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); - } - - /** - * Retrieves an aggregated list of interconnect attachments. To prevent failure, Google recommends that you set the `returnPartialSuccess` parameter to `true`. - * - * Sample code: - * ``` - * $interconnectAttachmentsClient = new InterconnectAttachmentsClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $interconnectAttachmentsClient->aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $interconnectAttachmentsClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $interconnectAttachmentsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type bool $includeAllScopes - * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type int $serviceProjectNumber - * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable 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 aggregatedList($project, array $optionalArgs = []) - { - $request = new AggregatedListInterconnectAttachmentsRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['includeAllScopes'])) { - $request->setIncludeAllScopes($optionalArgs['includeAllScopes']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - if (isset($optionalArgs['serviceProjectNumber'])) { - $request->setServiceProjectNumber($optionalArgs['serviceProjectNumber']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('AggregatedList', $optionalArgs, InterconnectAttachmentAggregatedList::class, $request); - } - - /** - * Deletes the specified interconnect attachment. - * - * Sample code: - * ``` - * $interconnectAttachmentsClient = new InterconnectAttachmentsClient(); - * try { - * $interconnectAttachment = 'interconnect_attachment'; - * $project = 'project'; - * $region = 'region'; - * $operationResponse = $interconnectAttachmentsClient->delete($interconnectAttachment, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $interconnectAttachmentsClient->delete($interconnectAttachment, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $interconnectAttachmentsClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $interconnectAttachmentsClient->close(); - * } - * ``` - * - * @param string $interconnectAttachment Name of the interconnect attachment to delete. - * @param string $project Project ID for this request. - * @param string $region Name of the region for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($interconnectAttachment, $project, $region, array $optionalArgs = []) - { - $request = new DeleteInterconnectAttachmentRequest(); - $requestParamHeaders = []; - $request->setInterconnectAttachment($interconnectAttachment); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['interconnect_attachment'] = $interconnectAttachment; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns the specified interconnect attachment. - * - * Sample code: - * ``` - * $interconnectAttachmentsClient = new InterconnectAttachmentsClient(); - * try { - * $interconnectAttachment = 'interconnect_attachment'; - * $project = 'project'; - * $region = 'region'; - * $response = $interconnectAttachmentsClient->get($interconnectAttachment, $project, $region); - * } finally { - * $interconnectAttachmentsClient->close(); - * } - * ``` - * - * @param string $interconnectAttachment Name of the interconnect attachment to return. - * @param string $project Project ID for this request. - * @param string $region Name of the region for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\InterconnectAttachment - * - * @throws ApiException if the remote call fails - */ - public function get($interconnectAttachment, $project, $region, array $optionalArgs = []) - { - $request = new GetInterconnectAttachmentRequest(); - $requestParamHeaders = []; - $request->setInterconnectAttachment($interconnectAttachment); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['interconnect_attachment'] = $interconnectAttachment; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', InterconnectAttachment::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates an InterconnectAttachment in the specified project using the data included in the request. - * - * Sample code: - * ``` - * $interconnectAttachmentsClient = new InterconnectAttachmentsClient(); - * try { - * $interconnectAttachmentResource = new InterconnectAttachment(); - * $project = 'project'; - * $region = 'region'; - * $operationResponse = $interconnectAttachmentsClient->insert($interconnectAttachmentResource, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $interconnectAttachmentsClient->insert($interconnectAttachmentResource, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $interconnectAttachmentsClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $interconnectAttachmentsClient->close(); - * } - * ``` - * - * @param InterconnectAttachment $interconnectAttachmentResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $region Name of the region for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 $validateOnly - * If true, the request will not be committed. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 insert($interconnectAttachmentResource, $project, $region, array $optionalArgs = []) - { - $request = new InsertInterconnectAttachmentRequest(); - $requestParamHeaders = []; - $request->setInterconnectAttachmentResource($interconnectAttachmentResource); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Retrieves the list of interconnect attachments contained within the specified region. - * - * Sample code: - * ``` - * $interconnectAttachmentsClient = new InterconnectAttachmentsClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * // Iterate over pages of elements - * $pagedResponse = $interconnectAttachmentsClient->list($project, $region); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $interconnectAttachmentsClient->list($project, $region); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $interconnectAttachmentsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, $region, array $optionalArgs = []) - { - $request = new ListInterconnectAttachmentsRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, InterconnectAttachmentList::class, $request); - } - - /** - * Updates the specified interconnect attachment with the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. - * - * Sample code: - * ``` - * $interconnectAttachmentsClient = new InterconnectAttachmentsClient(); - * try { - * $interconnectAttachment = 'interconnect_attachment'; - * $interconnectAttachmentResource = new InterconnectAttachment(); - * $project = 'project'; - * $region = 'region'; - * $operationResponse = $interconnectAttachmentsClient->patch($interconnectAttachment, $interconnectAttachmentResource, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $interconnectAttachmentsClient->patch($interconnectAttachment, $interconnectAttachmentResource, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $interconnectAttachmentsClient->resumeOperation($operationName, 'patch'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $interconnectAttachmentsClient->close(); - * } - * ``` - * - * @param string $interconnectAttachment Name of the interconnect attachment to patch. - * @param InterconnectAttachment $interconnectAttachmentResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 patch($interconnectAttachment, $interconnectAttachmentResource, $project, $region, array $optionalArgs = []) - { - $request = new PatchInterconnectAttachmentRequest(); - $requestParamHeaders = []; - $request->setInterconnectAttachment($interconnectAttachment); - $request->setInterconnectAttachmentResource($interconnectAttachmentResource); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['interconnect_attachment'] = $interconnectAttachment; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('Patch', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Sets the labels on an InterconnectAttachment. To learn more about labels, read the Labeling Resources documentation. - * - * Sample code: - * ``` - * $interconnectAttachmentsClient = new InterconnectAttachmentsClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $regionSetLabelsRequestResource = new RegionSetLabelsRequest(); - * $resource = 'resource'; - * $operationResponse = $interconnectAttachmentsClient->setLabels($project, $region, $regionSetLabelsRequestResource, $resource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $interconnectAttachmentsClient->setLabels($project, $region, $regionSetLabelsRequestResource, $resource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $interconnectAttachmentsClient->resumeOperation($operationName, 'setLabels'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $interconnectAttachmentsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region The region for this request. - * @param RegionSetLabelsRequest $regionSetLabelsRequestResource The body resource for this request - * @param string $resource Name or id of the resource for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 setLabels($project, $region, $regionSetLabelsRequestResource, $resource, array $optionalArgs = []) - { - $request = new SetLabelsInterconnectAttachmentRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setRegionSetLabelsRequestResource($regionSetLabelsRequestResource); - $request->setResource($resource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['resource'] = $resource; - 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('SetLabels', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/InterconnectGroupsGapicClient.php b/Compute/src/V1/Gapic/InterconnectGroupsGapicClient.php deleted file mode 100644 index eae00f73936d..000000000000 --- a/Compute/src/V1/Gapic/InterconnectGroupsGapicClient.php +++ /dev/null @@ -1,861 +0,0 @@ -createMembers($interconnectGroup, $interconnectGroupsCreateMembersRequestResource, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $interconnectGroupsClient->createMembers($interconnectGroup, $interconnectGroupsCreateMembersRequestResource, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $interconnectGroupsClient->resumeOperation($operationName, 'createMembers'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $interconnectGroupsClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\InterconnectGroupsClient}. - */ -class InterconnectGroupsGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.InterconnectGroups'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/interconnect_groups_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/interconnect_groups_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/interconnect_groups_rest_client_config.php', - ], - ], - 'operationsClientClass' => GlobalOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an GlobalOperationsClient object with the same endpoint as $this. - * - * @return GlobalOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetGlobalOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteGlobalOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method for the - * supported options. - * @type callable $clientCertSource - * A callable which returns the client cert as a string. This can be used to - * provide a certificate and private key to the transport layer for mTLS. - * } - * - * @throws ValidationException - */ - public function __construct(array $options = []) - { - $clientOptions = $this->buildClientOptions($options); - $this->setClientOptions($clientOptions); - $this->operationsClient = $this->createOperationsClient($clientOptions); - } - - /** - * Create Interconnects with redundancy by creating them in a specified interconnect group. - * - * Sample code: - * ``` - * $interconnectGroupsClient = new InterconnectGroupsClient(); - * try { - * $interconnectGroup = 'interconnect_group'; - * $interconnectGroupsCreateMembersRequestResource = new InterconnectGroupsCreateMembersRequest(); - * $project = 'project'; - * $operationResponse = $interconnectGroupsClient->createMembers($interconnectGroup, $interconnectGroupsCreateMembersRequestResource, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $interconnectGroupsClient->createMembers($interconnectGroup, $interconnectGroupsCreateMembersRequestResource, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $interconnectGroupsClient->resumeOperation($operationName, 'createMembers'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $interconnectGroupsClient->close(); - * } - * ``` - * - * @param string $interconnectGroup Name of the group resource to create members for. - * @param InterconnectGroupsCreateMembersRequest $interconnectGroupsCreateMembersRequestResource The body resource for this request - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 createMembers($interconnectGroup, $interconnectGroupsCreateMembersRequestResource, $project, array $optionalArgs = []) - { - $request = new CreateMembersInterconnectGroupRequest(); - $requestParamHeaders = []; - $request->setInterconnectGroup($interconnectGroup); - $request->setInterconnectGroupsCreateMembersRequestResource($interconnectGroupsCreateMembersRequestResource); - $request->setProject($project); - $requestParamHeaders['interconnect_group'] = $interconnectGroup; - $requestParamHeaders['project'] = $project; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('CreateMembers', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Deletes the specified InterconnectGroup in the given scope - * - * Sample code: - * ``` - * $interconnectGroupsClient = new InterconnectGroupsClient(); - * try { - * $interconnectGroup = 'interconnect_group'; - * $project = 'project'; - * $operationResponse = $interconnectGroupsClient->delete($interconnectGroup, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $interconnectGroupsClient->delete($interconnectGroup, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $interconnectGroupsClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $interconnectGroupsClient->close(); - * } - * ``` - * - * @param string $interconnectGroup Name of the InterconnectGroup resource to delete. - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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). end_interface: MixerMutationRequestBuilder - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 delete($interconnectGroup, $project, array $optionalArgs = []) - { - $request = new DeleteInterconnectGroupRequest(); - $requestParamHeaders = []; - $request->setInterconnectGroup($interconnectGroup); - $request->setProject($project); - $requestParamHeaders['interconnect_group'] = $interconnectGroup; - $requestParamHeaders['project'] = $project; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns the specified InterconnectGroup resource in the given scope. - * - * Sample code: - * ``` - * $interconnectGroupsClient = new InterconnectGroupsClient(); - * try { - * $interconnectGroup = 'interconnect_group'; - * $project = 'project'; - * $response = $interconnectGroupsClient->get($interconnectGroup, $project); - * } finally { - * $interconnectGroupsClient->close(); - * } - * ``` - * - * @param string $interconnectGroup Name of the InterconnectGroup resource to return. - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\InterconnectGroup - * - * @throws ApiException if the remote call fails - */ - public function get($interconnectGroup, $project, array $optionalArgs = []) - { - $request = new GetInterconnectGroupRequest(); - $requestParamHeaders = []; - $request->setInterconnectGroup($interconnectGroup); - $request->setProject($project); - $requestParamHeaders['interconnect_group'] = $interconnectGroup; - $requestParamHeaders['project'] = $project; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', InterconnectGroup::class, $optionalArgs, $request)->wait(); - } - - /** - * Gets the access control policy for a resource. May be empty if no such policy or resource exists. - * - * Sample code: - * ``` - * $interconnectGroupsClient = new InterconnectGroupsClient(); - * try { - * $project = 'project'; - * $resource = 'resource'; - * $response = $interconnectGroupsClient->getIamPolicy($project, $resource); - * } finally { - * $interconnectGroupsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $resource Name or id of the resource for this request. - * @param array $optionalArgs { - * Optional. - * - * @type int $optionsRequestedPolicyVersion - * Requested IAM Policy version. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function getIamPolicy($project, $resource, array $optionalArgs = []) - { - $request = new GetIamPolicyInterconnectGroupRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setResource($resource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['optionsRequestedPolicyVersion'])) { - $request->setOptionsRequestedPolicyVersion($optionalArgs['optionsRequestedPolicyVersion']); - } - - $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(); - } - - /** - * Returns the interconnectStatuses for the specified InterconnectGroup. - * - * Sample code: - * ``` - * $interconnectGroupsClient = new InterconnectGroupsClient(); - * try { - * $interconnectGroup = 'interconnect_group'; - * $project = 'project'; - * $response = $interconnectGroupsClient->getOperationalStatus($interconnectGroup, $project); - * } finally { - * $interconnectGroupsClient->close(); - * } - * ``` - * - * @param string $interconnectGroup Name of the interconnectGroup resource to query. - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\InterconnectGroupsGetOperationalStatusResponse - * - * @throws ApiException if the remote call fails - */ - public function getOperationalStatus($interconnectGroup, $project, array $optionalArgs = []) - { - $request = new GetOperationalStatusInterconnectGroupRequest(); - $requestParamHeaders = []; - $request->setInterconnectGroup($interconnectGroup); - $request->setProject($project); - $requestParamHeaders['interconnect_group'] = $interconnectGroup; - $requestParamHeaders['project'] = $project; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetOperationalStatus', InterconnectGroupsGetOperationalStatusResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates a InterconnectGroup in the specified project in the given scope using the parameters that are included in the request. - * - * Sample code: - * ``` - * $interconnectGroupsClient = new InterconnectGroupsClient(); - * try { - * $interconnectGroupResource = new InterconnectGroup(); - * $project = 'project'; - * $operationResponse = $interconnectGroupsClient->insert($interconnectGroupResource, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $interconnectGroupsClient->insert($interconnectGroupResource, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $interconnectGroupsClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $interconnectGroupsClient->close(); - * } - * ``` - * - * @param InterconnectGroup $interconnectGroupResource The body resource for this request - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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). end_interface: MixerMutationRequestBuilder - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 insert($interconnectGroupResource, $project, array $optionalArgs = []) - { - $request = new InsertInterconnectGroupRequest(); - $requestParamHeaders = []; - $request->setInterconnectGroupResource($interconnectGroupResource); - $request->setProject($project); - $requestParamHeaders['project'] = $project; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Lists the InterconnectGroups for a project in the given scope. - * - * Sample code: - * ``` - * $interconnectGroupsClient = new InterconnectGroupsClient(); - * try { - * $project = 'project'; - * $response = $interconnectGroupsClient->list($project); - * } finally { - * $interconnectGroupsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @type string $pageToken - * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. - * @type bool $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\InterconnectGroupsListResponse - * - * @throws ApiException if the remote call fails - */ - public function list($project, array $optionalArgs = []) - { - $request = new ListInterconnectGroupsRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('List', InterconnectGroupsListResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Patches the specified InterconnectGroup resource with the data included in the request. This method supports PATCH semantics and uses JSON merge patch format and processing rules. - * - * Sample code: - * ``` - * $interconnectGroupsClient = new InterconnectGroupsClient(); - * try { - * $interconnectGroup = 'interconnect_group'; - * $interconnectGroupResource = new InterconnectGroup(); - * $project = 'project'; - * $operationResponse = $interconnectGroupsClient->patch($interconnectGroup, $interconnectGroupResource, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $interconnectGroupsClient->patch($interconnectGroup, $interconnectGroupResource, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $interconnectGroupsClient->resumeOperation($operationName, 'patch'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $interconnectGroupsClient->close(); - * } - * ``` - * - * @param string $interconnectGroup Name of the InterconnectGroup resource to patch. - * @param InterconnectGroup $interconnectGroupResource The body resource for this request - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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). end_interface: MixerMutationRequestBuilder - * @type string $updateMask - * The list of fields to update. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 patch($interconnectGroup, $interconnectGroupResource, $project, array $optionalArgs = []) - { - $request = new PatchInterconnectGroupRequest(); - $requestParamHeaders = []; - $request->setInterconnectGroup($interconnectGroup); - $request->setInterconnectGroupResource($interconnectGroupResource); - $request->setProject($project); - $requestParamHeaders['interconnect_group'] = $interconnectGroup; - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('Patch', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Sets the access control policy on the specified resource. Replaces any existing policy. - * - * Sample code: - * ``` - * $interconnectGroupsClient = new InterconnectGroupsClient(); - * try { - * $globalSetPolicyRequestResource = new GlobalSetPolicyRequest(); - * $project = 'project'; - * $resource = 'resource'; - * $response = $interconnectGroupsClient->setIamPolicy($globalSetPolicyRequestResource, $project, $resource); - * } finally { - * $interconnectGroupsClient->close(); - * } - * ``` - * - * @param GlobalSetPolicyRequest $globalSetPolicyRequestResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $resource Name or id of the resource for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function setIamPolicy($globalSetPolicyRequestResource, $project, $resource, array $optionalArgs = []) - { - $request = new SetIamPolicyInterconnectGroupRequest(); - $requestParamHeaders = []; - $request->setGlobalSetPolicyRequestResource($globalSetPolicyRequestResource); - $request->setProject($project); - $request->setResource($resource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['resource'] = $resource; - $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 resource. - * - * Sample code: - * ``` - * $interconnectGroupsClient = new InterconnectGroupsClient(); - * try { - * $project = 'project'; - * $resource = 'resource'; - * $testPermissionsRequestResource = new TestPermissionsRequest(); - * $response = $interconnectGroupsClient->testIamPermissions($project, $resource, $testPermissionsRequestResource); - * } finally { - * $interconnectGroupsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $resource Name or id of the resource for this request. - * @param TestPermissionsRequest $testPermissionsRequestResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\TestPermissionsResponse - * - * @throws ApiException if the remote call fails - */ - public function testIamPermissions($project, $resource, $testPermissionsRequestResource, array $optionalArgs = []) - { - $request = new TestIamPermissionsInterconnectGroupRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setResource($resource); - $request->setTestPermissionsRequestResource($testPermissionsRequestResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['resource'] = $resource; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('TestIamPermissions', TestPermissionsResponse::class, $optionalArgs, $request)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/InterconnectLocationsGapicClient.php b/Compute/src/V1/Gapic/InterconnectLocationsGapicClient.php deleted file mode 100644 index e13d62c3a628..000000000000 --- a/Compute/src/V1/Gapic/InterconnectLocationsGapicClient.php +++ /dev/null @@ -1,305 +0,0 @@ -get($interconnectLocation, $project); - * } finally { - * $interconnectLocationsClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\InterconnectLocationsClient}. - */ -class InterconnectLocationsGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.InterconnectLocations'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute.readonly', - 'https://www.googleapis.com/auth/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/interconnect_locations_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/interconnect_locations_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/interconnect_locations_rest_client_config.php', - ], - ], - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * 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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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); - } - - /** - * Returns the details for the specified interconnect location. Gets a list of available interconnect locations by making a list() request. - * - * Sample code: - * ``` - * $interconnectLocationsClient = new InterconnectLocationsClient(); - * try { - * $interconnectLocation = 'interconnect_location'; - * $project = 'project'; - * $response = $interconnectLocationsClient->get($interconnectLocation, $project); - * } finally { - * $interconnectLocationsClient->close(); - * } - * ``` - * - * @param string $interconnectLocation Name of the interconnect location to return. - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\InterconnectLocation - * - * @throws ApiException if the remote call fails - */ - public function get($interconnectLocation, $project, array $optionalArgs = []) - { - $request = new GetInterconnectLocationRequest(); - $requestParamHeaders = []; - $request->setInterconnectLocation($interconnectLocation); - $request->setProject($project); - $requestParamHeaders['interconnect_location'] = $interconnectLocation; - $requestParamHeaders['project'] = $project; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', InterconnectLocation::class, $optionalArgs, $request)->wait(); - } - - /** - * Retrieves the list of interconnect locations available to the specified project. - * - * Sample code: - * ``` - * $interconnectLocationsClient = new InterconnectLocationsClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $interconnectLocationsClient->list($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $interconnectLocationsClient->list($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $interconnectLocationsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, array $optionalArgs = []) - { - $request = new ListInterconnectLocationsRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, InterconnectLocationList::class, $request); - } -} diff --git a/Compute/src/V1/Gapic/InterconnectRemoteLocationsGapicClient.php b/Compute/src/V1/Gapic/InterconnectRemoteLocationsGapicClient.php deleted file mode 100644 index e3b8c122e227..000000000000 --- a/Compute/src/V1/Gapic/InterconnectRemoteLocationsGapicClient.php +++ /dev/null @@ -1,305 +0,0 @@ -get($interconnectRemoteLocation, $project); - * } finally { - * $interconnectRemoteLocationsClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\InterconnectRemoteLocationsClient}. - */ -class InterconnectRemoteLocationsGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.InterconnectRemoteLocations'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute.readonly', - 'https://www.googleapis.com/auth/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/interconnect_remote_locations_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/interconnect_remote_locations_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/interconnect_remote_locations_rest_client_config.php', - ], - ], - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * 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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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); - } - - /** - * Returns the details for the specified interconnect remote location. Gets a list of available interconnect remote locations by making a list() request. - * - * Sample code: - * ``` - * $interconnectRemoteLocationsClient = new InterconnectRemoteLocationsClient(); - * try { - * $interconnectRemoteLocation = 'interconnect_remote_location'; - * $project = 'project'; - * $response = $interconnectRemoteLocationsClient->get($interconnectRemoteLocation, $project); - * } finally { - * $interconnectRemoteLocationsClient->close(); - * } - * ``` - * - * @param string $interconnectRemoteLocation Name of the interconnect remote location to return. - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\InterconnectRemoteLocation - * - * @throws ApiException if the remote call fails - */ - public function get($interconnectRemoteLocation, $project, array $optionalArgs = []) - { - $request = new GetInterconnectRemoteLocationRequest(); - $requestParamHeaders = []; - $request->setInterconnectRemoteLocation($interconnectRemoteLocation); - $request->setProject($project); - $requestParamHeaders['interconnect_remote_location'] = $interconnectRemoteLocation; - $requestParamHeaders['project'] = $project; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', InterconnectRemoteLocation::class, $optionalArgs, $request)->wait(); - } - - /** - * Retrieves the list of interconnect remote locations available to the specified project. - * - * Sample code: - * ``` - * $interconnectRemoteLocationsClient = new InterconnectRemoteLocationsClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $interconnectRemoteLocationsClient->list($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $interconnectRemoteLocationsClient->list($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $interconnectRemoteLocationsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, array $optionalArgs = []) - { - $request = new ListInterconnectRemoteLocationsRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, InterconnectRemoteLocationList::class, $request); - } -} diff --git a/Compute/src/V1/Gapic/InterconnectsGapicClient.php b/Compute/src/V1/Gapic/InterconnectsGapicClient.php deleted file mode 100644 index 6f08a9710cea..000000000000 --- a/Compute/src/V1/Gapic/InterconnectsGapicClient.php +++ /dev/null @@ -1,766 +0,0 @@ -delete($interconnect, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $interconnectsClient->delete($interconnect, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $interconnectsClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $interconnectsClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\InterconnectsClient}. - */ -class InterconnectsGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.Interconnects'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/interconnects_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/interconnects_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/interconnects_rest_client_config.php', - ], - ], - 'operationsClientClass' => GlobalOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an GlobalOperationsClient object with the same endpoint as $this. - * - * @return GlobalOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetGlobalOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteGlobalOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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 the specified Interconnect. - * - * Sample code: - * ``` - * $interconnectsClient = new InterconnectsClient(); - * try { - * $interconnect = 'interconnect'; - * $project = 'project'; - * $operationResponse = $interconnectsClient->delete($interconnect, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $interconnectsClient->delete($interconnect, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $interconnectsClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $interconnectsClient->close(); - * } - * ``` - * - * @param string $interconnect Name of the interconnect to delete. - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($interconnect, $project, array $optionalArgs = []) - { - $request = new DeleteInterconnectRequest(); - $requestParamHeaders = []; - $request->setInterconnect($interconnect); - $request->setProject($project); - $requestParamHeaders['interconnect'] = $interconnect; - $requestParamHeaders['project'] = $project; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns the specified Interconnect. Get a list of available Interconnects by making a list() request. - * - * Sample code: - * ``` - * $interconnectsClient = new InterconnectsClient(); - * try { - * $interconnect = 'interconnect'; - * $project = 'project'; - * $response = $interconnectsClient->get($interconnect, $project); - * } finally { - * $interconnectsClient->close(); - * } - * ``` - * - * @param string $interconnect Name of the interconnect to return. - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Interconnect - * - * @throws ApiException if the remote call fails - */ - public function get($interconnect, $project, array $optionalArgs = []) - { - $request = new GetInterconnectRequest(); - $requestParamHeaders = []; - $request->setInterconnect($interconnect); - $request->setProject($project); - $requestParamHeaders['interconnect'] = $interconnect; - $requestParamHeaders['project'] = $project; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', Interconnect::class, $optionalArgs, $request)->wait(); - } - - /** - * Returns the interconnectDiagnostics for the specified Interconnect. In the event of a global outage, do not use this API to make decisions about where to redirect your network traffic. Unlike a VLAN attachment, which is regional, a Cloud Interconnect connection is a global resource. A global outage can prevent this API from functioning properly. - * - * Sample code: - * ``` - * $interconnectsClient = new InterconnectsClient(); - * try { - * $interconnect = 'interconnect'; - * $project = 'project'; - * $response = $interconnectsClient->getDiagnostics($interconnect, $project); - * } finally { - * $interconnectsClient->close(); - * } - * ``` - * - * @param string $interconnect Name of the interconnect resource to query. - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\InterconnectsGetDiagnosticsResponse - * - * @throws ApiException if the remote call fails - */ - public function getDiagnostics($interconnect, $project, array $optionalArgs = []) - { - $request = new GetDiagnosticsInterconnectRequest(); - $requestParamHeaders = []; - $request->setInterconnect($interconnect); - $request->setProject($project); - $requestParamHeaders['interconnect'] = $interconnect; - $requestParamHeaders['project'] = $project; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetDiagnostics', InterconnectsGetDiagnosticsResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Returns the interconnectMacsecConfig for the specified Interconnect. - * - * Sample code: - * ``` - * $interconnectsClient = new InterconnectsClient(); - * try { - * $interconnect = 'interconnect'; - * $project = 'project'; - * $response = $interconnectsClient->getMacsecConfig($interconnect, $project); - * } finally { - * $interconnectsClient->close(); - * } - * ``` - * - * @param string $interconnect Name of the interconnect resource to query. - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\InterconnectsGetMacsecConfigResponse - * - * @throws ApiException if the remote call fails - */ - public function getMacsecConfig($interconnect, $project, array $optionalArgs = []) - { - $request = new GetMacsecConfigInterconnectRequest(); - $requestParamHeaders = []; - $request->setInterconnect($interconnect); - $request->setProject($project); - $requestParamHeaders['interconnect'] = $interconnect; - $requestParamHeaders['project'] = $project; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetMacsecConfig', InterconnectsGetMacsecConfigResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates an Interconnect in the specified project using the data included in the request. - * - * Sample code: - * ``` - * $interconnectsClient = new InterconnectsClient(); - * try { - * $interconnectResource = new Interconnect(); - * $project = 'project'; - * $operationResponse = $interconnectsClient->insert($interconnectResource, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $interconnectsClient->insert($interconnectResource, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $interconnectsClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $interconnectsClient->close(); - * } - * ``` - * - * @param Interconnect $interconnectResource The body resource for this request - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 insert($interconnectResource, $project, array $optionalArgs = []) - { - $request = new InsertInterconnectRequest(); - $requestParamHeaders = []; - $request->setInterconnectResource($interconnectResource); - $request->setProject($project); - $requestParamHeaders['project'] = $project; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Retrieves the list of Interconnects available to the specified project. - * - * Sample code: - * ``` - * $interconnectsClient = new InterconnectsClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $interconnectsClient->list($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $interconnectsClient->list($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $interconnectsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, array $optionalArgs = []) - { - $request = new ListInterconnectsRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, InterconnectList::class, $request); - } - - /** - * Updates the specified Interconnect with the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. - * - * Sample code: - * ``` - * $interconnectsClient = new InterconnectsClient(); - * try { - * $interconnect = 'interconnect'; - * $interconnectResource = new Interconnect(); - * $project = 'project'; - * $operationResponse = $interconnectsClient->patch($interconnect, $interconnectResource, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $interconnectsClient->patch($interconnect, $interconnectResource, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $interconnectsClient->resumeOperation($operationName, 'patch'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $interconnectsClient->close(); - * } - * ``` - * - * @param string $interconnect Name of the interconnect to update. - * @param Interconnect $interconnectResource The body resource for this request - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 patch($interconnect, $interconnectResource, $project, array $optionalArgs = []) - { - $request = new PatchInterconnectRequest(); - $requestParamHeaders = []; - $request->setInterconnect($interconnect); - $request->setInterconnectResource($interconnectResource); - $request->setProject($project); - $requestParamHeaders['interconnect'] = $interconnect; - $requestParamHeaders['project'] = $project; - 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('Patch', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Sets the labels on an Interconnect. To learn more about labels, read the Labeling Resources documentation. - * - * Sample code: - * ``` - * $interconnectsClient = new InterconnectsClient(); - * try { - * $globalSetLabelsRequestResource = new GlobalSetLabelsRequest(); - * $project = 'project'; - * $resource = 'resource'; - * $operationResponse = $interconnectsClient->setLabels($globalSetLabelsRequestResource, $project, $resource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $interconnectsClient->setLabels($globalSetLabelsRequestResource, $project, $resource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $interconnectsClient->resumeOperation($operationName, 'setLabels'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $interconnectsClient->close(); - * } - * ``` - * - * @param GlobalSetLabelsRequest $globalSetLabelsRequestResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $resource Name or id of the resource for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 setLabels($globalSetLabelsRequestResource, $project, $resource, array $optionalArgs = []) - { - $request = new SetLabelsInterconnectRequest(); - $requestParamHeaders = []; - $request->setGlobalSetLabelsRequestResource($globalSetLabelsRequestResource); - $request->setProject($project); - $request->setResource($resource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['resource'] = $resource; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('SetLabels', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/LicenseCodesGapicClient.php b/Compute/src/V1/Gapic/LicenseCodesGapicClient.php deleted file mode 100644 index 583ca3e24c3d..000000000000 --- a/Compute/src/V1/Gapic/LicenseCodesGapicClient.php +++ /dev/null @@ -1,268 +0,0 @@ -get($licenseCode, $project); - * } finally { - * $licenseCodesClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\LicenseCodesClient}. - */ -class LicenseCodesGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.LicenseCodes'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute.readonly', - 'https://www.googleapis.com/auth/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/license_codes_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/license_codes_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/license_codes_rest_client_config.php', - ], - ], - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * 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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method for the - * supported options. - * @type callable $clientCertSource - * A callable which returns the client cert as a string. This can be used to - * provide a certificate and private key to the transport layer for mTLS. - * } - * - * @throws ValidationException - */ - public function __construct(array $options = []) - { - $clientOptions = $this->buildClientOptions($options); - $this->setClientOptions($clientOptions); - } - - /** - * Return a specified license code. License codes are mirrored across all projects that have permissions to read the License Code. *Caution* This resource is intended for use only by third-party partners who are creating Cloud Marketplace images. - * - * Sample code: - * ``` - * $licenseCodesClient = new LicenseCodesClient(); - * try { - * $licenseCode = 'license_code'; - * $project = 'project'; - * $response = $licenseCodesClient->get($licenseCode, $project); - * } finally { - * $licenseCodesClient->close(); - * } - * ``` - * - * @param string $licenseCode Number corresponding to the License code resource to return. - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\LicenseCode - * - * @throws ApiException if the remote call fails - */ - public function get($licenseCode, $project, array $optionalArgs = []) - { - $request = new GetLicenseCodeRequest(); - $requestParamHeaders = []; - $request->setLicenseCode($licenseCode); - $request->setProject($project); - $requestParamHeaders['license_code'] = $licenseCode; - $requestParamHeaders['project'] = $project; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', LicenseCode::class, $optionalArgs, $request)->wait(); - } - - /** - * Returns permissions that a caller has on the specified resource. *Caution* This resource is intended for use only by third-party partners who are creating Cloud Marketplace images. - * - * Sample code: - * ``` - * $licenseCodesClient = new LicenseCodesClient(); - * try { - * $project = 'project'; - * $resource = 'resource'; - * $testPermissionsRequestResource = new TestPermissionsRequest(); - * $response = $licenseCodesClient->testIamPermissions($project, $resource, $testPermissionsRequestResource); - * } finally { - * $licenseCodesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $resource Name or id of the resource for this request. - * @param TestPermissionsRequest $testPermissionsRequestResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\TestPermissionsResponse - * - * @throws ApiException if the remote call fails - */ - public function testIamPermissions($project, $resource, $testPermissionsRequestResource, array $optionalArgs = []) - { - $request = new TestIamPermissionsLicenseCodeRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setResource($resource); - $request->setTestPermissionsRequestResource($testPermissionsRequestResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['resource'] = $resource; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('TestIamPermissions', TestPermissionsResponse::class, $optionalArgs, $request)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/LicensesGapicClient.php b/Compute/src/V1/Gapic/LicensesGapicClient.php deleted file mode 100644 index 5eb1762615c8..000000000000 --- a/Compute/src/V1/Gapic/LicensesGapicClient.php +++ /dev/null @@ -1,759 +0,0 @@ -delete($license, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $licensesClient->delete($license, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $licensesClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $licensesClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\LicensesClient}. - */ -class LicensesGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.Licenses'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/licenses_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/licenses_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/licenses_rest_client_config.php', - ], - ], - 'operationsClientClass' => GlobalOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an GlobalOperationsClient object with the same endpoint as $this. - * - * @return GlobalOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetGlobalOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteGlobalOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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 the specified license. *Caution* This resource is intended for use only by third-party partners who are creating Cloud Marketplace images. - * - * Sample code: - * ``` - * $licensesClient = new LicensesClient(); - * try { - * $license = 'license'; - * $project = 'project'; - * $operationResponse = $licensesClient->delete($license, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $licensesClient->delete($license, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $licensesClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $licensesClient->close(); - * } - * ``` - * - * @param string $license Name of the license resource to delete. - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($license, $project, array $optionalArgs = []) - { - $request = new DeleteLicenseRequest(); - $requestParamHeaders = []; - $request->setLicense($license); - $request->setProject($project); - $requestParamHeaders['license'] = $license; - $requestParamHeaders['project'] = $project; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns the specified License resource. *Caution* This resource is intended for use only by third-party partners who are creating Cloud Marketplace images. - * - * Sample code: - * ``` - * $licensesClient = new LicensesClient(); - * try { - * $license = 'license'; - * $project = 'project'; - * $response = $licensesClient->get($license, $project); - * } finally { - * $licensesClient->close(); - * } - * ``` - * - * @param string $license Name of the License resource to return. - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\License - * - * @throws ApiException if the remote call fails - */ - public function get($license, $project, array $optionalArgs = []) - { - $request = new GetLicenseRequest(); - $requestParamHeaders = []; - $request->setLicense($license); - $request->setProject($project); - $requestParamHeaders['license'] = $license; - $requestParamHeaders['project'] = $project; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', License::class, $optionalArgs, $request)->wait(); - } - - /** - * Gets the access control policy for a resource. May be empty if no such policy or resource exists. *Caution* This resource is intended for use only by third-party partners who are creating Cloud Marketplace images. - * - * Sample code: - * ``` - * $licensesClient = new LicensesClient(); - * try { - * $project = 'project'; - * $resource = 'resource'; - * $response = $licensesClient->getIamPolicy($project, $resource); - * } finally { - * $licensesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $resource Name or id of the resource for this request. - * @param array $optionalArgs { - * Optional. - * - * @type int $optionsRequestedPolicyVersion - * Requested IAM Policy version. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function getIamPolicy($project, $resource, array $optionalArgs = []) - { - $request = new GetIamPolicyLicenseRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setResource($resource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['optionsRequestedPolicyVersion'])) { - $request->setOptionsRequestedPolicyVersion($optionalArgs['optionsRequestedPolicyVersion']); - } - - $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(); - } - - /** - * Create a License resource in the specified project. *Caution* This resource is intended for use only by third-party partners who are creating Cloud Marketplace images. - * - * Sample code: - * ``` - * $licensesClient = new LicensesClient(); - * try { - * $licenseResource = new License(); - * $project = 'project'; - * $operationResponse = $licensesClient->insert($licenseResource, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $licensesClient->insert($licenseResource, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $licensesClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $licensesClient->close(); - * } - * ``` - * - * @param License $licenseResource The body resource for this request - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 insert($licenseResource, $project, array $optionalArgs = []) - { - $request = new InsertLicenseRequest(); - $requestParamHeaders = []; - $request->setLicenseResource($licenseResource); - $request->setProject($project); - $requestParamHeaders['project'] = $project; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Retrieves the list of licenses available in the specified project. This method does not get any licenses that belong to other projects, including licenses attached to publicly-available images, like Debian 9. If you want to get a list of publicly-available licenses, use this method to make a request to the respective image project, such as debian-cloud or windows-cloud. *Caution* This resource is intended for use only by third-party partners who are creating Cloud Marketplace images. - * - * Sample code: - * ``` - * $licensesClient = new LicensesClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $licensesClient->list($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $licensesClient->list($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $licensesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, array $optionalArgs = []) - { - $request = new ListLicensesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, LicensesListResponse::class, $request); - } - - /** - * Sets the access control policy on the specified resource. Replaces any existing policy. *Caution* This resource is intended for use only by third-party partners who are creating Cloud Marketplace images. - * - * Sample code: - * ``` - * $licensesClient = new LicensesClient(); - * try { - * $globalSetPolicyRequestResource = new GlobalSetPolicyRequest(); - * $project = 'project'; - * $resource = 'resource'; - * $response = $licensesClient->setIamPolicy($globalSetPolicyRequestResource, $project, $resource); - * } finally { - * $licensesClient->close(); - * } - * ``` - * - * @param GlobalSetPolicyRequest $globalSetPolicyRequestResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $resource Name or id of the resource for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function setIamPolicy($globalSetPolicyRequestResource, $project, $resource, array $optionalArgs = []) - { - $request = new SetIamPolicyLicenseRequest(); - $requestParamHeaders = []; - $request->setGlobalSetPolicyRequestResource($globalSetPolicyRequestResource); - $request->setProject($project); - $request->setResource($resource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['resource'] = $resource; - $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 resource. *Caution* This resource is intended for use only by third-party partners who are creating Cloud Marketplace images. - * - * Sample code: - * ``` - * $licensesClient = new LicensesClient(); - * try { - * $project = 'project'; - * $resource = 'resource'; - * $testPermissionsRequestResource = new TestPermissionsRequest(); - * $response = $licensesClient->testIamPermissions($project, $resource, $testPermissionsRequestResource); - * } finally { - * $licensesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $resource Name or id of the resource for this request. - * @param TestPermissionsRequest $testPermissionsRequestResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\TestPermissionsResponse - * - * @throws ApiException if the remote call fails - */ - public function testIamPermissions($project, $resource, $testPermissionsRequestResource, array $optionalArgs = []) - { - $request = new TestIamPermissionsLicenseRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setResource($resource); - $request->setTestPermissionsRequestResource($testPermissionsRequestResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['resource'] = $resource; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('TestIamPermissions', TestPermissionsResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Updates a License resource in the specified project. *Caution* This resource is intended for use only by third-party partners who are creating Cloud Marketplace images. - * - * Sample code: - * ``` - * $licensesClient = new LicensesClient(); - * try { - * $license = 'license'; - * $licenseResource = new License(); - * $project = 'project'; - * $operationResponse = $licensesClient->update($license, $licenseResource, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $licensesClient->update($license, $licenseResource, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $licensesClient->resumeOperation($operationName, 'update'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $licensesClient->close(); - * } - * ``` - * - * @param string $license The license name for this request. - * @param License $licenseResource The body resource for this request - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 $updateMask - * update_mask indicates fields to be updated as part of this request. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 update($license, $licenseResource, $project, array $optionalArgs = []) - { - $request = new UpdateLicenseRequest(); - $requestParamHeaders = []; - $request->setLicense($license); - $request->setLicenseResource($licenseResource); - $request->setProject($project); - $requestParamHeaders['license'] = $license; - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('Update', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/MachineImagesGapicClient.php b/Compute/src/V1/Gapic/MachineImagesGapicClient.php deleted file mode 100644 index afcede753bcc..000000000000 --- a/Compute/src/V1/Gapic/MachineImagesGapicClient.php +++ /dev/null @@ -1,754 +0,0 @@ -delete($machineImage, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $machineImagesClient->delete($machineImage, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $machineImagesClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $machineImagesClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\MachineImagesClient}. - */ -class MachineImagesGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.MachineImages'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/machine_images_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/machine_images_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/machine_images_rest_client_config.php', - ], - ], - 'operationsClientClass' => GlobalOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an GlobalOperationsClient object with the same endpoint as $this. - * - * @return GlobalOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetGlobalOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteGlobalOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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 the specified machine image. Deleting a machine image is permanent and cannot be undone. - * - * Sample code: - * ``` - * $machineImagesClient = new MachineImagesClient(); - * try { - * $machineImage = 'machine_image'; - * $project = 'project'; - * $operationResponse = $machineImagesClient->delete($machineImage, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $machineImagesClient->delete($machineImage, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $machineImagesClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $machineImagesClient->close(); - * } - * ``` - * - * @param string $machineImage The name of the machine image to delete. - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($machineImage, $project, array $optionalArgs = []) - { - $request = new DeleteMachineImageRequest(); - $requestParamHeaders = []; - $request->setMachineImage($machineImage); - $request->setProject($project); - $requestParamHeaders['machine_image'] = $machineImage; - $requestParamHeaders['project'] = $project; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns the specified machine image. - * - * Sample code: - * ``` - * $machineImagesClient = new MachineImagesClient(); - * try { - * $machineImage = 'machine_image'; - * $project = 'project'; - * $response = $machineImagesClient->get($machineImage, $project); - * } finally { - * $machineImagesClient->close(); - * } - * ``` - * - * @param string $machineImage The name of the machine image. - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\MachineImage - * - * @throws ApiException if the remote call fails - */ - public function get($machineImage, $project, array $optionalArgs = []) - { - $request = new GetMachineImageRequest(); - $requestParamHeaders = []; - $request->setMachineImage($machineImage); - $request->setProject($project); - $requestParamHeaders['machine_image'] = $machineImage; - $requestParamHeaders['project'] = $project; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', MachineImage::class, $optionalArgs, $request)->wait(); - } - - /** - * Gets the access control policy for a resource. May be empty if no such policy or resource exists. - * - * Sample code: - * ``` - * $machineImagesClient = new MachineImagesClient(); - * try { - * $project = 'project'; - * $resource = 'resource'; - * $response = $machineImagesClient->getIamPolicy($project, $resource); - * } finally { - * $machineImagesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $resource Name or id of the resource for this request. - * @param array $optionalArgs { - * Optional. - * - * @type int $optionsRequestedPolicyVersion - * Requested IAM Policy version. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function getIamPolicy($project, $resource, array $optionalArgs = []) - { - $request = new GetIamPolicyMachineImageRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setResource($resource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['optionsRequestedPolicyVersion'])) { - $request->setOptionsRequestedPolicyVersion($optionalArgs['optionsRequestedPolicyVersion']); - } - - $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(); - } - - /** - * Creates a machine image in the specified project using the data that is included in the request. If you are creating a new machine image to update an existing instance, your new machine image should use the same network or, if applicable, the same subnetwork as the original instance. - * - * Sample code: - * ``` - * $machineImagesClient = new MachineImagesClient(); - * try { - * $machineImageResource = new MachineImage(); - * $project = 'project'; - * $operationResponse = $machineImagesClient->insert($machineImageResource, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $machineImagesClient->insert($machineImageResource, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $machineImagesClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $machineImagesClient->close(); - * } - * ``` - * - * @param MachineImage $machineImageResource The body resource for this request - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 $sourceInstance - * Required. Source instance that is used to create the machine image from. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 insert($machineImageResource, $project, array $optionalArgs = []) - { - $request = new InsertMachineImageRequest(); - $requestParamHeaders = []; - $request->setMachineImageResource($machineImageResource); - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - if (isset($optionalArgs['sourceInstance'])) { - $request->setSourceInstance($optionalArgs['sourceInstance']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Retrieves a list of machine images that are contained within the specified project. - * - * Sample code: - * ``` - * $machineImagesClient = new MachineImagesClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $machineImagesClient->list($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $machineImagesClient->list($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $machineImagesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, array $optionalArgs = []) - { - $request = new ListMachineImagesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, MachineImageList::class, $request); - } - - /** - * Sets the access control policy on the specified resource. Replaces any existing policy. - * - * Sample code: - * ``` - * $machineImagesClient = new MachineImagesClient(); - * try { - * $globalSetPolicyRequestResource = new GlobalSetPolicyRequest(); - * $project = 'project'; - * $resource = 'resource'; - * $response = $machineImagesClient->setIamPolicy($globalSetPolicyRequestResource, $project, $resource); - * } finally { - * $machineImagesClient->close(); - * } - * ``` - * - * @param GlobalSetPolicyRequest $globalSetPolicyRequestResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $resource Name or id of the resource for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function setIamPolicy($globalSetPolicyRequestResource, $project, $resource, array $optionalArgs = []) - { - $request = new SetIamPolicyMachineImageRequest(); - $requestParamHeaders = []; - $request->setGlobalSetPolicyRequestResource($globalSetPolicyRequestResource); - $request->setProject($project); - $request->setResource($resource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['resource'] = $resource; - $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(); - } - - /** - * Sets the labels on a machine image. To learn more about labels, read the Labeling Resources documentation. - * - * Sample code: - * ``` - * $machineImagesClient = new MachineImagesClient(); - * try { - * $globalSetLabelsRequestResource = new GlobalSetLabelsRequest(); - * $project = 'project'; - * $resource = 'resource'; - * $operationResponse = $machineImagesClient->setLabels($globalSetLabelsRequestResource, $project, $resource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $machineImagesClient->setLabels($globalSetLabelsRequestResource, $project, $resource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $machineImagesClient->resumeOperation($operationName, 'setLabels'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $machineImagesClient->close(); - * } - * ``` - * - * @param GlobalSetLabelsRequest $globalSetLabelsRequestResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $resource Name or id of the resource for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 setLabels($globalSetLabelsRequestResource, $project, $resource, array $optionalArgs = []) - { - $request = new SetLabelsMachineImageRequest(); - $requestParamHeaders = []; - $request->setGlobalSetLabelsRequestResource($globalSetLabelsRequestResource); - $request->setProject($project); - $request->setResource($resource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['resource'] = $resource; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('SetLabels', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns permissions that a caller has on the specified resource. - * - * Sample code: - * ``` - * $machineImagesClient = new MachineImagesClient(); - * try { - * $project = 'project'; - * $resource = 'resource'; - * $testPermissionsRequestResource = new TestPermissionsRequest(); - * $response = $machineImagesClient->testIamPermissions($project, $resource, $testPermissionsRequestResource); - * } finally { - * $machineImagesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $resource Name or id of the resource for this request. - * @param TestPermissionsRequest $testPermissionsRequestResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\TestPermissionsResponse - * - * @throws ApiException if the remote call fails - */ - public function testIamPermissions($project, $resource, $testPermissionsRequestResource, array $optionalArgs = []) - { - $request = new TestIamPermissionsMachineImageRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setResource($resource); - $request->setTestPermissionsRequestResource($testPermissionsRequestResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['resource'] = $resource; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('TestIamPermissions', TestPermissionsResponse::class, $optionalArgs, $request)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/MachineTypesGapicClient.php b/Compute/src/V1/Gapic/MachineTypesGapicClient.php deleted file mode 100644 index 4dd5abfcca54..000000000000 --- a/Compute/src/V1/Gapic/MachineTypesGapicClient.php +++ /dev/null @@ -1,422 +0,0 @@ -aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $machineTypesClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $machineTypesClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\MachineTypesClient}. - */ -class MachineTypesGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.MachineTypes'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute.readonly', - 'https://www.googleapis.com/auth/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/machine_types_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/machine_types_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/machine_types_rest_client_config.php', - ], - ], - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * 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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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); - } - - /** - * Retrieves an aggregated list of machine types. To prevent failure, Google recommends that you set the `returnPartialSuccess` parameter to `true`. - * - * Sample code: - * ``` - * $machineTypesClient = new MachineTypesClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $machineTypesClient->aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $machineTypesClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $machineTypesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type bool $includeAllScopes - * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type int $serviceProjectNumber - * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable 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 aggregatedList($project, array $optionalArgs = []) - { - $request = new AggregatedListMachineTypesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['includeAllScopes'])) { - $request->setIncludeAllScopes($optionalArgs['includeAllScopes']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - if (isset($optionalArgs['serviceProjectNumber'])) { - $request->setServiceProjectNumber($optionalArgs['serviceProjectNumber']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('AggregatedList', $optionalArgs, MachineTypeAggregatedList::class, $request); - } - - /** - * Returns the specified machine type. - * - * Sample code: - * ``` - * $machineTypesClient = new MachineTypesClient(); - * try { - * $machineType = 'machine_type'; - * $project = 'project'; - * $zone = 'zone'; - * $response = $machineTypesClient->get($machineType, $project, $zone); - * } finally { - * $machineTypesClient->close(); - * } - * ``` - * - * @param string $machineType Name of the machine type to return. - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\MachineType - * - * @throws ApiException if the remote call fails - */ - public function get($machineType, $project, $zone, array $optionalArgs = []) - { - $request = new GetMachineTypeRequest(); - $requestParamHeaders = []; - $request->setMachineType($machineType); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['machine_type'] = $machineType; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', MachineType::class, $optionalArgs, $request)->wait(); - } - - /** - * Retrieves a list of machine types available to the specified project. - * - * Sample code: - * ``` - * $machineTypesClient = new MachineTypesClient(); - * try { - * $project = 'project'; - * $zone = 'zone'; - * // Iterate over pages of elements - * $pagedResponse = $machineTypesClient->list($project, $zone); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $machineTypesClient->list($project, $zone); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $machineTypesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, $zone, array $optionalArgs = []) - { - $request = new ListMachineTypesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, MachineTypeList::class, $request); - } -} diff --git a/Compute/src/V1/Gapic/NetworkAttachmentsGapicClient.php b/Compute/src/V1/Gapic/NetworkAttachmentsGapicClient.php deleted file mode 100644 index 5c358d33206d..000000000000 --- a/Compute/src/V1/Gapic/NetworkAttachmentsGapicClient.php +++ /dev/null @@ -1,872 +0,0 @@ -aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $networkAttachmentsClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $networkAttachmentsClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\NetworkAttachmentsClient}. - */ -class NetworkAttachmentsGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.NetworkAttachments'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/network_attachments_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/network_attachments_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/network_attachments_rest_client_config.php', - ], - ], - 'operationsClientClass' => RegionOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an RegionOperationsClient object with the same endpoint as $this. - * - * @return RegionOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetRegionOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteRegionOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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); - } - - /** - * Retrieves the list of all NetworkAttachment resources, regional and global, available to the specified project. To prevent failure, Google recommends that you set the `returnPartialSuccess` parameter to `true`. - * - * Sample code: - * ``` - * $networkAttachmentsClient = new NetworkAttachmentsClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $networkAttachmentsClient->aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $networkAttachmentsClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $networkAttachmentsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type bool $includeAllScopes - * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type int $serviceProjectNumber - * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable 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 aggregatedList($project, array $optionalArgs = []) - { - $request = new AggregatedListNetworkAttachmentsRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['includeAllScopes'])) { - $request->setIncludeAllScopes($optionalArgs['includeAllScopes']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - if (isset($optionalArgs['serviceProjectNumber'])) { - $request->setServiceProjectNumber($optionalArgs['serviceProjectNumber']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('AggregatedList', $optionalArgs, NetworkAttachmentAggregatedList::class, $request); - } - - /** - * Deletes the specified NetworkAttachment in the given scope - * - * Sample code: - * ``` - * $networkAttachmentsClient = new NetworkAttachmentsClient(); - * try { - * $networkAttachment = 'network_attachment'; - * $project = 'project'; - * $region = 'region'; - * $operationResponse = $networkAttachmentsClient->delete($networkAttachment, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $networkAttachmentsClient->delete($networkAttachment, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $networkAttachmentsClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $networkAttachmentsClient->close(); - * } - * ``` - * - * @param string $networkAttachment Name of the NetworkAttachment resource to delete. - * @param string $project Project ID for this request. - * @param string $region Name of the region of this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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). end_interface: MixerMutationRequestBuilder - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 delete($networkAttachment, $project, $region, array $optionalArgs = []) - { - $request = new DeleteNetworkAttachmentRequest(); - $requestParamHeaders = []; - $request->setNetworkAttachment($networkAttachment); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['network_attachment'] = $networkAttachment; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns the specified NetworkAttachment resource in the given scope. - * - * Sample code: - * ``` - * $networkAttachmentsClient = new NetworkAttachmentsClient(); - * try { - * $networkAttachment = 'network_attachment'; - * $project = 'project'; - * $region = 'region'; - * $response = $networkAttachmentsClient->get($networkAttachment, $project, $region); - * } finally { - * $networkAttachmentsClient->close(); - * } - * ``` - * - * @param string $networkAttachment Name of the NetworkAttachment resource to return. - * @param string $project Project ID for this request. - * @param string $region Name of the region of this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\NetworkAttachment - * - * @throws ApiException if the remote call fails - */ - public function get($networkAttachment, $project, $region, array $optionalArgs = []) - { - $request = new GetNetworkAttachmentRequest(); - $requestParamHeaders = []; - $request->setNetworkAttachment($networkAttachment); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['network_attachment'] = $networkAttachment; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', NetworkAttachment::class, $optionalArgs, $request)->wait(); - } - - /** - * Gets the access control policy for a resource. May be empty if no such policy or resource exists. - * - * Sample code: - * ``` - * $networkAttachmentsClient = new NetworkAttachmentsClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $resource = 'resource'; - * $response = $networkAttachmentsClient->getIamPolicy($project, $region, $resource); - * } finally { - * $networkAttachmentsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region The name of the region for this request. - * @param string $resource Name or id of the resource for this request. - * @param array $optionalArgs { - * Optional. - * - * @type int $optionsRequestedPolicyVersion - * Requested IAM Policy version. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function getIamPolicy($project, $region, $resource, array $optionalArgs = []) - { - $request = new GetIamPolicyNetworkAttachmentRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setResource($resource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['optionsRequestedPolicyVersion'])) { - $request->setOptionsRequestedPolicyVersion($optionalArgs['optionsRequestedPolicyVersion']); - } - - $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(); - } - - /** - * Creates a NetworkAttachment in the specified project in the given scope using the parameters that are included in the request. - * - * Sample code: - * ``` - * $networkAttachmentsClient = new NetworkAttachmentsClient(); - * try { - * $networkAttachmentResource = new NetworkAttachment(); - * $project = 'project'; - * $region = 'region'; - * $operationResponse = $networkAttachmentsClient->insert($networkAttachmentResource, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $networkAttachmentsClient->insert($networkAttachmentResource, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $networkAttachmentsClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $networkAttachmentsClient->close(); - * } - * ``` - * - * @param NetworkAttachment $networkAttachmentResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $region Name of the region of this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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). end_interface: MixerMutationRequestBuilder - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 insert($networkAttachmentResource, $project, $region, array $optionalArgs = []) - { - $request = new InsertNetworkAttachmentRequest(); - $requestParamHeaders = []; - $request->setNetworkAttachmentResource($networkAttachmentResource); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Lists the NetworkAttachments for a project in the given scope. - * - * Sample code: - * ``` - * $networkAttachmentsClient = new NetworkAttachmentsClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * // Iterate over pages of elements - * $pagedResponse = $networkAttachmentsClient->list($project, $region); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $networkAttachmentsClient->list($project, $region); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $networkAttachmentsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region of this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, $region, array $optionalArgs = []) - { - $request = new ListNetworkAttachmentsRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, NetworkAttachmentList::class, $request); - } - - /** - * Patches the specified NetworkAttachment resource with the data included in the request. This method supports PATCH semantics and uses JSON merge patch format and processing rules. - * - * Sample code: - * ``` - * $networkAttachmentsClient = new NetworkAttachmentsClient(); - * try { - * $networkAttachment = 'network_attachment'; - * $networkAttachmentResource = new NetworkAttachment(); - * $project = 'project'; - * $region = 'region'; - * $operationResponse = $networkAttachmentsClient->patch($networkAttachment, $networkAttachmentResource, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $networkAttachmentsClient->patch($networkAttachment, $networkAttachmentResource, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $networkAttachmentsClient->resumeOperation($operationName, 'patch'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $networkAttachmentsClient->close(); - * } - * ``` - * - * @param string $networkAttachment Name of the NetworkAttachment resource to patch. - * @param NetworkAttachment $networkAttachmentResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $region Name of the region for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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). end_interface: MixerMutationRequestBuilder - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 patch($networkAttachment, $networkAttachmentResource, $project, $region, array $optionalArgs = []) - { - $request = new PatchNetworkAttachmentRequest(); - $requestParamHeaders = []; - $request->setNetworkAttachment($networkAttachment); - $request->setNetworkAttachmentResource($networkAttachmentResource); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['network_attachment'] = $networkAttachment; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('Patch', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Sets the access control policy on the specified resource. Replaces any existing policy. - * - * Sample code: - * ``` - * $networkAttachmentsClient = new NetworkAttachmentsClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $regionSetPolicyRequestResource = new RegionSetPolicyRequest(); - * $resource = 'resource'; - * $response = $networkAttachmentsClient->setIamPolicy($project, $region, $regionSetPolicyRequestResource, $resource); - * } finally { - * $networkAttachmentsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region The name of the region for this request. - * @param RegionSetPolicyRequest $regionSetPolicyRequestResource The body resource for this request - * @param string $resource Name or id of the resource for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function setIamPolicy($project, $region, $regionSetPolicyRequestResource, $resource, array $optionalArgs = []) - { - $request = new SetIamPolicyNetworkAttachmentRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setRegionSetPolicyRequestResource($regionSetPolicyRequestResource); - $request->setResource($resource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['resource'] = $resource; - $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 resource. - * - * Sample code: - * ``` - * $networkAttachmentsClient = new NetworkAttachmentsClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $resource = 'resource'; - * $testPermissionsRequestResource = new TestPermissionsRequest(); - * $response = $networkAttachmentsClient->testIamPermissions($project, $region, $resource, $testPermissionsRequestResource); - * } finally { - * $networkAttachmentsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region The name of the region for this request. - * @param string $resource Name or id of the resource for this request. - * @param TestPermissionsRequest $testPermissionsRequestResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\TestPermissionsResponse - * - * @throws ApiException if the remote call fails - */ - public function testIamPermissions($project, $region, $resource, $testPermissionsRequestResource, array $optionalArgs = []) - { - $request = new TestIamPermissionsNetworkAttachmentRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setResource($resource); - $request->setTestPermissionsRequestResource($testPermissionsRequestResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['resource'] = $resource; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('TestIamPermissions', TestPermissionsResponse::class, $optionalArgs, $request)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/NetworkEdgeSecurityServicesGapicClient.php b/Compute/src/V1/Gapic/NetworkEdgeSecurityServicesGapicClient.php deleted file mode 100644 index 45d9a54b62b7..000000000000 --- a/Compute/src/V1/Gapic/NetworkEdgeSecurityServicesGapicClient.php +++ /dev/null @@ -1,639 +0,0 @@ -aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $networkEdgeSecurityServicesClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $networkEdgeSecurityServicesClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\NetworkEdgeSecurityServicesClient}. - */ -class NetworkEdgeSecurityServicesGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.NetworkEdgeSecurityServices'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/network_edge_security_services_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/network_edge_security_services_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/network_edge_security_services_rest_client_config.php', - ], - ], - 'operationsClientClass' => RegionOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an RegionOperationsClient object with the same endpoint as $this. - * - * @return RegionOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetRegionOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteRegionOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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); - } - - /** - * Retrieves the list of all NetworkEdgeSecurityService resources available to the specified project. To prevent failure, Google recommends that you set the `returnPartialSuccess` parameter to `true`. - * - * Sample code: - * ``` - * $networkEdgeSecurityServicesClient = new NetworkEdgeSecurityServicesClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $networkEdgeSecurityServicesClient->aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $networkEdgeSecurityServicesClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $networkEdgeSecurityServicesClient->close(); - * } - * ``` - * - * @param string $project Name of the project scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type bool $includeAllScopes - * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type int $serviceProjectNumber - * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable 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 aggregatedList($project, array $optionalArgs = []) - { - $request = new AggregatedListNetworkEdgeSecurityServicesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['includeAllScopes'])) { - $request->setIncludeAllScopes($optionalArgs['includeAllScopes']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - if (isset($optionalArgs['serviceProjectNumber'])) { - $request->setServiceProjectNumber($optionalArgs['serviceProjectNumber']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('AggregatedList', $optionalArgs, NetworkEdgeSecurityServiceAggregatedList::class, $request); - } - - /** - * Deletes the specified service. - * - * Sample code: - * ``` - * $networkEdgeSecurityServicesClient = new NetworkEdgeSecurityServicesClient(); - * try { - * $networkEdgeSecurityService = 'network_edge_security_service'; - * $project = 'project'; - * $region = 'region'; - * $operationResponse = $networkEdgeSecurityServicesClient->delete($networkEdgeSecurityService, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $networkEdgeSecurityServicesClient->delete($networkEdgeSecurityService, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $networkEdgeSecurityServicesClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $networkEdgeSecurityServicesClient->close(); - * } - * ``` - * - * @param string $networkEdgeSecurityService Name of the network edge security service to delete. - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($networkEdgeSecurityService, $project, $region, array $optionalArgs = []) - { - $request = new DeleteNetworkEdgeSecurityServiceRequest(); - $requestParamHeaders = []; - $request->setNetworkEdgeSecurityService($networkEdgeSecurityService); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['network_edge_security_service'] = $networkEdgeSecurityService; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Gets a specified NetworkEdgeSecurityService. - * - * Sample code: - * ``` - * $networkEdgeSecurityServicesClient = new NetworkEdgeSecurityServicesClient(); - * try { - * $networkEdgeSecurityService = 'network_edge_security_service'; - * $project = 'project'; - * $region = 'region'; - * $response = $networkEdgeSecurityServicesClient->get($networkEdgeSecurityService, $project, $region); - * } finally { - * $networkEdgeSecurityServicesClient->close(); - * } - * ``` - * - * @param string $networkEdgeSecurityService Name of the network edge security service to get. - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\NetworkEdgeSecurityService - * - * @throws ApiException if the remote call fails - */ - public function get($networkEdgeSecurityService, $project, $region, array $optionalArgs = []) - { - $request = new GetNetworkEdgeSecurityServiceRequest(); - $requestParamHeaders = []; - $request->setNetworkEdgeSecurityService($networkEdgeSecurityService); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['network_edge_security_service'] = $networkEdgeSecurityService; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', NetworkEdgeSecurityService::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates a new service in the specified project using the data included in the request. - * - * Sample code: - * ``` - * $networkEdgeSecurityServicesClient = new NetworkEdgeSecurityServicesClient(); - * try { - * $networkEdgeSecurityServiceResource = new NetworkEdgeSecurityService(); - * $project = 'project'; - * $region = 'region'; - * $operationResponse = $networkEdgeSecurityServicesClient->insert($networkEdgeSecurityServiceResource, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $networkEdgeSecurityServicesClient->insert($networkEdgeSecurityServiceResource, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $networkEdgeSecurityServicesClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $networkEdgeSecurityServicesClient->close(); - * } - * ``` - * - * @param NetworkEdgeSecurityService $networkEdgeSecurityServiceResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 $validateOnly - * If true, the request will not be committed. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 insert($networkEdgeSecurityServiceResource, $project, $region, array $optionalArgs = []) - { - $request = new InsertNetworkEdgeSecurityServiceRequest(); - $requestParamHeaders = []; - $request->setNetworkEdgeSecurityServiceResource($networkEdgeSecurityServiceResource); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Patches the specified policy with the data included in the request. - * - * Sample code: - * ``` - * $networkEdgeSecurityServicesClient = new NetworkEdgeSecurityServicesClient(); - * try { - * $networkEdgeSecurityService = 'network_edge_security_service'; - * $networkEdgeSecurityServiceResource = new NetworkEdgeSecurityService(); - * $project = 'project'; - * $region = 'region'; - * $operationResponse = $networkEdgeSecurityServicesClient->patch($networkEdgeSecurityService, $networkEdgeSecurityServiceResource, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $networkEdgeSecurityServicesClient->patch($networkEdgeSecurityService, $networkEdgeSecurityServiceResource, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $networkEdgeSecurityServicesClient->resumeOperation($operationName, 'patch'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $networkEdgeSecurityServicesClient->close(); - * } - * ``` - * - * @param string $networkEdgeSecurityService Name of the network edge security service to update. - * @param NetworkEdgeSecurityService $networkEdgeSecurityServiceResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $paths - * @type string $requestId - * 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. 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 $updateMask - * Indicates fields to be updated as part of this request. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 patch($networkEdgeSecurityService, $networkEdgeSecurityServiceResource, $project, $region, array $optionalArgs = []) - { - $request = new PatchNetworkEdgeSecurityServiceRequest(); - $requestParamHeaders = []; - $request->setNetworkEdgeSecurityService($networkEdgeSecurityService); - $request->setNetworkEdgeSecurityServiceResource($networkEdgeSecurityServiceResource); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['network_edge_security_service'] = $networkEdgeSecurityService; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - if (isset($optionalArgs['paths'])) { - $request->setPaths($optionalArgs['paths']); - } - - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('Patch', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/NetworkEndpointGroupsGapicClient.php b/Compute/src/V1/Gapic/NetworkEndpointGroupsGapicClient.php deleted file mode 100644 index d43db0847f3f..000000000000 --- a/Compute/src/V1/Gapic/NetworkEndpointGroupsGapicClient.php +++ /dev/null @@ -1,945 +0,0 @@ -aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $networkEndpointGroupsClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $networkEndpointGroupsClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\NetworkEndpointGroupsClient}. - */ -class NetworkEndpointGroupsGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.NetworkEndpointGroups'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/network_endpoint_groups_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/network_endpoint_groups_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/network_endpoint_groups_rest_client_config.php', - ], - ], - 'operationsClientClass' => ZoneOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an ZoneOperationsClient object with the same endpoint as $this. - * - * @return ZoneOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getZone', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetZoneOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteZoneOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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); - } - - /** - * Retrieves the list of network endpoint groups and sorts them by zone. To prevent failure, Google recommends that you set the `returnPartialSuccess` parameter to `true`. - * - * Sample code: - * ``` - * $networkEndpointGroupsClient = new NetworkEndpointGroupsClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $networkEndpointGroupsClient->aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $networkEndpointGroupsClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $networkEndpointGroupsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type bool $includeAllScopes - * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type int $serviceProjectNumber - * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable 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 aggregatedList($project, array $optionalArgs = []) - { - $request = new AggregatedListNetworkEndpointGroupsRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['includeAllScopes'])) { - $request->setIncludeAllScopes($optionalArgs['includeAllScopes']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - if (isset($optionalArgs['serviceProjectNumber'])) { - $request->setServiceProjectNumber($optionalArgs['serviceProjectNumber']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('AggregatedList', $optionalArgs, NetworkEndpointGroupAggregatedList::class, $request); - } - - /** - * Attach a list of network endpoints to the specified network endpoint group. - * - * Sample code: - * ``` - * $networkEndpointGroupsClient = new NetworkEndpointGroupsClient(); - * try { - * $networkEndpointGroup = 'network_endpoint_group'; - * $networkEndpointGroupsAttachEndpointsRequestResource = new NetworkEndpointGroupsAttachEndpointsRequest(); - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $networkEndpointGroupsClient->attachNetworkEndpoints($networkEndpointGroup, $networkEndpointGroupsAttachEndpointsRequestResource, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $networkEndpointGroupsClient->attachNetworkEndpoints($networkEndpointGroup, $networkEndpointGroupsAttachEndpointsRequestResource, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $networkEndpointGroupsClient->resumeOperation($operationName, 'attachNetworkEndpoints'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $networkEndpointGroupsClient->close(); - * } - * ``` - * - * @param string $networkEndpointGroup The name of the network endpoint group where you are attaching network endpoints to. It should comply with RFC1035. - * @param NetworkEndpointGroupsAttachEndpointsRequest $networkEndpointGroupsAttachEndpointsRequestResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $zone The name of the zone where the network endpoint group is located. It should comply with RFC1035. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 attachNetworkEndpoints($networkEndpointGroup, $networkEndpointGroupsAttachEndpointsRequestResource, $project, $zone, array $optionalArgs = []) - { - $request = new AttachNetworkEndpointsNetworkEndpointGroupRequest(); - $requestParamHeaders = []; - $request->setNetworkEndpointGroup($networkEndpointGroup); - $request->setNetworkEndpointGroupsAttachEndpointsRequestResource($networkEndpointGroupsAttachEndpointsRequestResource); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['network_endpoint_group'] = $networkEndpointGroup; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('AttachNetworkEndpoints', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Deletes the specified network endpoint group. The network endpoints in the NEG and the VM instances they belong to are not terminated when the NEG is deleted. Note that the NEG cannot be deleted if there are backend services referencing it. - * - * Sample code: - * ``` - * $networkEndpointGroupsClient = new NetworkEndpointGroupsClient(); - * try { - * $networkEndpointGroup = 'network_endpoint_group'; - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $networkEndpointGroupsClient->delete($networkEndpointGroup, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $networkEndpointGroupsClient->delete($networkEndpointGroup, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $networkEndpointGroupsClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $networkEndpointGroupsClient->close(); - * } - * ``` - * - * @param string $networkEndpointGroup The name of the network endpoint group to delete. It should comply with RFC1035. - * @param string $project Project ID for this request. - * @param string $zone The name of the zone where the network endpoint group is located. It should comply with RFC1035. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($networkEndpointGroup, $project, $zone, array $optionalArgs = []) - { - $request = new DeleteNetworkEndpointGroupRequest(); - $requestParamHeaders = []; - $request->setNetworkEndpointGroup($networkEndpointGroup); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['network_endpoint_group'] = $networkEndpointGroup; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Detach a list of network endpoints from the specified network endpoint group. - * - * Sample code: - * ``` - * $networkEndpointGroupsClient = new NetworkEndpointGroupsClient(); - * try { - * $networkEndpointGroup = 'network_endpoint_group'; - * $networkEndpointGroupsDetachEndpointsRequestResource = new NetworkEndpointGroupsDetachEndpointsRequest(); - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $networkEndpointGroupsClient->detachNetworkEndpoints($networkEndpointGroup, $networkEndpointGroupsDetachEndpointsRequestResource, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $networkEndpointGroupsClient->detachNetworkEndpoints($networkEndpointGroup, $networkEndpointGroupsDetachEndpointsRequestResource, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $networkEndpointGroupsClient->resumeOperation($operationName, 'detachNetworkEndpoints'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $networkEndpointGroupsClient->close(); - * } - * ``` - * - * @param string $networkEndpointGroup The name of the network endpoint group where you are removing network endpoints. It should comply with RFC1035. - * @param NetworkEndpointGroupsDetachEndpointsRequest $networkEndpointGroupsDetachEndpointsRequestResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $zone The name of the zone where the network endpoint group is located. It should comply with RFC1035. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 detachNetworkEndpoints($networkEndpointGroup, $networkEndpointGroupsDetachEndpointsRequestResource, $project, $zone, array $optionalArgs = []) - { - $request = new DetachNetworkEndpointsNetworkEndpointGroupRequest(); - $requestParamHeaders = []; - $request->setNetworkEndpointGroup($networkEndpointGroup); - $request->setNetworkEndpointGroupsDetachEndpointsRequestResource($networkEndpointGroupsDetachEndpointsRequestResource); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['network_endpoint_group'] = $networkEndpointGroup; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('DetachNetworkEndpoints', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns the specified network endpoint group. - * - * Sample code: - * ``` - * $networkEndpointGroupsClient = new NetworkEndpointGroupsClient(); - * try { - * $networkEndpointGroup = 'network_endpoint_group'; - * $project = 'project'; - * $zone = 'zone'; - * $response = $networkEndpointGroupsClient->get($networkEndpointGroup, $project, $zone); - * } finally { - * $networkEndpointGroupsClient->close(); - * } - * ``` - * - * @param string $networkEndpointGroup The name of the network endpoint group. It should comply with RFC1035. - * @param string $project Project ID for this request. - * @param string $zone The name of the zone where the network endpoint group is located. It should comply with RFC1035. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\NetworkEndpointGroup - * - * @throws ApiException if the remote call fails - */ - public function get($networkEndpointGroup, $project, $zone, array $optionalArgs = []) - { - $request = new GetNetworkEndpointGroupRequest(); - $requestParamHeaders = []; - $request->setNetworkEndpointGroup($networkEndpointGroup); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['network_endpoint_group'] = $networkEndpointGroup; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', NetworkEndpointGroup::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates a network endpoint group in the specified project using the parameters that are included in the request. - * - * Sample code: - * ``` - * $networkEndpointGroupsClient = new NetworkEndpointGroupsClient(); - * try { - * $networkEndpointGroupResource = new NetworkEndpointGroup(); - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $networkEndpointGroupsClient->insert($networkEndpointGroupResource, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $networkEndpointGroupsClient->insert($networkEndpointGroupResource, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $networkEndpointGroupsClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $networkEndpointGroupsClient->close(); - * } - * ``` - * - * @param NetworkEndpointGroup $networkEndpointGroupResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $zone The name of the zone where you want to create the network endpoint group. It should comply with RFC1035. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 insert($networkEndpointGroupResource, $project, $zone, array $optionalArgs = []) - { - $request = new InsertNetworkEndpointGroupRequest(); - $requestParamHeaders = []; - $request->setNetworkEndpointGroupResource($networkEndpointGroupResource); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Retrieves the list of network endpoint groups that are located in the specified project and zone. - * - * Sample code: - * ``` - * $networkEndpointGroupsClient = new NetworkEndpointGroupsClient(); - * try { - * $project = 'project'; - * $zone = 'zone'; - * // Iterate over pages of elements - * $pagedResponse = $networkEndpointGroupsClient->list($project, $zone); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $networkEndpointGroupsClient->list($project, $zone); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $networkEndpointGroupsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $zone The name of the zone where the network endpoint group is located. It should comply with RFC1035. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, $zone, array $optionalArgs = []) - { - $request = new ListNetworkEndpointGroupsRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, NetworkEndpointGroupList::class, $request); - } - - /** - * Lists the network endpoints in the specified network endpoint group. - * - * Sample code: - * ``` - * $networkEndpointGroupsClient = new NetworkEndpointGroupsClient(); - * try { - * $networkEndpointGroup = 'network_endpoint_group'; - * $networkEndpointGroupsListEndpointsRequestResource = new NetworkEndpointGroupsListEndpointsRequest(); - * $project = 'project'; - * $zone = 'zone'; - * // Iterate over pages of elements - * $pagedResponse = $networkEndpointGroupsClient->listNetworkEndpoints($networkEndpointGroup, $networkEndpointGroupsListEndpointsRequestResource, $project, $zone); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $networkEndpointGroupsClient->listNetworkEndpoints($networkEndpointGroup, $networkEndpointGroupsListEndpointsRequestResource, $project, $zone); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $networkEndpointGroupsClient->close(); - * } - * ``` - * - * @param string $networkEndpointGroup The name of the network endpoint group from which you want to generate a list of included network endpoints. It should comply with RFC1035. - * @param NetworkEndpointGroupsListEndpointsRequest $networkEndpointGroupsListEndpointsRequestResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $zone The name of the zone where the network endpoint group is located. It should comply with RFC1035. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 listNetworkEndpoints($networkEndpointGroup, $networkEndpointGroupsListEndpointsRequestResource, $project, $zone, array $optionalArgs = []) - { - $request = new ListNetworkEndpointsNetworkEndpointGroupsRequest(); - $requestParamHeaders = []; - $request->setNetworkEndpointGroup($networkEndpointGroup); - $request->setNetworkEndpointGroupsListEndpointsRequestResource($networkEndpointGroupsListEndpointsRequestResource); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['network_endpoint_group'] = $networkEndpointGroup; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('ListNetworkEndpoints', $optionalArgs, NetworkEndpointGroupsListNetworkEndpoints::class, $request); - } - - /** - * Returns permissions that a caller has on the specified resource. - * - * Sample code: - * ``` - * $networkEndpointGroupsClient = new NetworkEndpointGroupsClient(); - * try { - * $project = 'project'; - * $resource = 'resource'; - * $testPermissionsRequestResource = new TestPermissionsRequest(); - * $zone = 'zone'; - * $response = $networkEndpointGroupsClient->testIamPermissions($project, $resource, $testPermissionsRequestResource, $zone); - * } finally { - * $networkEndpointGroupsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $resource Name or id of the resource for this request. - * @param TestPermissionsRequest $testPermissionsRequestResource The body resource for this request - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\TestPermissionsResponse - * - * @throws ApiException if the remote call fails - */ - public function testIamPermissions($project, $resource, $testPermissionsRequestResource, $zone, array $optionalArgs = []) - { - $request = new TestIamPermissionsNetworkEndpointGroupRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setResource($resource); - $request->setTestPermissionsRequestResource($testPermissionsRequestResource); - $request->setZone($zone); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['resource'] = $resource; - $requestParamHeaders['zone'] = $zone; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('TestIamPermissions', TestPermissionsResponse::class, $optionalArgs, $request)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/NetworkFirewallPoliciesGapicClient.php b/Compute/src/V1/Gapic/NetworkFirewallPoliciesGapicClient.php deleted file mode 100644 index 7ad8178ddd8b..000000000000 --- a/Compute/src/V1/Gapic/NetworkFirewallPoliciesGapicClient.php +++ /dev/null @@ -1,1742 +0,0 @@ -addAssociation($firewallPolicy, $firewallPolicyAssociationResource, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $networkFirewallPoliciesClient->addAssociation($firewallPolicy, $firewallPolicyAssociationResource, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $networkFirewallPoliciesClient->resumeOperation($operationName, 'addAssociation'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $networkFirewallPoliciesClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\NetworkFirewallPoliciesClient}. - */ -class NetworkFirewallPoliciesGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.NetworkFirewallPolicies'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/network_firewall_policies_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/network_firewall_policies_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/network_firewall_policies_rest_client_config.php', - ], - ], - 'operationsClientClass' => GlobalOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an GlobalOperationsClient object with the same endpoint as $this. - * - * @return GlobalOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetGlobalOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteGlobalOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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); - } - - /** - * Inserts an association for the specified firewall policy. - * - * Sample code: - * ``` - * $networkFirewallPoliciesClient = new NetworkFirewallPoliciesClient(); - * try { - * $firewallPolicy = 'firewall_policy'; - * $firewallPolicyAssociationResource = new FirewallPolicyAssociation(); - * $project = 'project'; - * $operationResponse = $networkFirewallPoliciesClient->addAssociation($firewallPolicy, $firewallPolicyAssociationResource, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $networkFirewallPoliciesClient->addAssociation($firewallPolicy, $firewallPolicyAssociationResource, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $networkFirewallPoliciesClient->resumeOperation($operationName, 'addAssociation'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $networkFirewallPoliciesClient->close(); - * } - * ``` - * - * @param string $firewallPolicy Name of the firewall policy to update. - * @param FirewallPolicyAssociation $firewallPolicyAssociationResource The body resource for this request - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type bool $replaceExistingAssociation - * Indicates whether or not to replace it if an association of the attachment already exists. This is false by default, in which case an error will be returned if an association already exists. - * @type string $requestId - * 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. 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 addAssociation($firewallPolicy, $firewallPolicyAssociationResource, $project, array $optionalArgs = []) - { - $request = new AddAssociationNetworkFirewallPolicyRequest(); - $requestParamHeaders = []; - $request->setFirewallPolicy($firewallPolicy); - $request->setFirewallPolicyAssociationResource($firewallPolicyAssociationResource); - $request->setProject($project); - $requestParamHeaders['firewall_policy'] = $firewallPolicy; - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['replaceExistingAssociation'])) { - $request->setReplaceExistingAssociation($optionalArgs['replaceExistingAssociation']); - } - - 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('AddAssociation', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Inserts a packet mirroring rule into a firewall policy. - * - * Sample code: - * ``` - * $networkFirewallPoliciesClient = new NetworkFirewallPoliciesClient(); - * try { - * $firewallPolicy = 'firewall_policy'; - * $firewallPolicyRuleResource = new FirewallPolicyRule(); - * $project = 'project'; - * $operationResponse = $networkFirewallPoliciesClient->addPacketMirroringRule($firewallPolicy, $firewallPolicyRuleResource, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $networkFirewallPoliciesClient->addPacketMirroringRule($firewallPolicy, $firewallPolicyRuleResource, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $networkFirewallPoliciesClient->resumeOperation($operationName, 'addPacketMirroringRule'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $networkFirewallPoliciesClient->close(); - * } - * ``` - * - * @param string $firewallPolicy Name of the firewall policy to update. - * @param FirewallPolicyRule $firewallPolicyRuleResource The body resource for this request - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type int $maxPriority - * When rule.priority is not specified, auto choose a unused priority between minPriority and maxPriority>. This field is exclusive with rule.priority. - * @type int $minPriority - * When rule.priority is not specified, auto choose a unused priority between minPriority and maxPriority>. This field is exclusive with rule.priority. - * @type string $requestId - * 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. 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 addPacketMirroringRule($firewallPolicy, $firewallPolicyRuleResource, $project, array $optionalArgs = []) - { - $request = new AddPacketMirroringRuleNetworkFirewallPolicyRequest(); - $requestParamHeaders = []; - $request->setFirewallPolicy($firewallPolicy); - $request->setFirewallPolicyRuleResource($firewallPolicyRuleResource); - $request->setProject($project); - $requestParamHeaders['firewall_policy'] = $firewallPolicy; - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['maxPriority'])) { - $request->setMaxPriority($optionalArgs['maxPriority']); - } - - if (isset($optionalArgs['minPriority'])) { - $request->setMinPriority($optionalArgs['minPriority']); - } - - 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('AddPacketMirroringRule', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Inserts a rule into a firewall policy. - * - * Sample code: - * ``` - * $networkFirewallPoliciesClient = new NetworkFirewallPoliciesClient(); - * try { - * $firewallPolicy = 'firewall_policy'; - * $firewallPolicyRuleResource = new FirewallPolicyRule(); - * $project = 'project'; - * $operationResponse = $networkFirewallPoliciesClient->addRule($firewallPolicy, $firewallPolicyRuleResource, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $networkFirewallPoliciesClient->addRule($firewallPolicy, $firewallPolicyRuleResource, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $networkFirewallPoliciesClient->resumeOperation($operationName, 'addRule'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $networkFirewallPoliciesClient->close(); - * } - * ``` - * - * @param string $firewallPolicy Name of the firewall policy to update. - * @param FirewallPolicyRule $firewallPolicyRuleResource The body resource for this request - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type int $maxPriority - * When rule.priority is not specified, auto choose a unused priority between minPriority and maxPriority>. This field is exclusive with rule.priority. - * @type int $minPriority - * When rule.priority is not specified, auto choose a unused priority between minPriority and maxPriority>. This field is exclusive with rule.priority. - * @type string $requestId - * 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. 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 addRule($firewallPolicy, $firewallPolicyRuleResource, $project, array $optionalArgs = []) - { - $request = new AddRuleNetworkFirewallPolicyRequest(); - $requestParamHeaders = []; - $request->setFirewallPolicy($firewallPolicy); - $request->setFirewallPolicyRuleResource($firewallPolicyRuleResource); - $request->setProject($project); - $requestParamHeaders['firewall_policy'] = $firewallPolicy; - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['maxPriority'])) { - $request->setMaxPriority($optionalArgs['maxPriority']); - } - - if (isset($optionalArgs['minPriority'])) { - $request->setMinPriority($optionalArgs['minPriority']); - } - - 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('AddRule', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Retrieves an aggregated list of network firewall policies, listing network firewall policies from all applicable scopes (global and regional) and grouping the results per scope. To prevent failure, Google recommends that you set the `returnPartialSuccess` parameter to `true`. - * - * Sample code: - * ``` - * $networkFirewallPoliciesClient = new NetworkFirewallPoliciesClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $networkFirewallPoliciesClient->aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $networkFirewallPoliciesClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $networkFirewallPoliciesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type bool $includeAllScopes - * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type int $serviceProjectNumber - * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable 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 aggregatedList($project, array $optionalArgs = []) - { - $request = new AggregatedListNetworkFirewallPoliciesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['includeAllScopes'])) { - $request->setIncludeAllScopes($optionalArgs['includeAllScopes']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - if (isset($optionalArgs['serviceProjectNumber'])) { - $request->setServiceProjectNumber($optionalArgs['serviceProjectNumber']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('AggregatedList', $optionalArgs, NetworkFirewallPolicyAggregatedList::class, $request); - } - - /** - * Copies rules to the specified firewall policy. - * - * Sample code: - * ``` - * $networkFirewallPoliciesClient = new NetworkFirewallPoliciesClient(); - * try { - * $firewallPolicy = 'firewall_policy'; - * $project = 'project'; - * $operationResponse = $networkFirewallPoliciesClient->cloneRules($firewallPolicy, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $networkFirewallPoliciesClient->cloneRules($firewallPolicy, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $networkFirewallPoliciesClient->resumeOperation($operationName, 'cloneRules'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $networkFirewallPoliciesClient->close(); - * } - * ``` - * - * @param string $firewallPolicy Name of the firewall policy to update. - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 $sourceFirewallPolicy - * The firewall policy from which to copy rules. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 cloneRules($firewallPolicy, $project, array $optionalArgs = []) - { - $request = new CloneRulesNetworkFirewallPolicyRequest(); - $requestParamHeaders = []; - $request->setFirewallPolicy($firewallPolicy); - $request->setProject($project); - $requestParamHeaders['firewall_policy'] = $firewallPolicy; - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - if (isset($optionalArgs['sourceFirewallPolicy'])) { - $request->setSourceFirewallPolicy($optionalArgs['sourceFirewallPolicy']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('CloneRules', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Deletes the specified policy. - * - * Sample code: - * ``` - * $networkFirewallPoliciesClient = new NetworkFirewallPoliciesClient(); - * try { - * $firewallPolicy = 'firewall_policy'; - * $project = 'project'; - * $operationResponse = $networkFirewallPoliciesClient->delete($firewallPolicy, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $networkFirewallPoliciesClient->delete($firewallPolicy, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $networkFirewallPoliciesClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $networkFirewallPoliciesClient->close(); - * } - * ``` - * - * @param string $firewallPolicy Name of the firewall policy to delete. - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($firewallPolicy, $project, array $optionalArgs = []) - { - $request = new DeleteNetworkFirewallPolicyRequest(); - $requestParamHeaders = []; - $request->setFirewallPolicy($firewallPolicy); - $request->setProject($project); - $requestParamHeaders['firewall_policy'] = $firewallPolicy; - $requestParamHeaders['project'] = $project; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns the specified network firewall policy. - * - * Sample code: - * ``` - * $networkFirewallPoliciesClient = new NetworkFirewallPoliciesClient(); - * try { - * $firewallPolicy = 'firewall_policy'; - * $project = 'project'; - * $response = $networkFirewallPoliciesClient->get($firewallPolicy, $project); - * } finally { - * $networkFirewallPoliciesClient->close(); - * } - * ``` - * - * @param string $firewallPolicy Name of the firewall policy to get. - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\FirewallPolicy - * - * @throws ApiException if the remote call fails - */ - public function get($firewallPolicy, $project, array $optionalArgs = []) - { - $request = new GetNetworkFirewallPolicyRequest(); - $requestParamHeaders = []; - $request->setFirewallPolicy($firewallPolicy); - $request->setProject($project); - $requestParamHeaders['firewall_policy'] = $firewallPolicy; - $requestParamHeaders['project'] = $project; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', FirewallPolicy::class, $optionalArgs, $request)->wait(); - } - - /** - * Gets an association with the specified name. - * - * Sample code: - * ``` - * $networkFirewallPoliciesClient = new NetworkFirewallPoliciesClient(); - * try { - * $firewallPolicy = 'firewall_policy'; - * $project = 'project'; - * $response = $networkFirewallPoliciesClient->getAssociation($firewallPolicy, $project); - * } finally { - * $networkFirewallPoliciesClient->close(); - * } - * ``` - * - * @param string $firewallPolicy Name of the firewall policy to which the queried association belongs. - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * The name of the association to get from the firewall policy. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\FirewallPolicyAssociation - * - * @throws ApiException if the remote call fails - */ - public function getAssociation($firewallPolicy, $project, array $optionalArgs = []) - { - $request = new GetAssociationNetworkFirewallPolicyRequest(); - $requestParamHeaders = []; - $request->setFirewallPolicy($firewallPolicy); - $request->setProject($project); - $requestParamHeaders['firewall_policy'] = $firewallPolicy; - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetAssociation', FirewallPolicyAssociation::class, $optionalArgs, $request)->wait(); - } - - /** - * Gets the access control policy for a resource. May be empty if no such policy or resource exists. - * - * Sample code: - * ``` - * $networkFirewallPoliciesClient = new NetworkFirewallPoliciesClient(); - * try { - * $project = 'project'; - * $resource = 'resource'; - * $response = $networkFirewallPoliciesClient->getIamPolicy($project, $resource); - * } finally { - * $networkFirewallPoliciesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $resource Name or id of the resource for this request. - * @param array $optionalArgs { - * Optional. - * - * @type int $optionsRequestedPolicyVersion - * Requested IAM Policy version. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function getIamPolicy($project, $resource, array $optionalArgs = []) - { - $request = new GetIamPolicyNetworkFirewallPolicyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setResource($resource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['optionsRequestedPolicyVersion'])) { - $request->setOptionsRequestedPolicyVersion($optionalArgs['optionsRequestedPolicyVersion']); - } - - $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 a packet mirroring rule of the specified priority. - * - * Sample code: - * ``` - * $networkFirewallPoliciesClient = new NetworkFirewallPoliciesClient(); - * try { - * $firewallPolicy = 'firewall_policy'; - * $project = 'project'; - * $response = $networkFirewallPoliciesClient->getPacketMirroringRule($firewallPolicy, $project); - * } finally { - * $networkFirewallPoliciesClient->close(); - * } - * ``` - * - * @param string $firewallPolicy Name of the firewall policy to which the queried rule belongs. - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type int $priority - * The priority of the rule to get from the firewall policy. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\FirewallPolicyRule - * - * @throws ApiException if the remote call fails - */ - public function getPacketMirroringRule($firewallPolicy, $project, array $optionalArgs = []) - { - $request = new GetPacketMirroringRuleNetworkFirewallPolicyRequest(); - $requestParamHeaders = []; - $request->setFirewallPolicy($firewallPolicy); - $request->setProject($project); - $requestParamHeaders['firewall_policy'] = $firewallPolicy; - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['priority'])) { - $request->setPriority($optionalArgs['priority']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetPacketMirroringRule', FirewallPolicyRule::class, $optionalArgs, $request)->wait(); - } - - /** - * Gets a rule of the specified priority. - * - * Sample code: - * ``` - * $networkFirewallPoliciesClient = new NetworkFirewallPoliciesClient(); - * try { - * $firewallPolicy = 'firewall_policy'; - * $project = 'project'; - * $response = $networkFirewallPoliciesClient->getRule($firewallPolicy, $project); - * } finally { - * $networkFirewallPoliciesClient->close(); - * } - * ``` - * - * @param string $firewallPolicy Name of the firewall policy to which the queried rule belongs. - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type int $priority - * The priority of the rule to get from the firewall policy. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\FirewallPolicyRule - * - * @throws ApiException if the remote call fails - */ - public function getRule($firewallPolicy, $project, array $optionalArgs = []) - { - $request = new GetRuleNetworkFirewallPolicyRequest(); - $requestParamHeaders = []; - $request->setFirewallPolicy($firewallPolicy); - $request->setProject($project); - $requestParamHeaders['firewall_policy'] = $firewallPolicy; - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['priority'])) { - $request->setPriority($optionalArgs['priority']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetRule', FirewallPolicyRule::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates a new policy in the specified project using the data included in the request. - * - * Sample code: - * ``` - * $networkFirewallPoliciesClient = new NetworkFirewallPoliciesClient(); - * try { - * $firewallPolicyResource = new FirewallPolicy(); - * $project = 'project'; - * $operationResponse = $networkFirewallPoliciesClient->insert($firewallPolicyResource, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $networkFirewallPoliciesClient->insert($firewallPolicyResource, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $networkFirewallPoliciesClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $networkFirewallPoliciesClient->close(); - * } - * ``` - * - * @param FirewallPolicy $firewallPolicyResource The body resource for this request - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 insert($firewallPolicyResource, $project, array $optionalArgs = []) - { - $request = new InsertNetworkFirewallPolicyRequest(); - $requestParamHeaders = []; - $request->setFirewallPolicyResource($firewallPolicyResource); - $request->setProject($project); - $requestParamHeaders['project'] = $project; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Lists all the policies that have been configured for the specified project. - * - * Sample code: - * ``` - * $networkFirewallPoliciesClient = new NetworkFirewallPoliciesClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $networkFirewallPoliciesClient->list($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $networkFirewallPoliciesClient->list($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $networkFirewallPoliciesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, array $optionalArgs = []) - { - $request = new ListNetworkFirewallPoliciesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, FirewallPolicyList::class, $request); - } - - /** - * Patches the specified policy with the data included in the request. - * - * Sample code: - * ``` - * $networkFirewallPoliciesClient = new NetworkFirewallPoliciesClient(); - * try { - * $firewallPolicy = 'firewall_policy'; - * $firewallPolicyResource = new FirewallPolicy(); - * $project = 'project'; - * $operationResponse = $networkFirewallPoliciesClient->patch($firewallPolicy, $firewallPolicyResource, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $networkFirewallPoliciesClient->patch($firewallPolicy, $firewallPolicyResource, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $networkFirewallPoliciesClient->resumeOperation($operationName, 'patch'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $networkFirewallPoliciesClient->close(); - * } - * ``` - * - * @param string $firewallPolicy Name of the firewall policy to update. - * @param FirewallPolicy $firewallPolicyResource The body resource for this request - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 patch($firewallPolicy, $firewallPolicyResource, $project, array $optionalArgs = []) - { - $request = new PatchNetworkFirewallPolicyRequest(); - $requestParamHeaders = []; - $request->setFirewallPolicy($firewallPolicy); - $request->setFirewallPolicyResource($firewallPolicyResource); - $request->setProject($project); - $requestParamHeaders['firewall_policy'] = $firewallPolicy; - $requestParamHeaders['project'] = $project; - 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('Patch', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Patches a packet mirroring rule of the specified priority. - * - * Sample code: - * ``` - * $networkFirewallPoliciesClient = new NetworkFirewallPoliciesClient(); - * try { - * $firewallPolicy = 'firewall_policy'; - * $firewallPolicyRuleResource = new FirewallPolicyRule(); - * $project = 'project'; - * $operationResponse = $networkFirewallPoliciesClient->patchPacketMirroringRule($firewallPolicy, $firewallPolicyRuleResource, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $networkFirewallPoliciesClient->patchPacketMirroringRule($firewallPolicy, $firewallPolicyRuleResource, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $networkFirewallPoliciesClient->resumeOperation($operationName, 'patchPacketMirroringRule'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $networkFirewallPoliciesClient->close(); - * } - * ``` - * - * @param string $firewallPolicy Name of the firewall policy to update. - * @param FirewallPolicyRule $firewallPolicyRuleResource The body resource for this request - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type int $priority - * The priority of the rule to patch. - * @type string $requestId - * 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. 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 patchPacketMirroringRule($firewallPolicy, $firewallPolicyRuleResource, $project, array $optionalArgs = []) - { - $request = new PatchPacketMirroringRuleNetworkFirewallPolicyRequest(); - $requestParamHeaders = []; - $request->setFirewallPolicy($firewallPolicy); - $request->setFirewallPolicyRuleResource($firewallPolicyRuleResource); - $request->setProject($project); - $requestParamHeaders['firewall_policy'] = $firewallPolicy; - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['priority'])) { - $request->setPriority($optionalArgs['priority']); - } - - 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('PatchPacketMirroringRule', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Patches a rule of the specified priority. - * - * Sample code: - * ``` - * $networkFirewallPoliciesClient = new NetworkFirewallPoliciesClient(); - * try { - * $firewallPolicy = 'firewall_policy'; - * $firewallPolicyRuleResource = new FirewallPolicyRule(); - * $project = 'project'; - * $operationResponse = $networkFirewallPoliciesClient->patchRule($firewallPolicy, $firewallPolicyRuleResource, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $networkFirewallPoliciesClient->patchRule($firewallPolicy, $firewallPolicyRuleResource, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $networkFirewallPoliciesClient->resumeOperation($operationName, 'patchRule'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $networkFirewallPoliciesClient->close(); - * } - * ``` - * - * @param string $firewallPolicy Name of the firewall policy to update. - * @param FirewallPolicyRule $firewallPolicyRuleResource The body resource for this request - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type int $priority - * The priority of the rule to patch. - * @type string $requestId - * 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. 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 patchRule($firewallPolicy, $firewallPolicyRuleResource, $project, array $optionalArgs = []) - { - $request = new PatchRuleNetworkFirewallPolicyRequest(); - $requestParamHeaders = []; - $request->setFirewallPolicy($firewallPolicy); - $request->setFirewallPolicyRuleResource($firewallPolicyRuleResource); - $request->setProject($project); - $requestParamHeaders['firewall_policy'] = $firewallPolicy; - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['priority'])) { - $request->setPriority($optionalArgs['priority']); - } - - 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('PatchRule', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Removes an association for the specified firewall policy. - * - * Sample code: - * ``` - * $networkFirewallPoliciesClient = new NetworkFirewallPoliciesClient(); - * try { - * $firewallPolicy = 'firewall_policy'; - * $project = 'project'; - * $operationResponse = $networkFirewallPoliciesClient->removeAssociation($firewallPolicy, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $networkFirewallPoliciesClient->removeAssociation($firewallPolicy, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $networkFirewallPoliciesClient->resumeOperation($operationName, 'removeAssociation'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $networkFirewallPoliciesClient->close(); - * } - * ``` - * - * @param string $firewallPolicy Name of the firewall policy to update. - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * Name for the attachment that will be removed. - * @type string $requestId - * 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. 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 removeAssociation($firewallPolicy, $project, array $optionalArgs = []) - { - $request = new RemoveAssociationNetworkFirewallPolicyRequest(); - $requestParamHeaders = []; - $request->setFirewallPolicy($firewallPolicy); - $request->setProject($project); - $requestParamHeaders['firewall_policy'] = $firewallPolicy; - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['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('RemoveAssociation', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Deletes a packet mirroring rule of the specified priority. - * - * Sample code: - * ``` - * $networkFirewallPoliciesClient = new NetworkFirewallPoliciesClient(); - * try { - * $firewallPolicy = 'firewall_policy'; - * $project = 'project'; - * $operationResponse = $networkFirewallPoliciesClient->removePacketMirroringRule($firewallPolicy, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $networkFirewallPoliciesClient->removePacketMirroringRule($firewallPolicy, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $networkFirewallPoliciesClient->resumeOperation($operationName, 'removePacketMirroringRule'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $networkFirewallPoliciesClient->close(); - * } - * ``` - * - * @param string $firewallPolicy Name of the firewall policy to update. - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type int $priority - * The priority of the rule to remove from the firewall policy. - * @type string $requestId - * 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. 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 removePacketMirroringRule($firewallPolicy, $project, array $optionalArgs = []) - { - $request = new RemovePacketMirroringRuleNetworkFirewallPolicyRequest(); - $requestParamHeaders = []; - $request->setFirewallPolicy($firewallPolicy); - $request->setProject($project); - $requestParamHeaders['firewall_policy'] = $firewallPolicy; - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['priority'])) { - $request->setPriority($optionalArgs['priority']); - } - - 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('RemovePacketMirroringRule', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Deletes a rule of the specified priority. - * - * Sample code: - * ``` - * $networkFirewallPoliciesClient = new NetworkFirewallPoliciesClient(); - * try { - * $firewallPolicy = 'firewall_policy'; - * $project = 'project'; - * $operationResponse = $networkFirewallPoliciesClient->removeRule($firewallPolicy, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $networkFirewallPoliciesClient->removeRule($firewallPolicy, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $networkFirewallPoliciesClient->resumeOperation($operationName, 'removeRule'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $networkFirewallPoliciesClient->close(); - * } - * ``` - * - * @param string $firewallPolicy Name of the firewall policy to update. - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type int $priority - * The priority of the rule to remove from the firewall policy. - * @type string $requestId - * 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. 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 removeRule($firewallPolicy, $project, array $optionalArgs = []) - { - $request = new RemoveRuleNetworkFirewallPolicyRequest(); - $requestParamHeaders = []; - $request->setFirewallPolicy($firewallPolicy); - $request->setProject($project); - $requestParamHeaders['firewall_policy'] = $firewallPolicy; - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['priority'])) { - $request->setPriority($optionalArgs['priority']); - } - - 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('RemoveRule', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Sets the access control policy on the specified resource. Replaces any existing policy. - * - * Sample code: - * ``` - * $networkFirewallPoliciesClient = new NetworkFirewallPoliciesClient(); - * try { - * $globalSetPolicyRequestResource = new GlobalSetPolicyRequest(); - * $project = 'project'; - * $resource = 'resource'; - * $response = $networkFirewallPoliciesClient->setIamPolicy($globalSetPolicyRequestResource, $project, $resource); - * } finally { - * $networkFirewallPoliciesClient->close(); - * } - * ``` - * - * @param GlobalSetPolicyRequest $globalSetPolicyRequestResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $resource Name or id of the resource for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function setIamPolicy($globalSetPolicyRequestResource, $project, $resource, array $optionalArgs = []) - { - $request = new SetIamPolicyNetworkFirewallPolicyRequest(); - $requestParamHeaders = []; - $request->setGlobalSetPolicyRequestResource($globalSetPolicyRequestResource); - $request->setProject($project); - $request->setResource($resource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['resource'] = $resource; - $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 resource. - * - * Sample code: - * ``` - * $networkFirewallPoliciesClient = new NetworkFirewallPoliciesClient(); - * try { - * $project = 'project'; - * $resource = 'resource'; - * $testPermissionsRequestResource = new TestPermissionsRequest(); - * $response = $networkFirewallPoliciesClient->testIamPermissions($project, $resource, $testPermissionsRequestResource); - * } finally { - * $networkFirewallPoliciesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $resource Name or id of the resource for this request. - * @param TestPermissionsRequest $testPermissionsRequestResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\TestPermissionsResponse - * - * @throws ApiException if the remote call fails - */ - public function testIamPermissions($project, $resource, $testPermissionsRequestResource, array $optionalArgs = []) - { - $request = new TestIamPermissionsNetworkFirewallPolicyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setResource($resource); - $request->setTestPermissionsRequestResource($testPermissionsRequestResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['resource'] = $resource; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('TestIamPermissions', TestPermissionsResponse::class, $optionalArgs, $request)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/NetworkProfilesGapicClient.php b/Compute/src/V1/Gapic/NetworkProfilesGapicClient.php deleted file mode 100644 index 47106f0e3eed..000000000000 --- a/Compute/src/V1/Gapic/NetworkProfilesGapicClient.php +++ /dev/null @@ -1,290 +0,0 @@ -get($networkProfile, $project); - * } finally { - * $networkProfilesClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\NetworkProfilesClient}. - */ -class NetworkProfilesGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.NetworkProfiles'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute.readonly', - 'https://www.googleapis.com/auth/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/network_profiles_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/network_profiles_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/network_profiles_rest_client_config.php', - ], - ], - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * 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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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); - } - - /** - * Returns the specified network profile. - * - * Sample code: - * ``` - * $networkProfilesClient = new NetworkProfilesClient(); - * try { - * $networkProfile = 'network_profile'; - * $project = 'project'; - * $response = $networkProfilesClient->get($networkProfile, $project); - * } finally { - * $networkProfilesClient->close(); - * } - * ``` - * - * @param string $networkProfile Name of the network profile to return. - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\NetworkProfile - * - * @throws ApiException if the remote call fails - */ - public function get($networkProfile, $project, array $optionalArgs = []) - { - $request = new GetNetworkProfileRequest(); - $requestParamHeaders = []; - $request->setNetworkProfile($networkProfile); - $request->setProject($project); - $requestParamHeaders['network_profile'] = $networkProfile; - $requestParamHeaders['project'] = $project; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', NetworkProfile::class, $optionalArgs, $request)->wait(); - } - - /** - * Retrieves a list of network profiles available to the specified project. - * - * Sample code: - * ``` - * $networkProfilesClient = new NetworkProfilesClient(); - * try { - * $project = 'project'; - * $response = $networkProfilesClient->list($project); - * } finally { - * $networkProfilesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @type string $pageToken - * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. - * @type bool $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\NetworkProfilesListResponse - * - * @throws ApiException if the remote call fails - */ - public function list($project, array $optionalArgs = []) - { - $request = new ListNetworkProfilesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('List', NetworkProfilesListResponse::class, $optionalArgs, $request)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/NetworksGapicClient.php b/Compute/src/V1/Gapic/NetworksGapicClient.php deleted file mode 100644 index a09fea636358..000000000000 --- a/Compute/src/V1/Gapic/NetworksGapicClient.php +++ /dev/null @@ -1,1141 +0,0 @@ -addPeering($network, $networksAddPeeringRequestResource, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $networksClient->addPeering($network, $networksAddPeeringRequestResource, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $networksClient->resumeOperation($operationName, 'addPeering'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $networksClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\NetworksClient}. - */ -class NetworksGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.Networks'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/networks_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/networks_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/networks_rest_client_config.php', - ], - ], - 'operationsClientClass' => GlobalOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an GlobalOperationsClient object with the same endpoint as $this. - * - * @return GlobalOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetGlobalOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteGlobalOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method for the - * supported options. - * @type callable $clientCertSource - * A callable which returns the client cert as a string. This can be used to - * provide a certificate and private key to the transport layer for mTLS. - * } - * - * @throws ValidationException - */ - public function __construct(array $options = []) - { - $clientOptions = $this->buildClientOptions($options); - $this->setClientOptions($clientOptions); - $this->operationsClient = $this->createOperationsClient($clientOptions); - } - - /** - * Adds a peering to the specified network. - * - * Sample code: - * ``` - * $networksClient = new NetworksClient(); - * try { - * $network = 'network'; - * $networksAddPeeringRequestResource = new NetworksAddPeeringRequest(); - * $project = 'project'; - * $operationResponse = $networksClient->addPeering($network, $networksAddPeeringRequestResource, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $networksClient->addPeering($network, $networksAddPeeringRequestResource, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $networksClient->resumeOperation($operationName, 'addPeering'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $networksClient->close(); - * } - * ``` - * - * @param string $network Name of the network resource to add peering to. - * @param NetworksAddPeeringRequest $networksAddPeeringRequestResource The body resource for this request - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 addPeering($network, $networksAddPeeringRequestResource, $project, array $optionalArgs = []) - { - $request = new AddPeeringNetworkRequest(); - $requestParamHeaders = []; - $request->setNetwork($network); - $request->setNetworksAddPeeringRequestResource($networksAddPeeringRequestResource); - $request->setProject($project); - $requestParamHeaders['network'] = $network; - $requestParamHeaders['project'] = $project; - 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('AddPeering', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Deletes the specified network. - * - * Sample code: - * ``` - * $networksClient = new NetworksClient(); - * try { - * $network = 'network'; - * $project = 'project'; - * $operationResponse = $networksClient->delete($network, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $networksClient->delete($network, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $networksClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $networksClient->close(); - * } - * ``` - * - * @param string $network Name of the network to delete. - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($network, $project, array $optionalArgs = []) - { - $request = new DeleteNetworkRequest(); - $requestParamHeaders = []; - $request->setNetwork($network); - $request->setProject($project); - $requestParamHeaders['network'] = $network; - $requestParamHeaders['project'] = $project; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns the specified network. - * - * Sample code: - * ``` - * $networksClient = new NetworksClient(); - * try { - * $network = 'network'; - * $project = 'project'; - * $response = $networksClient->get($network, $project); - * } finally { - * $networksClient->close(); - * } - * ``` - * - * @param string $network Name of the network to return. - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Network - * - * @throws ApiException if the remote call fails - */ - public function get($network, $project, array $optionalArgs = []) - { - $request = new GetNetworkRequest(); - $requestParamHeaders = []; - $request->setNetwork($network); - $request->setProject($project); - $requestParamHeaders['network'] = $network; - $requestParamHeaders['project'] = $project; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', Network::class, $optionalArgs, $request)->wait(); - } - - /** - * Returns the effective firewalls on a given network. - * - * Sample code: - * ``` - * $networksClient = new NetworksClient(); - * try { - * $network = 'network'; - * $project = 'project'; - * $response = $networksClient->getEffectiveFirewalls($network, $project); - * } finally { - * $networksClient->close(); - * } - * ``` - * - * @param string $network Name of the network for this request. - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\NetworksGetEffectiveFirewallsResponse - * - * @throws ApiException if the remote call fails - */ - public function getEffectiveFirewalls($network, $project, array $optionalArgs = []) - { - $request = new GetEffectiveFirewallsNetworkRequest(); - $requestParamHeaders = []; - $request->setNetwork($network); - $request->setProject($project); - $requestParamHeaders['network'] = $network; - $requestParamHeaders['project'] = $project; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetEffectiveFirewalls', NetworksGetEffectiveFirewallsResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates a network in the specified project using the data included in the request. - * - * Sample code: - * ``` - * $networksClient = new NetworksClient(); - * try { - * $networkResource = new Network(); - * $project = 'project'; - * $operationResponse = $networksClient->insert($networkResource, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $networksClient->insert($networkResource, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $networksClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $networksClient->close(); - * } - * ``` - * - * @param Network $networkResource The body resource for this request - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 insert($networkResource, $project, array $optionalArgs = []) - { - $request = new InsertNetworkRequest(); - $requestParamHeaders = []; - $request->setNetworkResource($networkResource); - $request->setProject($project); - $requestParamHeaders['project'] = $project; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Retrieves the list of networks available to the specified project. - * - * Sample code: - * ``` - * $networksClient = new NetworksClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $networksClient->list($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $networksClient->list($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $networksClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, array $optionalArgs = []) - { - $request = new ListNetworksRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, NetworkList::class, $request); - } - - /** - * Lists the peering routes exchanged over peering connection. - * - * Sample code: - * ``` - * $networksClient = new NetworksClient(); - * try { - * $network = 'network'; - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $networksClient->listPeeringRoutes($network, $project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $networksClient->listPeeringRoutes($network, $project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $networksClient->close(); - * } - * ``` - * - * @param string $network Name of the network for this request. - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $direction - * The direction of the exchanged routes. - * Check the Direction enum for the list of possible values. - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $peeringName - * The response will show routes exchanged over the given peering connection. - * @type string $region - * The region of the request. The response will include all subnet routes, static routes and dynamic routes in the region. - * @type bool $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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($network, $project, array $optionalArgs = []) - { - $request = new ListPeeringRoutesNetworksRequest(); - $requestParamHeaders = []; - $request->setNetwork($network); - $request->setProject($project); - $requestParamHeaders['network'] = $network; - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['direction'])) { - $request->setDirection($optionalArgs['direction']); - } - - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['peeringName'])) { - $request->setPeeringName($optionalArgs['peeringName']); - } - - if (isset($optionalArgs['region'])) { - $request->setRegion($optionalArgs['region']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('ListPeeringRoutes', $optionalArgs, ExchangedPeeringRoutesList::class, $request); - } - - /** - * Patches the specified network with the data included in the request. Only routingConfig can be modified. - * - * Sample code: - * ``` - * $networksClient = new NetworksClient(); - * try { - * $network = 'network'; - * $networkResource = new Network(); - * $project = 'project'; - * $operationResponse = $networksClient->patch($network, $networkResource, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $networksClient->patch($network, $networkResource, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $networksClient->resumeOperation($operationName, 'patch'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $networksClient->close(); - * } - * ``` - * - * @param string $network Name of the network to update. - * @param Network $networkResource The body resource for this request - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 patch($network, $networkResource, $project, array $optionalArgs = []) - { - $request = new PatchNetworkRequest(); - $requestParamHeaders = []; - $request->setNetwork($network); - $request->setNetworkResource($networkResource); - $request->setProject($project); - $requestParamHeaders['network'] = $network; - $requestParamHeaders['project'] = $project; - 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('Patch', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Removes a peering from the specified network. - * - * Sample code: - * ``` - * $networksClient = new NetworksClient(); - * try { - * $network = 'network'; - * $networksRemovePeeringRequestResource = new NetworksRemovePeeringRequest(); - * $project = 'project'; - * $operationResponse = $networksClient->removePeering($network, $networksRemovePeeringRequestResource, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $networksClient->removePeering($network, $networksRemovePeeringRequestResource, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $networksClient->resumeOperation($operationName, 'removePeering'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $networksClient->close(); - * } - * ``` - * - * @param string $network Name of the network resource to remove peering from. - * @param NetworksRemovePeeringRequest $networksRemovePeeringRequestResource The body resource for this request - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 removePeering($network, $networksRemovePeeringRequestResource, $project, array $optionalArgs = []) - { - $request = new RemovePeeringNetworkRequest(); - $requestParamHeaders = []; - $request->setNetwork($network); - $request->setNetworksRemovePeeringRequestResource($networksRemovePeeringRequestResource); - $request->setProject($project); - $requestParamHeaders['network'] = $network; - $requestParamHeaders['project'] = $project; - 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('RemovePeering', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Requests to remove a peering from the specified network. Applicable only for PeeringConnection with update_strategy=CONSENSUS. - * - * Sample code: - * ``` - * $networksClient = new NetworksClient(); - * try { - * $network = 'network'; - * $networksRequestRemovePeeringRequestResource = new NetworksRequestRemovePeeringRequest(); - * $project = 'project'; - * $operationResponse = $networksClient->requestRemovePeering($network, $networksRequestRemovePeeringRequestResource, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $networksClient->requestRemovePeering($network, $networksRequestRemovePeeringRequestResource, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $networksClient->resumeOperation($operationName, 'requestRemovePeering'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $networksClient->close(); - * } - * ``` - * - * @param string $network Name of the network resource to remove peering from. - * @param NetworksRequestRemovePeeringRequest $networksRequestRemovePeeringRequestResource The body resource for this request - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 requestRemovePeering($network, $networksRequestRemovePeeringRequestResource, $project, array $optionalArgs = []) - { - $request = new RequestRemovePeeringNetworkRequest(); - $requestParamHeaders = []; - $request->setNetwork($network); - $request->setNetworksRequestRemovePeeringRequestResource($networksRequestRemovePeeringRequestResource); - $request->setProject($project); - $requestParamHeaders['network'] = $network; - $requestParamHeaders['project'] = $project; - 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('RequestRemovePeering', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Switches the network mode from auto subnet mode to custom subnet mode. - * - * Sample code: - * ``` - * $networksClient = new NetworksClient(); - * try { - * $network = 'network'; - * $project = 'project'; - * $operationResponse = $networksClient->switchToCustomMode($network, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $networksClient->switchToCustomMode($network, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $networksClient->resumeOperation($operationName, 'switchToCustomMode'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $networksClient->close(); - * } - * ``` - * - * @param string $network Name of the network to be updated. - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 switchToCustomMode($network, $project, array $optionalArgs = []) - { - $request = new SwitchToCustomModeNetworkRequest(); - $requestParamHeaders = []; - $request->setNetwork($network); - $request->setProject($project); - $requestParamHeaders['network'] = $network; - $requestParamHeaders['project'] = $project; - 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('SwitchToCustomMode', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Updates the specified network peering with the data included in the request. You can only modify the NetworkPeering.export_custom_routes field and the NetworkPeering.import_custom_routes field. - * - * Sample code: - * ``` - * $networksClient = new NetworksClient(); - * try { - * $network = 'network'; - * $networksUpdatePeeringRequestResource = new NetworksUpdatePeeringRequest(); - * $project = 'project'; - * $operationResponse = $networksClient->updatePeering($network, $networksUpdatePeeringRequestResource, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $networksClient->updatePeering($network, $networksUpdatePeeringRequestResource, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $networksClient->resumeOperation($operationName, 'updatePeering'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $networksClient->close(); - * } - * ``` - * - * @param string $network Name of the network resource which the updated peering is belonging to. - * @param NetworksUpdatePeeringRequest $networksUpdatePeeringRequestResource The body resource for this request - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 updatePeering($network, $networksUpdatePeeringRequestResource, $project, array $optionalArgs = []) - { - $request = new UpdatePeeringNetworkRequest(); - $requestParamHeaders = []; - $request->setNetwork($network); - $request->setNetworksUpdatePeeringRequestResource($networksUpdatePeeringRequestResource); - $request->setProject($project); - $requestParamHeaders['network'] = $network; - $requestParamHeaders['project'] = $project; - 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('UpdatePeering', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/NodeGroupsGapicClient.php b/Compute/src/V1/Gapic/NodeGroupsGapicClient.php deleted file mode 100644 index 15c895434dab..000000000000 --- a/Compute/src/V1/Gapic/NodeGroupsGapicClient.php +++ /dev/null @@ -1,1388 +0,0 @@ -addNodes($nodeGroup, $nodeGroupsAddNodesRequestResource, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $nodeGroupsClient->addNodes($nodeGroup, $nodeGroupsAddNodesRequestResource, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $nodeGroupsClient->resumeOperation($operationName, 'addNodes'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $nodeGroupsClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\NodeGroupsClient}. - */ -class NodeGroupsGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.NodeGroups'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/node_groups_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/node_groups_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/node_groups_rest_client_config.php', - ], - ], - 'operationsClientClass' => ZoneOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an ZoneOperationsClient object with the same endpoint as $this. - * - * @return ZoneOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getZone', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetZoneOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteZoneOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method for the - * supported options. - * @type callable $clientCertSource - * A callable which returns the client cert as a string. This can be used to - * provide a certificate and private key to the transport layer for mTLS. - * } - * - * @throws ValidationException - */ - public function __construct(array $options = []) - { - $clientOptions = $this->buildClientOptions($options); - $this->setClientOptions($clientOptions); - $this->operationsClient = $this->createOperationsClient($clientOptions); - } - - /** - * Adds specified number of nodes to the node group. - * - * Sample code: - * ``` - * $nodeGroupsClient = new NodeGroupsClient(); - * try { - * $nodeGroup = 'node_group'; - * $nodeGroupsAddNodesRequestResource = new NodeGroupsAddNodesRequest(); - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $nodeGroupsClient->addNodes($nodeGroup, $nodeGroupsAddNodesRequestResource, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $nodeGroupsClient->addNodes($nodeGroup, $nodeGroupsAddNodesRequestResource, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $nodeGroupsClient->resumeOperation($operationName, 'addNodes'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $nodeGroupsClient->close(); - * } - * ``` - * - * @param string $nodeGroup Name of the NodeGroup resource. - * @param NodeGroupsAddNodesRequest $nodeGroupsAddNodesRequestResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 addNodes($nodeGroup, $nodeGroupsAddNodesRequestResource, $project, $zone, array $optionalArgs = []) - { - $request = new AddNodesNodeGroupRequest(); - $requestParamHeaders = []; - $request->setNodeGroup($nodeGroup); - $request->setNodeGroupsAddNodesRequestResource($nodeGroupsAddNodesRequestResource); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['node_group'] = $nodeGroup; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('AddNodes', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Retrieves an aggregated list of node groups. Note: use nodeGroups.listNodes for more details about each group. To prevent failure, Google recommends that you set the `returnPartialSuccess` parameter to `true`. - * - * Sample code: - * ``` - * $nodeGroupsClient = new NodeGroupsClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $nodeGroupsClient->aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $nodeGroupsClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $nodeGroupsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type bool $includeAllScopes - * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type int $serviceProjectNumber - * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable 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 aggregatedList($project, array $optionalArgs = []) - { - $request = new AggregatedListNodeGroupsRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['includeAllScopes'])) { - $request->setIncludeAllScopes($optionalArgs['includeAllScopes']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - if (isset($optionalArgs['serviceProjectNumber'])) { - $request->setServiceProjectNumber($optionalArgs['serviceProjectNumber']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('AggregatedList', $optionalArgs, NodeGroupAggregatedList::class, $request); - } - - /** - * Deletes the specified NodeGroup resource. - * - * Sample code: - * ``` - * $nodeGroupsClient = new NodeGroupsClient(); - * try { - * $nodeGroup = 'node_group'; - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $nodeGroupsClient->delete($nodeGroup, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $nodeGroupsClient->delete($nodeGroup, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $nodeGroupsClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $nodeGroupsClient->close(); - * } - * ``` - * - * @param string $nodeGroup Name of the NodeGroup resource to delete. - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($nodeGroup, $project, $zone, array $optionalArgs = []) - { - $request = new DeleteNodeGroupRequest(); - $requestParamHeaders = []; - $request->setNodeGroup($nodeGroup); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['node_group'] = $nodeGroup; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Deletes specified nodes from the node group. - * - * Sample code: - * ``` - * $nodeGroupsClient = new NodeGroupsClient(); - * try { - * $nodeGroup = 'node_group'; - * $nodeGroupsDeleteNodesRequestResource = new NodeGroupsDeleteNodesRequest(); - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $nodeGroupsClient->deleteNodes($nodeGroup, $nodeGroupsDeleteNodesRequestResource, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $nodeGroupsClient->deleteNodes($nodeGroup, $nodeGroupsDeleteNodesRequestResource, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $nodeGroupsClient->resumeOperation($operationName, 'deleteNodes'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $nodeGroupsClient->close(); - * } - * ``` - * - * @param string $nodeGroup Name of the NodeGroup resource whose nodes will be deleted. - * @param NodeGroupsDeleteNodesRequest $nodeGroupsDeleteNodesRequestResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 deleteNodes($nodeGroup, $nodeGroupsDeleteNodesRequestResource, $project, $zone, array $optionalArgs = []) - { - $request = new DeleteNodesNodeGroupRequest(); - $requestParamHeaders = []; - $request->setNodeGroup($nodeGroup); - $request->setNodeGroupsDeleteNodesRequestResource($nodeGroupsDeleteNodesRequestResource); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['node_group'] = $nodeGroup; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('DeleteNodes', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns the specified NodeGroup. Get a list of available NodeGroups by making a list() request. Note: the "nodes" field should not be used. Use nodeGroups.listNodes instead. - * - * Sample code: - * ``` - * $nodeGroupsClient = new NodeGroupsClient(); - * try { - * $nodeGroup = 'node_group'; - * $project = 'project'; - * $zone = 'zone'; - * $response = $nodeGroupsClient->get($nodeGroup, $project, $zone); - * } finally { - * $nodeGroupsClient->close(); - * } - * ``` - * - * @param string $nodeGroup Name of the node group to return. - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\NodeGroup - * - * @throws ApiException if the remote call fails - */ - public function get($nodeGroup, $project, $zone, array $optionalArgs = []) - { - $request = new GetNodeGroupRequest(); - $requestParamHeaders = []; - $request->setNodeGroup($nodeGroup); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['node_group'] = $nodeGroup; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', NodeGroup::class, $optionalArgs, $request)->wait(); - } - - /** - * Gets the access control policy for a resource. May be empty if no such policy or resource exists. - * - * Sample code: - * ``` - * $nodeGroupsClient = new NodeGroupsClient(); - * try { - * $project = 'project'; - * $resource = 'resource'; - * $zone = 'zone'; - * $response = $nodeGroupsClient->getIamPolicy($project, $resource, $zone); - * } finally { - * $nodeGroupsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $resource Name or id of the resource for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type int $optionsRequestedPolicyVersion - * Requested IAM Policy version. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function getIamPolicy($project, $resource, $zone, array $optionalArgs = []) - { - $request = new GetIamPolicyNodeGroupRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setResource($resource); - $request->setZone($zone); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['resource'] = $resource; - $requestParamHeaders['zone'] = $zone; - if (isset($optionalArgs['optionsRequestedPolicyVersion'])) { - $request->setOptionsRequestedPolicyVersion($optionalArgs['optionsRequestedPolicyVersion']); - } - - $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(); - } - - /** - * Creates a NodeGroup resource in the specified project using the data included in the request. - * - * Sample code: - * ``` - * $nodeGroupsClient = new NodeGroupsClient(); - * try { - * $initialNodeCount = 0; - * $nodeGroupResource = new NodeGroup(); - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $nodeGroupsClient->insert($initialNodeCount, $nodeGroupResource, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $nodeGroupsClient->insert($initialNodeCount, $nodeGroupResource, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $nodeGroupsClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $nodeGroupsClient->close(); - * } - * ``` - * - * @param int $initialNodeCount Initial count of nodes in the node group. - * @param NodeGroup $nodeGroupResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 insert($initialNodeCount, $nodeGroupResource, $project, $zone, array $optionalArgs = []) - { - $request = new InsertNodeGroupRequest(); - $requestParamHeaders = []; - $request->setInitialNodeCount($initialNodeCount); - $request->setNodeGroupResource($nodeGroupResource); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Retrieves a list of node groups available to the specified project. Note: use nodeGroups.listNodes for more details about each group. - * - * Sample code: - * ``` - * $nodeGroupsClient = new NodeGroupsClient(); - * try { - * $project = 'project'; - * $zone = 'zone'; - * // Iterate over pages of elements - * $pagedResponse = $nodeGroupsClient->list($project, $zone); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $nodeGroupsClient->list($project, $zone); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $nodeGroupsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, $zone, array $optionalArgs = []) - { - $request = new ListNodeGroupsRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, NodeGroupList::class, $request); - } - - /** - * Lists nodes in the node group. - * - * Sample code: - * ``` - * $nodeGroupsClient = new NodeGroupsClient(); - * try { - * $nodeGroup = 'node_group'; - * $project = 'project'; - * $zone = 'zone'; - * // Iterate over pages of elements - * $pagedResponse = $nodeGroupsClient->listNodes($nodeGroup, $project, $zone); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $nodeGroupsClient->listNodes($nodeGroup, $project, $zone); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $nodeGroupsClient->close(); - * } - * ``` - * - * @param string $nodeGroup Name of the NodeGroup resource whose nodes you want to list. - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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($nodeGroup, $project, $zone, array $optionalArgs = []) - { - $request = new ListNodesNodeGroupsRequest(); - $requestParamHeaders = []; - $request->setNodeGroup($nodeGroup); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['node_group'] = $nodeGroup; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('ListNodes', $optionalArgs, NodeGroupsListNodes::class, $request); - } - - /** - * Updates the specified node group. - * - * Sample code: - * ``` - * $nodeGroupsClient = new NodeGroupsClient(); - * try { - * $nodeGroup = 'node_group'; - * $nodeGroupResource = new NodeGroup(); - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $nodeGroupsClient->patch($nodeGroup, $nodeGroupResource, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $nodeGroupsClient->patch($nodeGroup, $nodeGroupResource, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $nodeGroupsClient->resumeOperation($operationName, 'patch'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $nodeGroupsClient->close(); - * } - * ``` - * - * @param string $nodeGroup Name of the NodeGroup resource to update. - * @param NodeGroup $nodeGroupResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 patch($nodeGroup, $nodeGroupResource, $project, $zone, array $optionalArgs = []) - { - $request = new PatchNodeGroupRequest(); - $requestParamHeaders = []; - $request->setNodeGroup($nodeGroup); - $request->setNodeGroupResource($nodeGroupResource); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['node_group'] = $nodeGroup; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('Patch', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Perform maintenance on a subset of nodes in the node group. - * - * Sample code: - * ``` - * $nodeGroupsClient = new NodeGroupsClient(); - * try { - * $nodeGroup = 'node_group'; - * $nodeGroupsPerformMaintenanceRequestResource = new NodeGroupsPerformMaintenanceRequest(); - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $nodeGroupsClient->performMaintenance($nodeGroup, $nodeGroupsPerformMaintenanceRequestResource, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $nodeGroupsClient->performMaintenance($nodeGroup, $nodeGroupsPerformMaintenanceRequestResource, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $nodeGroupsClient->resumeOperation($operationName, 'performMaintenance'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $nodeGroupsClient->close(); - * } - * ``` - * - * @param string $nodeGroup Name of the node group scoping this request. - * @param NodeGroupsPerformMaintenanceRequest $nodeGroupsPerformMaintenanceRequestResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 performMaintenance($nodeGroup, $nodeGroupsPerformMaintenanceRequestResource, $project, $zone, array $optionalArgs = []) - { - $request = new PerformMaintenanceNodeGroupRequest(); - $requestParamHeaders = []; - $request->setNodeGroup($nodeGroup); - $request->setNodeGroupsPerformMaintenanceRequestResource($nodeGroupsPerformMaintenanceRequestResource); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['node_group'] = $nodeGroup; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('PerformMaintenance', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Sets the access control policy on the specified resource. Replaces any existing policy. - * - * Sample code: - * ``` - * $nodeGroupsClient = new NodeGroupsClient(); - * try { - * $project = 'project'; - * $resource = 'resource'; - * $zone = 'zone'; - * $zoneSetPolicyRequestResource = new ZoneSetPolicyRequest(); - * $response = $nodeGroupsClient->setIamPolicy($project, $resource, $zone, $zoneSetPolicyRequestResource); - * } finally { - * $nodeGroupsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $resource Name or id of the resource for this request. - * @param string $zone The name of the zone for this request. - * @param ZoneSetPolicyRequest $zoneSetPolicyRequestResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function setIamPolicy($project, $resource, $zone, $zoneSetPolicyRequestResource, array $optionalArgs = []) - { - $request = new SetIamPolicyNodeGroupRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setResource($resource); - $request->setZone($zone); - $request->setZoneSetPolicyRequestResource($zoneSetPolicyRequestResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['resource'] = $resource; - $requestParamHeaders['zone'] = $zone; - $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(); - } - - /** - * Updates the node template of the node group. - * - * Sample code: - * ``` - * $nodeGroupsClient = new NodeGroupsClient(); - * try { - * $nodeGroup = 'node_group'; - * $nodeGroupsSetNodeTemplateRequestResource = new NodeGroupsSetNodeTemplateRequest(); - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $nodeGroupsClient->setNodeTemplate($nodeGroup, $nodeGroupsSetNodeTemplateRequestResource, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $nodeGroupsClient->setNodeTemplate($nodeGroup, $nodeGroupsSetNodeTemplateRequestResource, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $nodeGroupsClient->resumeOperation($operationName, 'setNodeTemplate'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $nodeGroupsClient->close(); - * } - * ``` - * - * @param string $nodeGroup Name of the NodeGroup resource to update. - * @param NodeGroupsSetNodeTemplateRequest $nodeGroupsSetNodeTemplateRequestResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 setNodeTemplate($nodeGroup, $nodeGroupsSetNodeTemplateRequestResource, $project, $zone, array $optionalArgs = []) - { - $request = new SetNodeTemplateNodeGroupRequest(); - $requestParamHeaders = []; - $request->setNodeGroup($nodeGroup); - $request->setNodeGroupsSetNodeTemplateRequestResource($nodeGroupsSetNodeTemplateRequestResource); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['node_group'] = $nodeGroup; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('SetNodeTemplate', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Simulates maintenance event on specified nodes from the node group. - * - * Sample code: - * ``` - * $nodeGroupsClient = new NodeGroupsClient(); - * try { - * $nodeGroup = 'node_group'; - * $nodeGroupsSimulateMaintenanceEventRequestResource = new NodeGroupsSimulateMaintenanceEventRequest(); - * $project = 'project'; - * $zone = 'zone'; - * $operationResponse = $nodeGroupsClient->simulateMaintenanceEvent($nodeGroup, $nodeGroupsSimulateMaintenanceEventRequestResource, $project, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $nodeGroupsClient->simulateMaintenanceEvent($nodeGroup, $nodeGroupsSimulateMaintenanceEventRequestResource, $project, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $nodeGroupsClient->resumeOperation($operationName, 'simulateMaintenanceEvent'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $nodeGroupsClient->close(); - * } - * ``` - * - * @param string $nodeGroup Name of the NodeGroup resource whose nodes will go under maintenance simulation. - * @param NodeGroupsSimulateMaintenanceEventRequest $nodeGroupsSimulateMaintenanceEventRequestResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 simulateMaintenanceEvent($nodeGroup, $nodeGroupsSimulateMaintenanceEventRequestResource, $project, $zone, array $optionalArgs = []) - { - $request = new SimulateMaintenanceEventNodeGroupRequest(); - $requestParamHeaders = []; - $request->setNodeGroup($nodeGroup); - $request->setNodeGroupsSimulateMaintenanceEventRequestResource($nodeGroupsSimulateMaintenanceEventRequestResource); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['node_group'] = $nodeGroup; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('SimulateMaintenanceEvent', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns permissions that a caller has on the specified resource. - * - * Sample code: - * ``` - * $nodeGroupsClient = new NodeGroupsClient(); - * try { - * $project = 'project'; - * $resource = 'resource'; - * $testPermissionsRequestResource = new TestPermissionsRequest(); - * $zone = 'zone'; - * $response = $nodeGroupsClient->testIamPermissions($project, $resource, $testPermissionsRequestResource, $zone); - * } finally { - * $nodeGroupsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $resource Name or id of the resource for this request. - * @param TestPermissionsRequest $testPermissionsRequestResource The body resource for this request - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\TestPermissionsResponse - * - * @throws ApiException if the remote call fails - */ - public function testIamPermissions($project, $resource, $testPermissionsRequestResource, $zone, array $optionalArgs = []) - { - $request = new TestIamPermissionsNodeGroupRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setResource($resource); - $request->setTestPermissionsRequestResource($testPermissionsRequestResource); - $request->setZone($zone); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['resource'] = $resource; - $requestParamHeaders['zone'] = $zone; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('TestIamPermissions', TestPermissionsResponse::class, $optionalArgs, $request)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/NodeTemplatesGapicClient.php b/Compute/src/V1/Gapic/NodeTemplatesGapicClient.php deleted file mode 100644 index ca0c4237762e..000000000000 --- a/Compute/src/V1/Gapic/NodeTemplatesGapicClient.php +++ /dev/null @@ -1,792 +0,0 @@ -aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $nodeTemplatesClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $nodeTemplatesClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\NodeTemplatesClient}. - */ -class NodeTemplatesGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.NodeTemplates'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/node_templates_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/node_templates_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/node_templates_rest_client_config.php', - ], - ], - 'operationsClientClass' => RegionOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an RegionOperationsClient object with the same endpoint as $this. - * - * @return RegionOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetRegionOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteRegionOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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); - } - - /** - * Retrieves an aggregated list of node templates. To prevent failure, Google recommends that you set the `returnPartialSuccess` parameter to `true`. - * - * Sample code: - * ``` - * $nodeTemplatesClient = new NodeTemplatesClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $nodeTemplatesClient->aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $nodeTemplatesClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $nodeTemplatesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type bool $includeAllScopes - * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type int $serviceProjectNumber - * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable 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 aggregatedList($project, array $optionalArgs = []) - { - $request = new AggregatedListNodeTemplatesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['includeAllScopes'])) { - $request->setIncludeAllScopes($optionalArgs['includeAllScopes']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - if (isset($optionalArgs['serviceProjectNumber'])) { - $request->setServiceProjectNumber($optionalArgs['serviceProjectNumber']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('AggregatedList', $optionalArgs, NodeTemplateAggregatedList::class, $request); - } - - /** - * Deletes the specified NodeTemplate resource. - * - * Sample code: - * ``` - * $nodeTemplatesClient = new NodeTemplatesClient(); - * try { - * $nodeTemplate = 'node_template'; - * $project = 'project'; - * $region = 'region'; - * $operationResponse = $nodeTemplatesClient->delete($nodeTemplate, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $nodeTemplatesClient->delete($nodeTemplate, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $nodeTemplatesClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $nodeTemplatesClient->close(); - * } - * ``` - * - * @param string $nodeTemplate Name of the NodeTemplate resource to delete. - * @param string $project Project ID for this request. - * @param string $region The name of the region for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($nodeTemplate, $project, $region, array $optionalArgs = []) - { - $request = new DeleteNodeTemplateRequest(); - $requestParamHeaders = []; - $request->setNodeTemplate($nodeTemplate); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['node_template'] = $nodeTemplate; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns the specified node template. - * - * Sample code: - * ``` - * $nodeTemplatesClient = new NodeTemplatesClient(); - * try { - * $nodeTemplate = 'node_template'; - * $project = 'project'; - * $region = 'region'; - * $response = $nodeTemplatesClient->get($nodeTemplate, $project, $region); - * } finally { - * $nodeTemplatesClient->close(); - * } - * ``` - * - * @param string $nodeTemplate Name of the node template to return. - * @param string $project Project ID for this request. - * @param string $region The name of the region for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\NodeTemplate - * - * @throws ApiException if the remote call fails - */ - public function get($nodeTemplate, $project, $region, array $optionalArgs = []) - { - $request = new GetNodeTemplateRequest(); - $requestParamHeaders = []; - $request->setNodeTemplate($nodeTemplate); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['node_template'] = $nodeTemplate; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', NodeTemplate::class, $optionalArgs, $request)->wait(); - } - - /** - * Gets the access control policy for a resource. May be empty if no such policy or resource exists. - * - * Sample code: - * ``` - * $nodeTemplatesClient = new NodeTemplatesClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $resource = 'resource'; - * $response = $nodeTemplatesClient->getIamPolicy($project, $region, $resource); - * } finally { - * $nodeTemplatesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region The name of the region for this request. - * @param string $resource Name or id of the resource for this request. - * @param array $optionalArgs { - * Optional. - * - * @type int $optionsRequestedPolicyVersion - * Requested IAM Policy version. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function getIamPolicy($project, $region, $resource, array $optionalArgs = []) - { - $request = new GetIamPolicyNodeTemplateRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setResource($resource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['optionsRequestedPolicyVersion'])) { - $request->setOptionsRequestedPolicyVersion($optionalArgs['optionsRequestedPolicyVersion']); - } - - $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(); - } - - /** - * Creates a NodeTemplate resource in the specified project using the data included in the request. - * - * Sample code: - * ``` - * $nodeTemplatesClient = new NodeTemplatesClient(); - * try { - * $nodeTemplateResource = new NodeTemplate(); - * $project = 'project'; - * $region = 'region'; - * $operationResponse = $nodeTemplatesClient->insert($nodeTemplateResource, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $nodeTemplatesClient->insert($nodeTemplateResource, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $nodeTemplatesClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $nodeTemplatesClient->close(); - * } - * ``` - * - * @param NodeTemplate $nodeTemplateResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $region The name of the region for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 insert($nodeTemplateResource, $project, $region, array $optionalArgs = []) - { - $request = new InsertNodeTemplateRequest(); - $requestParamHeaders = []; - $request->setNodeTemplateResource($nodeTemplateResource); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Retrieves a list of node templates available to the specified project. - * - * Sample code: - * ``` - * $nodeTemplatesClient = new NodeTemplatesClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * // Iterate over pages of elements - * $pagedResponse = $nodeTemplatesClient->list($project, $region); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $nodeTemplatesClient->list($project, $region); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $nodeTemplatesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region The name of the region for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, $region, array $optionalArgs = []) - { - $request = new ListNodeTemplatesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, NodeTemplateList::class, $request); - } - - /** - * Sets the access control policy on the specified resource. Replaces any existing policy. - * - * Sample code: - * ``` - * $nodeTemplatesClient = new NodeTemplatesClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $regionSetPolicyRequestResource = new RegionSetPolicyRequest(); - * $resource = 'resource'; - * $response = $nodeTemplatesClient->setIamPolicy($project, $region, $regionSetPolicyRequestResource, $resource); - * } finally { - * $nodeTemplatesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region The name of the region for this request. - * @param RegionSetPolicyRequest $regionSetPolicyRequestResource The body resource for this request - * @param string $resource Name or id of the resource for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function setIamPolicy($project, $region, $regionSetPolicyRequestResource, $resource, array $optionalArgs = []) - { - $request = new SetIamPolicyNodeTemplateRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setRegionSetPolicyRequestResource($regionSetPolicyRequestResource); - $request->setResource($resource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['resource'] = $resource; - $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 resource. - * - * Sample code: - * ``` - * $nodeTemplatesClient = new NodeTemplatesClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $resource = 'resource'; - * $testPermissionsRequestResource = new TestPermissionsRequest(); - * $response = $nodeTemplatesClient->testIamPermissions($project, $region, $resource, $testPermissionsRequestResource); - * } finally { - * $nodeTemplatesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region The name of the region for this request. - * @param string $resource Name or id of the resource for this request. - * @param TestPermissionsRequest $testPermissionsRequestResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\TestPermissionsResponse - * - * @throws ApiException if the remote call fails - */ - public function testIamPermissions($project, $region, $resource, $testPermissionsRequestResource, array $optionalArgs = []) - { - $request = new TestIamPermissionsNodeTemplateRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setResource($resource); - $request->setTestPermissionsRequestResource($testPermissionsRequestResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['resource'] = $resource; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('TestIamPermissions', TestPermissionsResponse::class, $optionalArgs, $request)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/NodeTypesGapicClient.php b/Compute/src/V1/Gapic/NodeTypesGapicClient.php deleted file mode 100644 index 9e4a351c42c0..000000000000 --- a/Compute/src/V1/Gapic/NodeTypesGapicClient.php +++ /dev/null @@ -1,422 +0,0 @@ -aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $nodeTypesClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $nodeTypesClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\NodeTypesClient}. - */ -class NodeTypesGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.NodeTypes'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute.readonly', - 'https://www.googleapis.com/auth/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/node_types_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/node_types_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/node_types_rest_client_config.php', - ], - ], - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * 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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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); - } - - /** - * Retrieves an aggregated list of node types. To prevent failure, Google recommends that you set the `returnPartialSuccess` parameter to `true`. - * - * Sample code: - * ``` - * $nodeTypesClient = new NodeTypesClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $nodeTypesClient->aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $nodeTypesClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $nodeTypesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type bool $includeAllScopes - * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type int $serviceProjectNumber - * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable 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 aggregatedList($project, array $optionalArgs = []) - { - $request = new AggregatedListNodeTypesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['includeAllScopes'])) { - $request->setIncludeAllScopes($optionalArgs['includeAllScopes']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - if (isset($optionalArgs['serviceProjectNumber'])) { - $request->setServiceProjectNumber($optionalArgs['serviceProjectNumber']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('AggregatedList', $optionalArgs, NodeTypeAggregatedList::class, $request); - } - - /** - * Returns the specified node type. - * - * Sample code: - * ``` - * $nodeTypesClient = new NodeTypesClient(); - * try { - * $nodeType = 'node_type'; - * $project = 'project'; - * $zone = 'zone'; - * $response = $nodeTypesClient->get($nodeType, $project, $zone); - * } finally { - * $nodeTypesClient->close(); - * } - * ``` - * - * @param string $nodeType Name of the node type to return. - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\NodeType - * - * @throws ApiException if the remote call fails - */ - public function get($nodeType, $project, $zone, array $optionalArgs = []) - { - $request = new GetNodeTypeRequest(); - $requestParamHeaders = []; - $request->setNodeType($nodeType); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['node_type'] = $nodeType; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', NodeType::class, $optionalArgs, $request)->wait(); - } - - /** - * Retrieves a list of node types available to the specified project. - * - * Sample code: - * ``` - * $nodeTypesClient = new NodeTypesClient(); - * try { - * $project = 'project'; - * $zone = 'zone'; - * // Iterate over pages of elements - * $pagedResponse = $nodeTypesClient->list($project, $zone); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $nodeTypesClient->list($project, $zone); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $nodeTypesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, $zone, array $optionalArgs = []) - { - $request = new ListNodeTypesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, NodeTypeList::class, $request); - } -} diff --git a/Compute/src/V1/Gapic/PacketMirroringsGapicClient.php b/Compute/src/V1/Gapic/PacketMirroringsGapicClient.php deleted file mode 100644 index dcee15e8049b..000000000000 --- a/Compute/src/V1/Gapic/PacketMirroringsGapicClient.php +++ /dev/null @@ -1,765 +0,0 @@ -aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $packetMirroringsClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $packetMirroringsClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\PacketMirroringsClient}. - */ -class PacketMirroringsGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.PacketMirrorings'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/packet_mirrorings_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/packet_mirrorings_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/packet_mirrorings_rest_client_config.php', - ], - ], - 'operationsClientClass' => RegionOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an RegionOperationsClient object with the same endpoint as $this. - * - * @return RegionOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetRegionOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteRegionOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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); - } - - /** - * Retrieves an aggregated list of packetMirrorings. To prevent failure, Google recommends that you set the `returnPartialSuccess` parameter to `true`. - * - * Sample code: - * ``` - * $packetMirroringsClient = new PacketMirroringsClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $packetMirroringsClient->aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $packetMirroringsClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $packetMirroringsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type bool $includeAllScopes - * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type int $serviceProjectNumber - * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable 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 aggregatedList($project, array $optionalArgs = []) - { - $request = new AggregatedListPacketMirroringsRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['includeAllScopes'])) { - $request->setIncludeAllScopes($optionalArgs['includeAllScopes']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - if (isset($optionalArgs['serviceProjectNumber'])) { - $request->setServiceProjectNumber($optionalArgs['serviceProjectNumber']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('AggregatedList', $optionalArgs, PacketMirroringAggregatedList::class, $request); - } - - /** - * Deletes the specified PacketMirroring resource. - * - * Sample code: - * ``` - * $packetMirroringsClient = new PacketMirroringsClient(); - * try { - * $packetMirroring = 'packet_mirroring'; - * $project = 'project'; - * $region = 'region'; - * $operationResponse = $packetMirroringsClient->delete($packetMirroring, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $packetMirroringsClient->delete($packetMirroring, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $packetMirroringsClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $packetMirroringsClient->close(); - * } - * ``` - * - * @param string $packetMirroring Name of the PacketMirroring resource to delete. - * @param string $project Project ID for this request. - * @param string $region Name of the region for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($packetMirroring, $project, $region, array $optionalArgs = []) - { - $request = new DeletePacketMirroringRequest(); - $requestParamHeaders = []; - $request->setPacketMirroring($packetMirroring); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['packet_mirroring'] = $packetMirroring; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns the specified PacketMirroring resource. - * - * Sample code: - * ``` - * $packetMirroringsClient = new PacketMirroringsClient(); - * try { - * $packetMirroring = 'packet_mirroring'; - * $project = 'project'; - * $region = 'region'; - * $response = $packetMirroringsClient->get($packetMirroring, $project, $region); - * } finally { - * $packetMirroringsClient->close(); - * } - * ``` - * - * @param string $packetMirroring Name of the PacketMirroring resource to return. - * @param string $project Project ID for this request. - * @param string $region Name of the region for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\PacketMirroring - * - * @throws ApiException if the remote call fails - */ - public function get($packetMirroring, $project, $region, array $optionalArgs = []) - { - $request = new GetPacketMirroringRequest(); - $requestParamHeaders = []; - $request->setPacketMirroring($packetMirroring); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['packet_mirroring'] = $packetMirroring; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', PacketMirroring::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates a PacketMirroring resource in the specified project and region using the data included in the request. - * - * Sample code: - * ``` - * $packetMirroringsClient = new PacketMirroringsClient(); - * try { - * $packetMirroringResource = new PacketMirroring(); - * $project = 'project'; - * $region = 'region'; - * $operationResponse = $packetMirroringsClient->insert($packetMirroringResource, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $packetMirroringsClient->insert($packetMirroringResource, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $packetMirroringsClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $packetMirroringsClient->close(); - * } - * ``` - * - * @param PacketMirroring $packetMirroringResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $region Name of the region for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 insert($packetMirroringResource, $project, $region, array $optionalArgs = []) - { - $request = new InsertPacketMirroringRequest(); - $requestParamHeaders = []; - $request->setPacketMirroringResource($packetMirroringResource); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Retrieves a list of PacketMirroring resources available to the specified project and region. - * - * Sample code: - * ``` - * $packetMirroringsClient = new PacketMirroringsClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * // Iterate over pages of elements - * $pagedResponse = $packetMirroringsClient->list($project, $region); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $packetMirroringsClient->list($project, $region); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $packetMirroringsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, $region, array $optionalArgs = []) - { - $request = new ListPacketMirroringsRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, PacketMirroringList::class, $request); - } - - /** - * Patches the specified PacketMirroring resource with the data included in the request. This method supports PATCH semantics and uses JSON merge patch format and processing rules. - * - * Sample code: - * ``` - * $packetMirroringsClient = new PacketMirroringsClient(); - * try { - * $packetMirroring = 'packet_mirroring'; - * $packetMirroringResource = new PacketMirroring(); - * $project = 'project'; - * $region = 'region'; - * $operationResponse = $packetMirroringsClient->patch($packetMirroring, $packetMirroringResource, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $packetMirroringsClient->patch($packetMirroring, $packetMirroringResource, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $packetMirroringsClient->resumeOperation($operationName, 'patch'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $packetMirroringsClient->close(); - * } - * ``` - * - * @param string $packetMirroring Name of the PacketMirroring resource to patch. - * @param PacketMirroring $packetMirroringResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $region Name of the region for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 patch($packetMirroring, $packetMirroringResource, $project, $region, array $optionalArgs = []) - { - $request = new PatchPacketMirroringRequest(); - $requestParamHeaders = []; - $request->setPacketMirroring($packetMirroring); - $request->setPacketMirroringResource($packetMirroringResource); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['packet_mirroring'] = $packetMirroring; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('Patch', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns permissions that a caller has on the specified resource. - * - * Sample code: - * ``` - * $packetMirroringsClient = new PacketMirroringsClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $resource = 'resource'; - * $testPermissionsRequestResource = new TestPermissionsRequest(); - * $response = $packetMirroringsClient->testIamPermissions($project, $region, $resource, $testPermissionsRequestResource); - * } finally { - * $packetMirroringsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region The name of the region for this request. - * @param string $resource Name or id of the resource for this request. - * @param TestPermissionsRequest $testPermissionsRequestResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\TestPermissionsResponse - * - * @throws ApiException if the remote call fails - */ - public function testIamPermissions($project, $region, $resource, $testPermissionsRequestResource, array $optionalArgs = []) - { - $request = new TestIamPermissionsPacketMirroringRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setResource($resource); - $request->setTestPermissionsRequestResource($testPermissionsRequestResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['resource'] = $resource; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('TestIamPermissions', TestPermissionsResponse::class, $optionalArgs, $request)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/ProjectsGapicClient.php b/Compute/src/V1/Gapic/ProjectsGapicClient.php deleted file mode 100644 index 3999253f880d..000000000000 --- a/Compute/src/V1/Gapic/ProjectsGapicClient.php +++ /dev/null @@ -1,1231 +0,0 @@ -disableXpnHost($project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $projectsClient->disableXpnHost($project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $projectsClient->resumeOperation($operationName, 'disableXpnHost'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $projectsClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\ProjectsClient}. - */ -class ProjectsGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.Projects'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/projects_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/projects_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/projects_rest_client_config.php', - ], - ], - 'operationsClientClass' => GlobalOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an GlobalOperationsClient object with the same endpoint as $this. - * - * @return GlobalOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetGlobalOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteGlobalOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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); - } - - /** - * Disable this project as a shared VPC host project. - * - * Sample code: - * ``` - * $projectsClient = new ProjectsClient(); - * try { - * $project = 'project'; - * $operationResponse = $projectsClient->disableXpnHost($project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $projectsClient->disableXpnHost($project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $projectsClient->resumeOperation($operationName, 'disableXpnHost'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $projectsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 disableXpnHost($project, array $optionalArgs = []) - { - $request = new DisableXpnHostProjectRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - 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('DisableXpnHost', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Disable a service resource (also known as service project) associated with this host project. - * - * Sample code: - * ``` - * $projectsClient = new ProjectsClient(); - * try { - * $project = 'project'; - * $projectsDisableXpnResourceRequestResource = new ProjectsDisableXpnResourceRequest(); - * $operationResponse = $projectsClient->disableXpnResource($project, $projectsDisableXpnResourceRequestResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $projectsClient->disableXpnResource($project, $projectsDisableXpnResourceRequestResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $projectsClient->resumeOperation($operationName, 'disableXpnResource'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $projectsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param ProjectsDisableXpnResourceRequest $projectsDisableXpnResourceRequestResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 disableXpnResource($project, $projectsDisableXpnResourceRequestResource, array $optionalArgs = []) - { - $request = new DisableXpnResourceProjectRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setProjectsDisableXpnResourceRequestResource($projectsDisableXpnResourceRequestResource); - $requestParamHeaders['project'] = $project; - 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('DisableXpnResource', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Enable this project as a shared VPC host project. - * - * Sample code: - * ``` - * $projectsClient = new ProjectsClient(); - * try { - * $project = 'project'; - * $operationResponse = $projectsClient->enableXpnHost($project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $projectsClient->enableXpnHost($project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $projectsClient->resumeOperation($operationName, 'enableXpnHost'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $projectsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 enableXpnHost($project, array $optionalArgs = []) - { - $request = new EnableXpnHostProjectRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - 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('EnableXpnHost', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Enable service resource (a.k.a service project) for a host project, so that subnets in the host project can be used by instances in the service project. - * - * Sample code: - * ``` - * $projectsClient = new ProjectsClient(); - * try { - * $project = 'project'; - * $projectsEnableXpnResourceRequestResource = new ProjectsEnableXpnResourceRequest(); - * $operationResponse = $projectsClient->enableXpnResource($project, $projectsEnableXpnResourceRequestResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $projectsClient->enableXpnResource($project, $projectsEnableXpnResourceRequestResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $projectsClient->resumeOperation($operationName, 'enableXpnResource'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $projectsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param ProjectsEnableXpnResourceRequest $projectsEnableXpnResourceRequestResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 enableXpnResource($project, $projectsEnableXpnResourceRequestResource, array $optionalArgs = []) - { - $request = new EnableXpnResourceProjectRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setProjectsEnableXpnResourceRequestResource($projectsEnableXpnResourceRequestResource); - $requestParamHeaders['project'] = $project; - 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('EnableXpnResource', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns the specified Project resource. To decrease latency for this method, you can optionally omit any unneeded information from the response by using a field mask. This practice is especially recommended for unused quota information (the `quotas` field). To exclude one or more fields, set your request's `fields` query parameter to only include the fields you need. For example, to only include the `id` and `selfLink` fields, add the query parameter `?fields=id,selfLink` to your request. - * - * Sample code: - * ``` - * $projectsClient = new ProjectsClient(); - * try { - * $project = 'project'; - * $response = $projectsClient->get($project); - * } finally { - * $projectsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Project - * - * @throws ApiException if the remote call fails - */ - public function get($project, array $optionalArgs = []) - { - $request = new GetProjectRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', Project::class, $optionalArgs, $request)->wait(); - } - - /** - * Gets the shared VPC host project that this project links to. May be empty if no link exists. - * - * Sample code: - * ``` - * $projectsClient = new ProjectsClient(); - * try { - * $project = 'project'; - * $response = $projectsClient->getXpnHost($project); - * } finally { - * $projectsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Project - * - * @throws ApiException if the remote call fails - */ - public function getXpnHost($project, array $optionalArgs = []) - { - $request = new GetXpnHostProjectRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetXpnHost', Project::class, $optionalArgs, $request)->wait(); - } - - /** - * Gets service resources (a.k.a service project) associated with this host project. - * - * Sample code: - * ``` - * $projectsClient = new ProjectsClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $projectsClient->getXpnResources($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $projectsClient->getXpnResources($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $projectsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 getXpnResources($project, array $optionalArgs = []) - { - $request = new GetXpnResourcesProjectsRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('GetXpnResources', $optionalArgs, ProjectsGetXpnResources::class, $request); - } - - /** - * Lists all shared VPC host projects visible to the user in an organization. - * - * Sample code: - * ``` - * $projectsClient = new ProjectsClient(); - * try { - * $project = 'project'; - * $projectsListXpnHostsRequestResource = new ProjectsListXpnHostsRequest(); - * // Iterate over pages of elements - * $pagedResponse = $projectsClient->listXpnHosts($project, $projectsListXpnHostsRequestResource); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $projectsClient->listXpnHosts($project, $projectsListXpnHostsRequestResource); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $projectsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param ProjectsListXpnHostsRequest $projectsListXpnHostsRequestResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 listXpnHosts($project, $projectsListXpnHostsRequestResource, array $optionalArgs = []) - { - $request = new ListXpnHostsProjectsRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setProjectsListXpnHostsRequestResource($projectsListXpnHostsRequestResource); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('ListXpnHosts', $optionalArgs, XpnHostList::class, $request); - } - - /** - * Moves a persistent disk from one zone to another. - * - * Sample code: - * ``` - * $projectsClient = new ProjectsClient(); - * try { - * $diskMoveRequestResource = new DiskMoveRequest(); - * $project = 'project'; - * $operationResponse = $projectsClient->moveDisk($diskMoveRequestResource, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $projectsClient->moveDisk($diskMoveRequestResource, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $projectsClient->resumeOperation($operationName, 'moveDisk'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $projectsClient->close(); - * } - * ``` - * - * @param DiskMoveRequest $diskMoveRequestResource The body resource for this request - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 moveDisk($diskMoveRequestResource, $project, array $optionalArgs = []) - { - $request = new MoveDiskProjectRequest(); - $requestParamHeaders = []; - $request->setDiskMoveRequestResource($diskMoveRequestResource); - $request->setProject($project); - $requestParamHeaders['project'] = $project; - 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('MoveDisk', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Moves an instance and its attached persistent disks from one zone to another. *Note*: Moving VMs or disks by using this method might cause unexpected behavior. For more information, see the [known issue](/compute/docs/troubleshooting/known-issues#moving_vms_or_disks_using_the_moveinstance_api_or_the_causes_unexpected_behavior). [Deprecated] This method is deprecated. See [moving instance across zones](https://cloud.google.com/compute/docs/instances/moving-instance-across-zones) instead. - * - * Sample code: - * ``` - * $projectsClient = new ProjectsClient(); - * try { - * $instanceMoveRequestResource = new InstanceMoveRequest(); - * $project = 'project'; - * $operationResponse = $projectsClient->moveInstance($instanceMoveRequestResource, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $projectsClient->moveInstance($instanceMoveRequestResource, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $projectsClient->resumeOperation($operationName, 'moveInstance'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $projectsClient->close(); - * } - * ``` - * - * @param InstanceMoveRequest $instanceMoveRequestResource The body resource for this request - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 moveInstance($instanceMoveRequestResource, $project, array $optionalArgs = []) - { - $request = new MoveInstanceProjectRequest(); - $requestParamHeaders = []; - $request->setInstanceMoveRequestResource($instanceMoveRequestResource); - $request->setProject($project); - $requestParamHeaders['project'] = $project; - 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('MoveInstance', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Sets the Cloud Armor tier of the project. To set ENTERPRISE or above the billing account of the project must be subscribed to Cloud Armor Enterprise. See Subscribing to Cloud Armor Enterprise for more information. - * - * Sample code: - * ``` - * $projectsClient = new ProjectsClient(); - * try { - * $project = 'project'; - * $projectsSetCloudArmorTierRequestResource = new ProjectsSetCloudArmorTierRequest(); - * $operationResponse = $projectsClient->setCloudArmorTier($project, $projectsSetCloudArmorTierRequestResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $projectsClient->setCloudArmorTier($project, $projectsSetCloudArmorTierRequestResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $projectsClient->resumeOperation($operationName, 'setCloudArmorTier'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $projectsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param ProjectsSetCloudArmorTierRequest $projectsSetCloudArmorTierRequestResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 setCloudArmorTier($project, $projectsSetCloudArmorTierRequestResource, array $optionalArgs = []) - { - $request = new SetCloudArmorTierProjectRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setProjectsSetCloudArmorTierRequestResource($projectsSetCloudArmorTierRequestResource); - $requestParamHeaders['project'] = $project; - 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('SetCloudArmorTier', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Sets metadata common to all instances within the specified project using the data included in the request. - * - * Sample code: - * ``` - * $projectsClient = new ProjectsClient(); - * try { - * $metadataResource = new Metadata(); - * $project = 'project'; - * $operationResponse = $projectsClient->setCommonInstanceMetadata($metadataResource, $project); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $projectsClient->setCommonInstanceMetadata($metadataResource, $project); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $projectsClient->resumeOperation($operationName, 'setCommonInstanceMetadata'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $projectsClient->close(); - * } - * ``` - * - * @param Metadata $metadataResource The body resource for this request - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 setCommonInstanceMetadata($metadataResource, $project, array $optionalArgs = []) - { - $request = new SetCommonInstanceMetadataProjectRequest(); - $requestParamHeaders = []; - $request->setMetadataResource($metadataResource); - $request->setProject($project); - $requestParamHeaders['project'] = $project; - 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('SetCommonInstanceMetadata', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Sets the default network tier of the project. The default network tier is used when an address/forwardingRule/instance is created without specifying the network tier field. - * - * Sample code: - * ``` - * $projectsClient = new ProjectsClient(); - * try { - * $project = 'project'; - * $projectsSetDefaultNetworkTierRequestResource = new ProjectsSetDefaultNetworkTierRequest(); - * $operationResponse = $projectsClient->setDefaultNetworkTier($project, $projectsSetDefaultNetworkTierRequestResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $projectsClient->setDefaultNetworkTier($project, $projectsSetDefaultNetworkTierRequestResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $projectsClient->resumeOperation($operationName, 'setDefaultNetworkTier'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $projectsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param ProjectsSetDefaultNetworkTierRequest $projectsSetDefaultNetworkTierRequestResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 setDefaultNetworkTier($project, $projectsSetDefaultNetworkTierRequestResource, array $optionalArgs = []) - { - $request = new SetDefaultNetworkTierProjectRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setProjectsSetDefaultNetworkTierRequestResource($projectsSetDefaultNetworkTierRequestResource); - $requestParamHeaders['project'] = $project; - 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('SetDefaultNetworkTier', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Enables the usage export feature and sets the usage export bucket where reports are stored. If you provide an empty request body using this method, the usage export feature will be disabled. - * - * Sample code: - * ``` - * $projectsClient = new ProjectsClient(); - * try { - * $project = 'project'; - * $usageExportLocationResource = new UsageExportLocation(); - * $operationResponse = $projectsClient->setUsageExportBucket($project, $usageExportLocationResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $projectsClient->setUsageExportBucket($project, $usageExportLocationResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $projectsClient->resumeOperation($operationName, 'setUsageExportBucket'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $projectsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param UsageExportLocation $usageExportLocationResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 setUsageExportBucket($project, $usageExportLocationResource, array $optionalArgs = []) - { - $request = new SetUsageExportBucketProjectRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setUsageExportLocationResource($usageExportLocationResource); - $requestParamHeaders['project'] = $project; - 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('SetUsageExportBucket', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/PublicAdvertisedPrefixesGapicClient.php b/Compute/src/V1/Gapic/PublicAdvertisedPrefixesGapicClient.php deleted file mode 100644 index 6bb97aafacb9..000000000000 --- a/Compute/src/V1/Gapic/PublicAdvertisedPrefixesGapicClient.php +++ /dev/null @@ -1,751 +0,0 @@ -announce($project, $publicAdvertisedPrefix); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $publicAdvertisedPrefixesClient->announce($project, $publicAdvertisedPrefix); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $publicAdvertisedPrefixesClient->resumeOperation($operationName, 'announce'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $publicAdvertisedPrefixesClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\PublicAdvertisedPrefixesClient}. - */ -class PublicAdvertisedPrefixesGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.PublicAdvertisedPrefixes'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/public_advertised_prefixes_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/public_advertised_prefixes_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/public_advertised_prefixes_rest_client_config.php', - ], - ], - 'operationsClientClass' => GlobalOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an GlobalOperationsClient object with the same endpoint as $this. - * - * @return GlobalOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetGlobalOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteGlobalOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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); - } - - /** - * Announces the specified PublicAdvertisedPrefix - * - * Sample code: - * ``` - * $publicAdvertisedPrefixesClient = new PublicAdvertisedPrefixesClient(); - * try { - * $project = 'project'; - * $publicAdvertisedPrefix = 'public_advertised_prefix'; - * $operationResponse = $publicAdvertisedPrefixesClient->announce($project, $publicAdvertisedPrefix); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $publicAdvertisedPrefixesClient->announce($project, $publicAdvertisedPrefix); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $publicAdvertisedPrefixesClient->resumeOperation($operationName, 'announce'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $publicAdvertisedPrefixesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $publicAdvertisedPrefix The name of the public advertised prefix. It should comply with RFC1035. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 announce($project, $publicAdvertisedPrefix, array $optionalArgs = []) - { - $request = new AnnouncePublicAdvertisedPrefixeRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setPublicAdvertisedPrefix($publicAdvertisedPrefix); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['public_advertised_prefix'] = $publicAdvertisedPrefix; - 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('Announce', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Deletes the specified PublicAdvertisedPrefix - * - * Sample code: - * ``` - * $publicAdvertisedPrefixesClient = new PublicAdvertisedPrefixesClient(); - * try { - * $project = 'project'; - * $publicAdvertisedPrefix = 'public_advertised_prefix'; - * $operationResponse = $publicAdvertisedPrefixesClient->delete($project, $publicAdvertisedPrefix); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $publicAdvertisedPrefixesClient->delete($project, $publicAdvertisedPrefix); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $publicAdvertisedPrefixesClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $publicAdvertisedPrefixesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $publicAdvertisedPrefix Name of the PublicAdvertisedPrefix resource to delete. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($project, $publicAdvertisedPrefix, array $optionalArgs = []) - { - $request = new DeletePublicAdvertisedPrefixeRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setPublicAdvertisedPrefix($publicAdvertisedPrefix); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['public_advertised_prefix'] = $publicAdvertisedPrefix; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns the specified PublicAdvertisedPrefix resource. - * - * Sample code: - * ``` - * $publicAdvertisedPrefixesClient = new PublicAdvertisedPrefixesClient(); - * try { - * $project = 'project'; - * $publicAdvertisedPrefix = 'public_advertised_prefix'; - * $response = $publicAdvertisedPrefixesClient->get($project, $publicAdvertisedPrefix); - * } finally { - * $publicAdvertisedPrefixesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $publicAdvertisedPrefix Name of the PublicAdvertisedPrefix resource to return. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\PublicAdvertisedPrefix - * - * @throws ApiException if the remote call fails - */ - public function get($project, $publicAdvertisedPrefix, array $optionalArgs = []) - { - $request = new GetPublicAdvertisedPrefixeRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setPublicAdvertisedPrefix($publicAdvertisedPrefix); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['public_advertised_prefix'] = $publicAdvertisedPrefix; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', PublicAdvertisedPrefix::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates a PublicAdvertisedPrefix in the specified project using the parameters that are included in the request. - * - * Sample code: - * ``` - * $publicAdvertisedPrefixesClient = new PublicAdvertisedPrefixesClient(); - * try { - * $project = 'project'; - * $publicAdvertisedPrefixResource = new PublicAdvertisedPrefix(); - * $operationResponse = $publicAdvertisedPrefixesClient->insert($project, $publicAdvertisedPrefixResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $publicAdvertisedPrefixesClient->insert($project, $publicAdvertisedPrefixResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $publicAdvertisedPrefixesClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $publicAdvertisedPrefixesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param PublicAdvertisedPrefix $publicAdvertisedPrefixResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 insert($project, $publicAdvertisedPrefixResource, array $optionalArgs = []) - { - $request = new InsertPublicAdvertisedPrefixeRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setPublicAdvertisedPrefixResource($publicAdvertisedPrefixResource); - $requestParamHeaders['project'] = $project; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Lists the PublicAdvertisedPrefixes for a project. - * - * Sample code: - * ``` - * $publicAdvertisedPrefixesClient = new PublicAdvertisedPrefixesClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $publicAdvertisedPrefixesClient->list($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $publicAdvertisedPrefixesClient->list($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $publicAdvertisedPrefixesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, array $optionalArgs = []) - { - $request = new ListPublicAdvertisedPrefixesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, PublicAdvertisedPrefixList::class, $request); - } - - /** - * Patches the specified Router resource with the data included in the request. This method supports PATCH semantics and uses JSON merge patch format and processing rules. - * - * Sample code: - * ``` - * $publicAdvertisedPrefixesClient = new PublicAdvertisedPrefixesClient(); - * try { - * $project = 'project'; - * $publicAdvertisedPrefix = 'public_advertised_prefix'; - * $publicAdvertisedPrefixResource = new PublicAdvertisedPrefix(); - * $operationResponse = $publicAdvertisedPrefixesClient->patch($project, $publicAdvertisedPrefix, $publicAdvertisedPrefixResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $publicAdvertisedPrefixesClient->patch($project, $publicAdvertisedPrefix, $publicAdvertisedPrefixResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $publicAdvertisedPrefixesClient->resumeOperation($operationName, 'patch'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $publicAdvertisedPrefixesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $publicAdvertisedPrefix Name of the PublicAdvertisedPrefix resource to patch. - * @param PublicAdvertisedPrefix $publicAdvertisedPrefixResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 patch($project, $publicAdvertisedPrefix, $publicAdvertisedPrefixResource, array $optionalArgs = []) - { - $request = new PatchPublicAdvertisedPrefixeRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setPublicAdvertisedPrefix($publicAdvertisedPrefix); - $request->setPublicAdvertisedPrefixResource($publicAdvertisedPrefixResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['public_advertised_prefix'] = $publicAdvertisedPrefix; - 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('Patch', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Withdraws the specified PublicAdvertisedPrefix - * - * Sample code: - * ``` - * $publicAdvertisedPrefixesClient = new PublicAdvertisedPrefixesClient(); - * try { - * $project = 'project'; - * $publicAdvertisedPrefix = 'public_advertised_prefix'; - * $operationResponse = $publicAdvertisedPrefixesClient->withdraw($project, $publicAdvertisedPrefix); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $publicAdvertisedPrefixesClient->withdraw($project, $publicAdvertisedPrefix); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $publicAdvertisedPrefixesClient->resumeOperation($operationName, 'withdraw'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $publicAdvertisedPrefixesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $publicAdvertisedPrefix The name of the public advertised prefix. It should comply with RFC1035. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 withdraw($project, $publicAdvertisedPrefix, array $optionalArgs = []) - { - $request = new WithdrawPublicAdvertisedPrefixeRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setPublicAdvertisedPrefix($publicAdvertisedPrefix); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['public_advertised_prefix'] = $publicAdvertisedPrefix; - 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('Withdraw', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/PublicDelegatedPrefixesGapicClient.php b/Compute/src/V1/Gapic/PublicDelegatedPrefixesGapicClient.php deleted file mode 100644 index 3e51016aae73..000000000000 --- a/Compute/src/V1/Gapic/PublicDelegatedPrefixesGapicClient.php +++ /dev/null @@ -1,866 +0,0 @@ -aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $publicDelegatedPrefixesClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $publicDelegatedPrefixesClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\PublicDelegatedPrefixesClient}. - */ -class PublicDelegatedPrefixesGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.PublicDelegatedPrefixes'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/public_delegated_prefixes_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/public_delegated_prefixes_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/public_delegated_prefixes_rest_client_config.php', - ], - ], - 'operationsClientClass' => RegionOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an RegionOperationsClient object with the same endpoint as $this. - * - * @return RegionOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetRegionOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteRegionOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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); - } - - /** - * Lists all PublicDelegatedPrefix resources owned by the specific project across all scopes. To prevent failure, Google recommends that you set the `returnPartialSuccess` parameter to `true`. - * - * Sample code: - * ``` - * $publicDelegatedPrefixesClient = new PublicDelegatedPrefixesClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $publicDelegatedPrefixesClient->aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $publicDelegatedPrefixesClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $publicDelegatedPrefixesClient->close(); - * } - * ``` - * - * @param string $project Name of the project scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type bool $includeAllScopes - * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type int $serviceProjectNumber - * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable 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 aggregatedList($project, array $optionalArgs = []) - { - $request = new AggregatedListPublicDelegatedPrefixesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['includeAllScopes'])) { - $request->setIncludeAllScopes($optionalArgs['includeAllScopes']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - if (isset($optionalArgs['serviceProjectNumber'])) { - $request->setServiceProjectNumber($optionalArgs['serviceProjectNumber']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('AggregatedList', $optionalArgs, PublicDelegatedPrefixAggregatedList::class, $request); - } - - /** - * Announces the specified PublicDelegatedPrefix in the given region. - * - * Sample code: - * ``` - * $publicDelegatedPrefixesClient = new PublicDelegatedPrefixesClient(); - * try { - * $project = 'project'; - * $publicDelegatedPrefix = 'public_delegated_prefix'; - * $region = 'region'; - * $operationResponse = $publicDelegatedPrefixesClient->announce($project, $publicDelegatedPrefix, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $publicDelegatedPrefixesClient->announce($project, $publicDelegatedPrefix, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $publicDelegatedPrefixesClient->resumeOperation($operationName, 'announce'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $publicDelegatedPrefixesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $publicDelegatedPrefix The name of the public delegated prefix. It should comply with RFC1035. - * @param string $region The name of the region where the public delegated prefix is located. It should comply with RFC1035. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 announce($project, $publicDelegatedPrefix, $region, array $optionalArgs = []) - { - $request = new AnnouncePublicDelegatedPrefixeRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setPublicDelegatedPrefix($publicDelegatedPrefix); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['public_delegated_prefix'] = $publicDelegatedPrefix; - $requestParamHeaders['region'] = $region; - 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('Announce', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Deletes the specified PublicDelegatedPrefix in the given region. - * - * Sample code: - * ``` - * $publicDelegatedPrefixesClient = new PublicDelegatedPrefixesClient(); - * try { - * $project = 'project'; - * $publicDelegatedPrefix = 'public_delegated_prefix'; - * $region = 'region'; - * $operationResponse = $publicDelegatedPrefixesClient->delete($project, $publicDelegatedPrefix, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $publicDelegatedPrefixesClient->delete($project, $publicDelegatedPrefix, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $publicDelegatedPrefixesClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $publicDelegatedPrefixesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $publicDelegatedPrefix Name of the PublicDelegatedPrefix resource to delete. - * @param string $region Name of the region of this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($project, $publicDelegatedPrefix, $region, array $optionalArgs = []) - { - $request = new DeletePublicDelegatedPrefixeRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setPublicDelegatedPrefix($publicDelegatedPrefix); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['public_delegated_prefix'] = $publicDelegatedPrefix; - $requestParamHeaders['region'] = $region; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns the specified PublicDelegatedPrefix resource in the given region. - * - * Sample code: - * ``` - * $publicDelegatedPrefixesClient = new PublicDelegatedPrefixesClient(); - * try { - * $project = 'project'; - * $publicDelegatedPrefix = 'public_delegated_prefix'; - * $region = 'region'; - * $response = $publicDelegatedPrefixesClient->get($project, $publicDelegatedPrefix, $region); - * } finally { - * $publicDelegatedPrefixesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $publicDelegatedPrefix Name of the PublicDelegatedPrefix resource to return. - * @param string $region Name of the region of this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\PublicDelegatedPrefix - * - * @throws ApiException if the remote call fails - */ - public function get($project, $publicDelegatedPrefix, $region, array $optionalArgs = []) - { - $request = new GetPublicDelegatedPrefixeRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setPublicDelegatedPrefix($publicDelegatedPrefix); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['public_delegated_prefix'] = $publicDelegatedPrefix; - $requestParamHeaders['region'] = $region; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', PublicDelegatedPrefix::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates a PublicDelegatedPrefix in the specified project in the given region using the parameters that are included in the request. - * - * Sample code: - * ``` - * $publicDelegatedPrefixesClient = new PublicDelegatedPrefixesClient(); - * try { - * $project = 'project'; - * $publicDelegatedPrefixResource = new PublicDelegatedPrefix(); - * $region = 'region'; - * $operationResponse = $publicDelegatedPrefixesClient->insert($project, $publicDelegatedPrefixResource, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $publicDelegatedPrefixesClient->insert($project, $publicDelegatedPrefixResource, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $publicDelegatedPrefixesClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $publicDelegatedPrefixesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param PublicDelegatedPrefix $publicDelegatedPrefixResource The body resource for this request - * @param string $region Name of the region of this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 insert($project, $publicDelegatedPrefixResource, $region, array $optionalArgs = []) - { - $request = new InsertPublicDelegatedPrefixeRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setPublicDelegatedPrefixResource($publicDelegatedPrefixResource); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Lists the PublicDelegatedPrefixes for a project in the given region. - * - * Sample code: - * ``` - * $publicDelegatedPrefixesClient = new PublicDelegatedPrefixesClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * // Iterate over pages of elements - * $pagedResponse = $publicDelegatedPrefixesClient->list($project, $region); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $publicDelegatedPrefixesClient->list($project, $region); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $publicDelegatedPrefixesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region of this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, $region, array $optionalArgs = []) - { - $request = new ListPublicDelegatedPrefixesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, PublicDelegatedPrefixList::class, $request); - } - - /** - * Patches the specified PublicDelegatedPrefix resource with the data included in the request. This method supports PATCH semantics and uses JSON merge patch format and processing rules. - * - * Sample code: - * ``` - * $publicDelegatedPrefixesClient = new PublicDelegatedPrefixesClient(); - * try { - * $project = 'project'; - * $publicDelegatedPrefix = 'public_delegated_prefix'; - * $publicDelegatedPrefixResource = new PublicDelegatedPrefix(); - * $region = 'region'; - * $operationResponse = $publicDelegatedPrefixesClient->patch($project, $publicDelegatedPrefix, $publicDelegatedPrefixResource, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $publicDelegatedPrefixesClient->patch($project, $publicDelegatedPrefix, $publicDelegatedPrefixResource, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $publicDelegatedPrefixesClient->resumeOperation($operationName, 'patch'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $publicDelegatedPrefixesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $publicDelegatedPrefix Name of the PublicDelegatedPrefix resource to patch. - * @param PublicDelegatedPrefix $publicDelegatedPrefixResource The body resource for this request - * @param string $region Name of the region for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 patch($project, $publicDelegatedPrefix, $publicDelegatedPrefixResource, $region, array $optionalArgs = []) - { - $request = new PatchPublicDelegatedPrefixeRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setPublicDelegatedPrefix($publicDelegatedPrefix); - $request->setPublicDelegatedPrefixResource($publicDelegatedPrefixResource); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['public_delegated_prefix'] = $publicDelegatedPrefix; - $requestParamHeaders['region'] = $region; - 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('Patch', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Withdraws the specified PublicDelegatedPrefix in the given region. - * - * Sample code: - * ``` - * $publicDelegatedPrefixesClient = new PublicDelegatedPrefixesClient(); - * try { - * $project = 'project'; - * $publicDelegatedPrefix = 'public_delegated_prefix'; - * $region = 'region'; - * $operationResponse = $publicDelegatedPrefixesClient->withdraw($project, $publicDelegatedPrefix, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $publicDelegatedPrefixesClient->withdraw($project, $publicDelegatedPrefix, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $publicDelegatedPrefixesClient->resumeOperation($operationName, 'withdraw'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $publicDelegatedPrefixesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $publicDelegatedPrefix The name of the public delegated prefix. It should comply with RFC1035. - * @param string $region The name of the region where the public delegated prefix is located. It should comply with RFC1035. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 withdraw($project, $publicDelegatedPrefix, $region, array $optionalArgs = []) - { - $request = new WithdrawPublicDelegatedPrefixeRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setPublicDelegatedPrefix($publicDelegatedPrefix); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['public_delegated_prefix'] = $publicDelegatedPrefix; - $requestParamHeaders['region'] = $region; - 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('Withdraw', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/RegionAutoscalersGapicClient.php b/Compute/src/V1/Gapic/RegionAutoscalersGapicClient.php deleted file mode 100644 index 8c9555122037..000000000000 --- a/Compute/src/V1/Gapic/RegionAutoscalersGapicClient.php +++ /dev/null @@ -1,711 +0,0 @@ -delete($autoscaler, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionAutoscalersClient->delete($autoscaler, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionAutoscalersClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionAutoscalersClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\RegionAutoscalersClient}. - */ -class RegionAutoscalersGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.RegionAutoscalers'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/region_autoscalers_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/region_autoscalers_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/region_autoscalers_rest_client_config.php', - ], - ], - 'operationsClientClass' => RegionOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an RegionOperationsClient object with the same endpoint as $this. - * - * @return RegionOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetRegionOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteRegionOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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 the specified autoscaler. - * - * Sample code: - * ``` - * $regionAutoscalersClient = new RegionAutoscalersClient(); - * try { - * $autoscaler = 'autoscaler'; - * $project = 'project'; - * $region = 'region'; - * $operationResponse = $regionAutoscalersClient->delete($autoscaler, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionAutoscalersClient->delete($autoscaler, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionAutoscalersClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionAutoscalersClient->close(); - * } - * ``` - * - * @param string $autoscaler Name of the autoscaler to delete. - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($autoscaler, $project, $region, array $optionalArgs = []) - { - $request = new DeleteRegionAutoscalerRequest(); - $requestParamHeaders = []; - $request->setAutoscaler($autoscaler); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['autoscaler'] = $autoscaler; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns the specified autoscaler. - * - * Sample code: - * ``` - * $regionAutoscalersClient = new RegionAutoscalersClient(); - * try { - * $autoscaler = 'autoscaler'; - * $project = 'project'; - * $region = 'region'; - * $response = $regionAutoscalersClient->get($autoscaler, $project, $region); - * } finally { - * $regionAutoscalersClient->close(); - * } - * ``` - * - * @param string $autoscaler Name of the autoscaler to return. - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Autoscaler - * - * @throws ApiException if the remote call fails - */ - public function get($autoscaler, $project, $region, array $optionalArgs = []) - { - $request = new GetRegionAutoscalerRequest(); - $requestParamHeaders = []; - $request->setAutoscaler($autoscaler); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['autoscaler'] = $autoscaler; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', Autoscaler::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates an autoscaler in the specified project using the data included in the request. - * - * Sample code: - * ``` - * $regionAutoscalersClient = new RegionAutoscalersClient(); - * try { - * $autoscalerResource = new Autoscaler(); - * $project = 'project'; - * $region = 'region'; - * $operationResponse = $regionAutoscalersClient->insert($autoscalerResource, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionAutoscalersClient->insert($autoscalerResource, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionAutoscalersClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionAutoscalersClient->close(); - * } - * ``` - * - * @param Autoscaler $autoscalerResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 insert($autoscalerResource, $project, $region, array $optionalArgs = []) - { - $request = new InsertRegionAutoscalerRequest(); - $requestParamHeaders = []; - $request->setAutoscalerResource($autoscalerResource); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Retrieves a list of autoscalers contained within the specified region. - * - * Sample code: - * ``` - * $regionAutoscalersClient = new RegionAutoscalersClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * // Iterate over pages of elements - * $pagedResponse = $regionAutoscalersClient->list($project, $region); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $regionAutoscalersClient->list($project, $region); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $regionAutoscalersClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, $region, array $optionalArgs = []) - { - $request = new ListRegionAutoscalersRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, RegionAutoscalerList::class, $request); - } - - /** - * Updates an autoscaler in the specified project using the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. - * - * Sample code: - * ``` - * $regionAutoscalersClient = new RegionAutoscalersClient(); - * try { - * $autoscalerResource = new Autoscaler(); - * $project = 'project'; - * $region = 'region'; - * $operationResponse = $regionAutoscalersClient->patch($autoscalerResource, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionAutoscalersClient->patch($autoscalerResource, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionAutoscalersClient->resumeOperation($operationName, 'patch'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionAutoscalersClient->close(); - * } - * ``` - * - * @param Autoscaler $autoscalerResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $autoscaler - * Name of the autoscaler to patch. - * @type string $requestId - * 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. 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 patch($autoscalerResource, $project, $region, array $optionalArgs = []) - { - $request = new PatchRegionAutoscalerRequest(); - $requestParamHeaders = []; - $request->setAutoscalerResource($autoscalerResource); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - if (isset($optionalArgs['autoscaler'])) { - $request->setAutoscaler($optionalArgs['autoscaler']); - } - - 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('Patch', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Updates an autoscaler in the specified project using the data included in the request. - * - * Sample code: - * ``` - * $regionAutoscalersClient = new RegionAutoscalersClient(); - * try { - * $autoscalerResource = new Autoscaler(); - * $project = 'project'; - * $region = 'region'; - * $operationResponse = $regionAutoscalersClient->update($autoscalerResource, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionAutoscalersClient->update($autoscalerResource, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionAutoscalersClient->resumeOperation($operationName, 'update'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionAutoscalersClient->close(); - * } - * ``` - * - * @param Autoscaler $autoscalerResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $autoscaler - * Name of the autoscaler to update. - * @type string $requestId - * 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. 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 update($autoscalerResource, $project, $region, array $optionalArgs = []) - { - $request = new UpdateRegionAutoscalerRequest(); - $requestParamHeaders = []; - $request->setAutoscalerResource($autoscalerResource); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - if (isset($optionalArgs['autoscaler'])) { - $request->setAutoscaler($optionalArgs['autoscaler']); - } - - 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('Update', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/RegionBackendServicesGapicClient.php b/Compute/src/V1/Gapic/RegionBackendServicesGapicClient.php deleted file mode 100644 index 4ab93bc2c854..000000000000 --- a/Compute/src/V1/Gapic/RegionBackendServicesGapicClient.php +++ /dev/null @@ -1,1091 +0,0 @@ -delete($backendService, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionBackendServicesClient->delete($backendService, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionBackendServicesClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionBackendServicesClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\RegionBackendServicesClient}. - */ -class RegionBackendServicesGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.RegionBackendServices'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/region_backend_services_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/region_backend_services_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/region_backend_services_rest_client_config.php', - ], - ], - 'operationsClientClass' => RegionOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an RegionOperationsClient object with the same endpoint as $this. - * - * @return RegionOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetRegionOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteRegionOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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 the specified regional BackendService resource. - * - * Sample code: - * ``` - * $regionBackendServicesClient = new RegionBackendServicesClient(); - * try { - * $backendService = 'backend_service'; - * $project = 'project'; - * $region = 'region'; - * $operationResponse = $regionBackendServicesClient->delete($backendService, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionBackendServicesClient->delete($backendService, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionBackendServicesClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionBackendServicesClient->close(); - * } - * ``` - * - * @param string $backendService Name of the BackendService resource to delete. - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($backendService, $project, $region, array $optionalArgs = []) - { - $request = new DeleteRegionBackendServiceRequest(); - $requestParamHeaders = []; - $request->setBackendService($backendService); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['backend_service'] = $backendService; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns the specified regional BackendService resource. - * - * Sample code: - * ``` - * $regionBackendServicesClient = new RegionBackendServicesClient(); - * try { - * $backendService = 'backend_service'; - * $project = 'project'; - * $region = 'region'; - * $response = $regionBackendServicesClient->get($backendService, $project, $region); - * } finally { - * $regionBackendServicesClient->close(); - * } - * ``` - * - * @param string $backendService Name of the BackendService resource to return. - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\BackendService - * - * @throws ApiException if the remote call fails - */ - public function get($backendService, $project, $region, array $optionalArgs = []) - { - $request = new GetRegionBackendServiceRequest(); - $requestParamHeaders = []; - $request->setBackendService($backendService); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['backend_service'] = $backendService; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', BackendService::class, $optionalArgs, $request)->wait(); - } - - /** - * Gets the most recent health check results for this regional BackendService. - * - * Sample code: - * ``` - * $regionBackendServicesClient = new RegionBackendServicesClient(); - * try { - * $backendService = 'backend_service'; - * $project = 'project'; - * $region = 'region'; - * $resourceGroupReferenceResource = new ResourceGroupReference(); - * $response = $regionBackendServicesClient->getHealth($backendService, $project, $region, $resourceGroupReferenceResource); - * } finally { - * $regionBackendServicesClient->close(); - * } - * ``` - * - * @param string $backendService Name of the BackendService resource for which to get health. - * @param string $project - * @param string $region Name of the region scoping this request. - * @param ResourceGroupReference $resourceGroupReferenceResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\BackendServiceGroupHealth - * - * @throws ApiException if the remote call fails - */ - public function getHealth($backendService, $project, $region, $resourceGroupReferenceResource, array $optionalArgs = []) - { - $request = new GetHealthRegionBackendServiceRequest(); - $requestParamHeaders = []; - $request->setBackendService($backendService); - $request->setProject($project); - $request->setRegion($region); - $request->setResourceGroupReferenceResource($resourceGroupReferenceResource); - $requestParamHeaders['backend_service'] = $backendService; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetHealth', BackendServiceGroupHealth::class, $optionalArgs, $request)->wait(); - } - - /** - * Gets the access control policy for a resource. May be empty if no such policy or resource exists. - * - * Sample code: - * ``` - * $regionBackendServicesClient = new RegionBackendServicesClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $resource = 'resource'; - * $response = $regionBackendServicesClient->getIamPolicy($project, $region, $resource); - * } finally { - * $regionBackendServicesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region The name of the region for this request. - * @param string $resource Name or id of the resource for this request. - * @param array $optionalArgs { - * Optional. - * - * @type int $optionsRequestedPolicyVersion - * Requested IAM Policy version. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function getIamPolicy($project, $region, $resource, array $optionalArgs = []) - { - $request = new GetIamPolicyRegionBackendServiceRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setResource($resource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['optionsRequestedPolicyVersion'])) { - $request->setOptionsRequestedPolicyVersion($optionalArgs['optionsRequestedPolicyVersion']); - } - - $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(); - } - - /** - * Creates a regional BackendService resource in the specified project using the data included in the request. For more information, see Backend services overview. - * - * Sample code: - * ``` - * $regionBackendServicesClient = new RegionBackendServicesClient(); - * try { - * $backendServiceResource = new BackendService(); - * $project = 'project'; - * $region = 'region'; - * $operationResponse = $regionBackendServicesClient->insert($backendServiceResource, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionBackendServicesClient->insert($backendServiceResource, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionBackendServicesClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionBackendServicesClient->close(); - * } - * ``` - * - * @param BackendService $backendServiceResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 insert($backendServiceResource, $project, $region, array $optionalArgs = []) - { - $request = new InsertRegionBackendServiceRequest(); - $requestParamHeaders = []; - $request->setBackendServiceResource($backendServiceResource); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Retrieves the list of regional BackendService resources available to the specified project in the given region. - * - * Sample code: - * ``` - * $regionBackendServicesClient = new RegionBackendServicesClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * // Iterate over pages of elements - * $pagedResponse = $regionBackendServicesClient->list($project, $region); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $regionBackendServicesClient->list($project, $region); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $regionBackendServicesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, $region, array $optionalArgs = []) - { - $request = new ListRegionBackendServicesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, BackendServiceList::class, $request); - } - - /** - * Retrieves a list of all usable backend services in the specified project in the given region. - * - * Sample code: - * ``` - * $regionBackendServicesClient = new RegionBackendServicesClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * // Iterate over pages of elements - * $pagedResponse = $regionBackendServicesClient->listUsable($project, $region); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $regionBackendServicesClient->listUsable($project, $region); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $regionBackendServicesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. It must be a string that meets the requirements in RFC1035. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 listUsable($project, $region, array $optionalArgs = []) - { - $request = new ListUsableRegionBackendServicesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('ListUsable', $optionalArgs, BackendServiceListUsable::class, $request); - } - - /** - * Updates the specified regional BackendService resource with the data included in the request. For more information, see Understanding backend services This method supports PATCH semantics and uses the JSON merge patch format and processing rules. - * - * Sample code: - * ``` - * $regionBackendServicesClient = new RegionBackendServicesClient(); - * try { - * $backendService = 'backend_service'; - * $backendServiceResource = new BackendService(); - * $project = 'project'; - * $region = 'region'; - * $operationResponse = $regionBackendServicesClient->patch($backendService, $backendServiceResource, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionBackendServicesClient->patch($backendService, $backendServiceResource, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionBackendServicesClient->resumeOperation($operationName, 'patch'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionBackendServicesClient->close(); - * } - * ``` - * - * @param string $backendService Name of the BackendService resource to patch. - * @param BackendService $backendServiceResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 patch($backendService, $backendServiceResource, $project, $region, array $optionalArgs = []) - { - $request = new PatchRegionBackendServiceRequest(); - $requestParamHeaders = []; - $request->setBackendService($backendService); - $request->setBackendServiceResource($backendServiceResource); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['backend_service'] = $backendService; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('Patch', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Sets the access control policy on the specified resource. Replaces any existing policy. - * - * Sample code: - * ``` - * $regionBackendServicesClient = new RegionBackendServicesClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $regionSetPolicyRequestResource = new RegionSetPolicyRequest(); - * $resource = 'resource'; - * $response = $regionBackendServicesClient->setIamPolicy($project, $region, $regionSetPolicyRequestResource, $resource); - * } finally { - * $regionBackendServicesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region The name of the region for this request. - * @param RegionSetPolicyRequest $regionSetPolicyRequestResource The body resource for this request - * @param string $resource Name or id of the resource for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function setIamPolicy($project, $region, $regionSetPolicyRequestResource, $resource, array $optionalArgs = []) - { - $request = new SetIamPolicyRegionBackendServiceRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setRegionSetPolicyRequestResource($regionSetPolicyRequestResource); - $request->setResource($resource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['resource'] = $resource; - $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(); - } - - /** - * Sets the Google Cloud Armor security policy for the specified backend service. For more information, see Google Cloud Armor Overview - * - * Sample code: - * ``` - * $regionBackendServicesClient = new RegionBackendServicesClient(); - * try { - * $backendService = 'backend_service'; - * $project = 'project'; - * $region = 'region'; - * $securityPolicyReferenceResource = new SecurityPolicyReference(); - * $operationResponse = $regionBackendServicesClient->setSecurityPolicy($backendService, $project, $region, $securityPolicyReferenceResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionBackendServicesClient->setSecurityPolicy($backendService, $project, $region, $securityPolicyReferenceResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionBackendServicesClient->resumeOperation($operationName, 'setSecurityPolicy'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionBackendServicesClient->close(); - * } - * ``` - * - * @param string $backendService Name of the BackendService resource to which the security policy should be set. The name should conform to RFC1035. - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param SecurityPolicyReference $securityPolicyReferenceResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 setSecurityPolicy($backendService, $project, $region, $securityPolicyReferenceResource, array $optionalArgs = []) - { - $request = new SetSecurityPolicyRegionBackendServiceRequest(); - $requestParamHeaders = []; - $request->setBackendService($backendService); - $request->setProject($project); - $request->setRegion($region); - $request->setSecurityPolicyReferenceResource($securityPolicyReferenceResource); - $requestParamHeaders['backend_service'] = $backendService; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('SetSecurityPolicy', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns permissions that a caller has on the specified resource. - * - * Sample code: - * ``` - * $regionBackendServicesClient = new RegionBackendServicesClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $resource = 'resource'; - * $testPermissionsRequestResource = new TestPermissionsRequest(); - * $response = $regionBackendServicesClient->testIamPermissions($project, $region, $resource, $testPermissionsRequestResource); - * } finally { - * $regionBackendServicesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region The name of the region for this request. - * @param string $resource Name or id of the resource for this request. - * @param TestPermissionsRequest $testPermissionsRequestResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\TestPermissionsResponse - * - * @throws ApiException if the remote call fails - */ - public function testIamPermissions($project, $region, $resource, $testPermissionsRequestResource, array $optionalArgs = []) - { - $request = new TestIamPermissionsRegionBackendServiceRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setResource($resource); - $request->setTestPermissionsRequestResource($testPermissionsRequestResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['resource'] = $resource; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('TestIamPermissions', TestPermissionsResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Updates the specified regional BackendService resource with the data included in the request. For more information, see Backend services overview . - * - * Sample code: - * ``` - * $regionBackendServicesClient = new RegionBackendServicesClient(); - * try { - * $backendService = 'backend_service'; - * $backendServiceResource = new BackendService(); - * $project = 'project'; - * $region = 'region'; - * $operationResponse = $regionBackendServicesClient->update($backendService, $backendServiceResource, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionBackendServicesClient->update($backendService, $backendServiceResource, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionBackendServicesClient->resumeOperation($operationName, 'update'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionBackendServicesClient->close(); - * } - * ``` - * - * @param string $backendService Name of the BackendService resource to update. - * @param BackendService $backendServiceResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 update($backendService, $backendServiceResource, $project, $region, array $optionalArgs = []) - { - $request = new UpdateRegionBackendServiceRequest(); - $requestParamHeaders = []; - $request->setBackendService($backendService); - $request->setBackendServiceResource($backendServiceResource); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['backend_service'] = $backendService; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('Update', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/RegionCommitmentsGapicClient.php b/Compute/src/V1/Gapic/RegionCommitmentsGapicClient.php deleted file mode 100644 index ea3cbc2b57db..000000000000 --- a/Compute/src/V1/Gapic/RegionCommitmentsGapicClient.php +++ /dev/null @@ -1,646 +0,0 @@ -aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $regionCommitmentsClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $regionCommitmentsClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\RegionCommitmentsClient}. - */ -class RegionCommitmentsGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.RegionCommitments'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/region_commitments_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/region_commitments_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/region_commitments_rest_client_config.php', - ], - ], - 'operationsClientClass' => RegionOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an RegionOperationsClient object with the same endpoint as $this. - * - * @return RegionOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetRegionOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteRegionOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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); - } - - /** - * Retrieves an aggregated list of commitments by region. To prevent failure, Google recommends that you set the `returnPartialSuccess` parameter to `true`. - * - * Sample code: - * ``` - * $regionCommitmentsClient = new RegionCommitmentsClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $regionCommitmentsClient->aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $regionCommitmentsClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $regionCommitmentsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type bool $includeAllScopes - * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type int $serviceProjectNumber - * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable 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 aggregatedList($project, array $optionalArgs = []) - { - $request = new AggregatedListRegionCommitmentsRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['includeAllScopes'])) { - $request->setIncludeAllScopes($optionalArgs['includeAllScopes']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - if (isset($optionalArgs['serviceProjectNumber'])) { - $request->setServiceProjectNumber($optionalArgs['serviceProjectNumber']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('AggregatedList', $optionalArgs, CommitmentAggregatedList::class, $request); - } - - /** - * Returns the specified commitment resource. - * - * Sample code: - * ``` - * $regionCommitmentsClient = new RegionCommitmentsClient(); - * try { - * $commitment = 'commitment'; - * $project = 'project'; - * $region = 'region'; - * $response = $regionCommitmentsClient->get($commitment, $project, $region); - * } finally { - * $regionCommitmentsClient->close(); - * } - * ``` - * - * @param string $commitment Name of the commitment to return. - * @param string $project Project ID for this request. - * @param string $region Name of the region for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Commitment - * - * @throws ApiException if the remote call fails - */ - public function get($commitment, $project, $region, array $optionalArgs = []) - { - $request = new GetRegionCommitmentRequest(); - $requestParamHeaders = []; - $request->setCommitment($commitment); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['commitment'] = $commitment; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', Commitment::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates a commitment in the specified project using the data included in the request. - * - * Sample code: - * ``` - * $regionCommitmentsClient = new RegionCommitmentsClient(); - * try { - * $commitmentResource = new Commitment(); - * $project = 'project'; - * $region = 'region'; - * $operationResponse = $regionCommitmentsClient->insert($commitmentResource, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionCommitmentsClient->insert($commitmentResource, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionCommitmentsClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionCommitmentsClient->close(); - * } - * ``` - * - * @param Commitment $commitmentResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $region Name of the region for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 insert($commitmentResource, $project, $region, array $optionalArgs = []) - { - $request = new InsertRegionCommitmentRequest(); - $requestParamHeaders = []; - $request->setCommitmentResource($commitmentResource); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Retrieves a list of commitments contained within the specified region. - * - * Sample code: - * ``` - * $regionCommitmentsClient = new RegionCommitmentsClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * // Iterate over pages of elements - * $pagedResponse = $regionCommitmentsClient->list($project, $region); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $regionCommitmentsClient->list($project, $region); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $regionCommitmentsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, $region, array $optionalArgs = []) - { - $request = new ListRegionCommitmentsRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, CommitmentList::class, $request); - } - - /** - * Updates the specified commitment with the data included in the request. Update is performed only on selected fields included as part of update-mask. Only the following fields can be updated: auto_renew and plan. - * - * Sample code: - * ``` - * $regionCommitmentsClient = new RegionCommitmentsClient(); - * try { - * $commitment = 'commitment'; - * $commitmentResource = new Commitment(); - * $project = 'project'; - * $region = 'region'; - * $operationResponse = $regionCommitmentsClient->update($commitment, $commitmentResource, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionCommitmentsClient->update($commitment, $commitmentResource, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionCommitmentsClient->resumeOperation($operationName, 'update'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionCommitmentsClient->close(); - * } - * ``` - * - * @param string $commitment Name of the commitment that you want to update. - * @param Commitment $commitmentResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $region Name of the region for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $paths - * @type string $requestId - * 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. 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 $updateMask - * update_mask indicates fields to be updated as part of this request. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 update($commitment, $commitmentResource, $project, $region, array $optionalArgs = []) - { - $request = new UpdateRegionCommitmentRequest(); - $requestParamHeaders = []; - $request->setCommitment($commitment); - $request->setCommitmentResource($commitmentResource); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['commitment'] = $commitment; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - if (isset($optionalArgs['paths'])) { - $request->setPaths($optionalArgs['paths']); - } - - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('Update', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/RegionDiskTypesGapicClient.php b/Compute/src/V1/Gapic/RegionDiskTypesGapicClient.php deleted file mode 100644 index 0f0423fbfda4..000000000000 --- a/Compute/src/V1/Gapic/RegionDiskTypesGapicClient.php +++ /dev/null @@ -1,314 +0,0 @@ -get($diskType, $project, $region); - * } finally { - * $regionDiskTypesClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\RegionDiskTypesClient}. - */ -class RegionDiskTypesGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.RegionDiskTypes'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute.readonly', - 'https://www.googleapis.com/auth/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/region_disk_types_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/region_disk_types_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/region_disk_types_rest_client_config.php', - ], - ], - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * 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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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); - } - - /** - * Returns the specified regional disk type. - * - * Sample code: - * ``` - * $regionDiskTypesClient = new RegionDiskTypesClient(); - * try { - * $diskType = 'disk_type'; - * $project = 'project'; - * $region = 'region'; - * $response = $regionDiskTypesClient->get($diskType, $project, $region); - * } finally { - * $regionDiskTypesClient->close(); - * } - * ``` - * - * @param string $diskType Name of the disk type to return. - * @param string $project Project ID for this request. - * @param string $region The name of the region for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\DiskType - * - * @throws ApiException if the remote call fails - */ - public function get($diskType, $project, $region, array $optionalArgs = []) - { - $request = new GetRegionDiskTypeRequest(); - $requestParamHeaders = []; - $request->setDiskType($diskType); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['disk_type'] = $diskType; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', DiskType::class, $optionalArgs, $request)->wait(); - } - - /** - * Retrieves a list of regional disk types available to the specified project. - * - * Sample code: - * ``` - * $regionDiskTypesClient = new RegionDiskTypesClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * // Iterate over pages of elements - * $pagedResponse = $regionDiskTypesClient->list($project, $region); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $regionDiskTypesClient->list($project, $region); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $regionDiskTypesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region The name of the region for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, $region, array $optionalArgs = []) - { - $request = new ListRegionDiskTypesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, RegionDiskTypeList::class, $request); - } -} diff --git a/Compute/src/V1/Gapic/RegionDisksGapicClient.php b/Compute/src/V1/Gapic/RegionDisksGapicClient.php deleted file mode 100644 index bbb617537635..000000000000 --- a/Compute/src/V1/Gapic/RegionDisksGapicClient.php +++ /dev/null @@ -1,1522 +0,0 @@ -addResourcePolicies($disk, $project, $region, $regionDisksAddResourcePoliciesRequestResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionDisksClient->addResourcePolicies($disk, $project, $region, $regionDisksAddResourcePoliciesRequestResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionDisksClient->resumeOperation($operationName, 'addResourcePolicies'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionDisksClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\RegionDisksClient}. - */ -class RegionDisksGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.RegionDisks'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/region_disks_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/region_disks_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/region_disks_rest_client_config.php', - ], - ], - 'operationsClientClass' => RegionOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an RegionOperationsClient object with the same endpoint as $this. - * - * @return RegionOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetRegionOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteRegionOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method for the - * supported options. - * @type callable $clientCertSource - * A callable which returns the client cert as a string. This can be used to - * provide a certificate and private key to the transport layer for mTLS. - * } - * - * @throws ValidationException - */ - public function __construct(array $options = []) - { - $clientOptions = $this->buildClientOptions($options); - $this->setClientOptions($clientOptions); - $this->operationsClient = $this->createOperationsClient($clientOptions); - } - - /** - * Adds existing resource policies to a regional disk. You can only add one policy which will be applied to this disk for scheduling snapshot creation. - * - * Sample code: - * ``` - * $regionDisksClient = new RegionDisksClient(); - * try { - * $disk = 'disk'; - * $project = 'project'; - * $region = 'region'; - * $regionDisksAddResourcePoliciesRequestResource = new RegionDisksAddResourcePoliciesRequest(); - * $operationResponse = $regionDisksClient->addResourcePolicies($disk, $project, $region, $regionDisksAddResourcePoliciesRequestResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionDisksClient->addResourcePolicies($disk, $project, $region, $regionDisksAddResourcePoliciesRequestResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionDisksClient->resumeOperation($operationName, 'addResourcePolicies'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionDisksClient->close(); - * } - * ``` - * - * @param string $disk The disk name for this request. - * @param string $project Project ID for this request. - * @param string $region The name of the region for this request. - * @param RegionDisksAddResourcePoliciesRequest $regionDisksAddResourcePoliciesRequestResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 addResourcePolicies($disk, $project, $region, $regionDisksAddResourcePoliciesRequestResource, array $optionalArgs = []) - { - $request = new AddResourcePoliciesRegionDiskRequest(); - $requestParamHeaders = []; - $request->setDisk($disk); - $request->setProject($project); - $request->setRegion($region); - $request->setRegionDisksAddResourcePoliciesRequestResource($regionDisksAddResourcePoliciesRequestResource); - $requestParamHeaders['disk'] = $disk; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('AddResourcePolicies', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Bulk create a set of disks. - * - * Sample code: - * ``` - * $regionDisksClient = new RegionDisksClient(); - * try { - * $bulkInsertDiskResourceResource = new BulkInsertDiskResource(); - * $project = 'project'; - * $region = 'region'; - * $operationResponse = $regionDisksClient->bulkInsert($bulkInsertDiskResourceResource, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionDisksClient->bulkInsert($bulkInsertDiskResourceResource, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionDisksClient->resumeOperation($operationName, 'bulkInsert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionDisksClient->close(); - * } - * ``` - * - * @param BulkInsertDiskResource $bulkInsertDiskResourceResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $region The name of the region for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 bulkInsert($bulkInsertDiskResourceResource, $project, $region, array $optionalArgs = []) - { - $request = new BulkInsertRegionDiskRequest(); - $requestParamHeaders = []; - $request->setBulkInsertDiskResourceResource($bulkInsertDiskResourceResource); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('BulkInsert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Creates a snapshot of a specified persistent disk. For regular snapshot creation, consider using snapshots.insert instead, as that method supports more features, such as creating snapshots in a project different from the source disk project. - * - * Sample code: - * ``` - * $regionDisksClient = new RegionDisksClient(); - * try { - * $disk = 'disk'; - * $project = 'project'; - * $region = 'region'; - * $snapshotResource = new Snapshot(); - * $operationResponse = $regionDisksClient->createSnapshot($disk, $project, $region, $snapshotResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionDisksClient->createSnapshot($disk, $project, $region, $snapshotResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionDisksClient->resumeOperation($operationName, 'createSnapshot'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionDisksClient->close(); - * } - * ``` - * - * @param string $disk Name of the regional persistent disk to snapshot. - * @param string $project Project ID for this request. - * @param string $region Name of the region for this request. - * @param Snapshot $snapshotResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 createSnapshot($disk, $project, $region, $snapshotResource, array $optionalArgs = []) - { - $request = new CreateSnapshotRegionDiskRequest(); - $requestParamHeaders = []; - $request->setDisk($disk); - $request->setProject($project); - $request->setRegion($region); - $request->setSnapshotResource($snapshotResource); - $requestParamHeaders['disk'] = $disk; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('CreateSnapshot', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Deletes the specified regional persistent disk. Deleting a regional disk removes all the replicas of its data permanently and is irreversible. However, deleting a disk does not delete any snapshots previously made from the disk. You must separately delete snapshots. - * - * Sample code: - * ``` - * $regionDisksClient = new RegionDisksClient(); - * try { - * $disk = 'disk'; - * $project = 'project'; - * $region = 'region'; - * $operationResponse = $regionDisksClient->delete($disk, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionDisksClient->delete($disk, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionDisksClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionDisksClient->close(); - * } - * ``` - * - * @param string $disk Name of the regional persistent disk to delete. - * @param string $project Project ID for this request. - * @param string $region Name of the region for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($disk, $project, $region, array $optionalArgs = []) - { - $request = new DeleteRegionDiskRequest(); - $requestParamHeaders = []; - $request->setDisk($disk); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['disk'] = $disk; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns a specified regional persistent disk. - * - * Sample code: - * ``` - * $regionDisksClient = new RegionDisksClient(); - * try { - * $disk = 'disk'; - * $project = 'project'; - * $region = 'region'; - * $response = $regionDisksClient->get($disk, $project, $region); - * } finally { - * $regionDisksClient->close(); - * } - * ``` - * - * @param string $disk Name of the regional persistent disk to return. - * @param string $project Project ID for this request. - * @param string $region Name of the region for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Disk - * - * @throws ApiException if the remote call fails - */ - public function get($disk, $project, $region, array $optionalArgs = []) - { - $request = new GetRegionDiskRequest(); - $requestParamHeaders = []; - $request->setDisk($disk); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['disk'] = $disk; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', Disk::class, $optionalArgs, $request)->wait(); - } - - /** - * Gets the access control policy for a resource. May be empty if no such policy or resource exists. - * - * Sample code: - * ``` - * $regionDisksClient = new RegionDisksClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $resource = 'resource'; - * $response = $regionDisksClient->getIamPolicy($project, $region, $resource); - * } finally { - * $regionDisksClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region The name of the region for this request. - * @param string $resource Name or id of the resource for this request. - * @param array $optionalArgs { - * Optional. - * - * @type int $optionsRequestedPolicyVersion - * Requested IAM Policy version. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function getIamPolicy($project, $region, $resource, array $optionalArgs = []) - { - $request = new GetIamPolicyRegionDiskRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setResource($resource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['optionsRequestedPolicyVersion'])) { - $request->setOptionsRequestedPolicyVersion($optionalArgs['optionsRequestedPolicyVersion']); - } - - $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(); - } - - /** - * Creates a persistent regional disk in the specified project using the data included in the request. - * - * Sample code: - * ``` - * $regionDisksClient = new RegionDisksClient(); - * try { - * $diskResource = new Disk(); - * $project = 'project'; - * $region = 'region'; - * $operationResponse = $regionDisksClient->insert($diskResource, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionDisksClient->insert($diskResource, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionDisksClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionDisksClient->close(); - * } - * ``` - * - * @param Disk $diskResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $region Name of the region for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 $sourceImage - * Source image to restore onto a disk. This field is optional. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 insert($diskResource, $project, $region, array $optionalArgs = []) - { - $request = new InsertRegionDiskRequest(); - $requestParamHeaders = []; - $request->setDiskResource($diskResource); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - if (isset($optionalArgs['sourceImage'])) { - $request->setSourceImage($optionalArgs['sourceImage']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Retrieves the list of persistent disks contained within the specified region. - * - * Sample code: - * ``` - * $regionDisksClient = new RegionDisksClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * // Iterate over pages of elements - * $pagedResponse = $regionDisksClient->list($project, $region); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $regionDisksClient->list($project, $region); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $regionDisksClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, $region, array $optionalArgs = []) - { - $request = new ListRegionDisksRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, DiskList::class, $request); - } - - /** - * Removes resource policies from a regional disk. - * - * Sample code: - * ``` - * $regionDisksClient = new RegionDisksClient(); - * try { - * $disk = 'disk'; - * $project = 'project'; - * $region = 'region'; - * $regionDisksRemoveResourcePoliciesRequestResource = new RegionDisksRemoveResourcePoliciesRequest(); - * $operationResponse = $regionDisksClient->removeResourcePolicies($disk, $project, $region, $regionDisksRemoveResourcePoliciesRequestResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionDisksClient->removeResourcePolicies($disk, $project, $region, $regionDisksRemoveResourcePoliciesRequestResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionDisksClient->resumeOperation($operationName, 'removeResourcePolicies'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionDisksClient->close(); - * } - * ``` - * - * @param string $disk The disk name for this request. - * @param string $project Project ID for this request. - * @param string $region The name of the region for this request. - * @param RegionDisksRemoveResourcePoliciesRequest $regionDisksRemoveResourcePoliciesRequestResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 removeResourcePolicies($disk, $project, $region, $regionDisksRemoveResourcePoliciesRequestResource, array $optionalArgs = []) - { - $request = new RemoveResourcePoliciesRegionDiskRequest(); - $requestParamHeaders = []; - $request->setDisk($disk); - $request->setProject($project); - $request->setRegion($region); - $request->setRegionDisksRemoveResourcePoliciesRequestResource($regionDisksRemoveResourcePoliciesRequestResource); - $requestParamHeaders['disk'] = $disk; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('RemoveResourcePolicies', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Resizes the specified regional persistent disk. - * - * Sample code: - * ``` - * $regionDisksClient = new RegionDisksClient(); - * try { - * $disk = 'disk'; - * $project = 'project'; - * $region = 'region'; - * $regionDisksResizeRequestResource = new RegionDisksResizeRequest(); - * $operationResponse = $regionDisksClient->resize($disk, $project, $region, $regionDisksResizeRequestResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionDisksClient->resize($disk, $project, $region, $regionDisksResizeRequestResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionDisksClient->resumeOperation($operationName, 'resize'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionDisksClient->close(); - * } - * ``` - * - * @param string $disk Name of the regional persistent disk. - * @param string $project The project ID for this request. - * @param string $region Name of the region for this request. - * @param RegionDisksResizeRequest $regionDisksResizeRequestResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 resize($disk, $project, $region, $regionDisksResizeRequestResource, array $optionalArgs = []) - { - $request = new ResizeRegionDiskRequest(); - $requestParamHeaders = []; - $request->setDisk($disk); - $request->setProject($project); - $request->setRegion($region); - $request->setRegionDisksResizeRequestResource($regionDisksResizeRequestResource); - $requestParamHeaders['disk'] = $disk; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('Resize', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Sets the access control policy on the specified resource. Replaces any existing policy. - * - * Sample code: - * ``` - * $regionDisksClient = new RegionDisksClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $regionSetPolicyRequestResource = new RegionSetPolicyRequest(); - * $resource = 'resource'; - * $response = $regionDisksClient->setIamPolicy($project, $region, $regionSetPolicyRequestResource, $resource); - * } finally { - * $regionDisksClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region The name of the region for this request. - * @param RegionSetPolicyRequest $regionSetPolicyRequestResource The body resource for this request - * @param string $resource Name or id of the resource for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function setIamPolicy($project, $region, $regionSetPolicyRequestResource, $resource, array $optionalArgs = []) - { - $request = new SetIamPolicyRegionDiskRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setRegionSetPolicyRequestResource($regionSetPolicyRequestResource); - $request->setResource($resource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['resource'] = $resource; - $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(); - } - - /** - * Sets the labels on the target regional disk. - * - * Sample code: - * ``` - * $regionDisksClient = new RegionDisksClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $regionSetLabelsRequestResource = new RegionSetLabelsRequest(); - * $resource = 'resource'; - * $operationResponse = $regionDisksClient->setLabels($project, $region, $regionSetLabelsRequestResource, $resource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionDisksClient->setLabels($project, $region, $regionSetLabelsRequestResource, $resource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionDisksClient->resumeOperation($operationName, 'setLabels'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionDisksClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region The region for this request. - * @param RegionSetLabelsRequest $regionSetLabelsRequestResource The body resource for this request - * @param string $resource Name or id of the resource for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 setLabels($project, $region, $regionSetLabelsRequestResource, $resource, array $optionalArgs = []) - { - $request = new SetLabelsRegionDiskRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setRegionSetLabelsRequestResource($regionSetLabelsRequestResource); - $request->setResource($resource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['resource'] = $resource; - 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('SetLabels', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Starts asynchronous replication. Must be invoked on the primary disk. - * - * Sample code: - * ``` - * $regionDisksClient = new RegionDisksClient(); - * try { - * $disk = 'disk'; - * $project = 'project'; - * $region = 'region'; - * $regionDisksStartAsyncReplicationRequestResource = new RegionDisksStartAsyncReplicationRequest(); - * $operationResponse = $regionDisksClient->startAsyncReplication($disk, $project, $region, $regionDisksStartAsyncReplicationRequestResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionDisksClient->startAsyncReplication($disk, $project, $region, $regionDisksStartAsyncReplicationRequestResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionDisksClient->resumeOperation($operationName, 'startAsyncReplication'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionDisksClient->close(); - * } - * ``` - * - * @param string $disk The name of the persistent disk. - * @param string $project Project ID for this request. - * @param string $region The name of the region for this request. - * @param RegionDisksStartAsyncReplicationRequest $regionDisksStartAsyncReplicationRequestResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 startAsyncReplication($disk, $project, $region, $regionDisksStartAsyncReplicationRequestResource, array $optionalArgs = []) - { - $request = new StartAsyncReplicationRegionDiskRequest(); - $requestParamHeaders = []; - $request->setDisk($disk); - $request->setProject($project); - $request->setRegion($region); - $request->setRegionDisksStartAsyncReplicationRequestResource($regionDisksStartAsyncReplicationRequestResource); - $requestParamHeaders['disk'] = $disk; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('StartAsyncReplication', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Stops asynchronous replication. Can be invoked either on the primary or on the secondary disk. - * - * Sample code: - * ``` - * $regionDisksClient = new RegionDisksClient(); - * try { - * $disk = 'disk'; - * $project = 'project'; - * $region = 'region'; - * $operationResponse = $regionDisksClient->stopAsyncReplication($disk, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionDisksClient->stopAsyncReplication($disk, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionDisksClient->resumeOperation($operationName, 'stopAsyncReplication'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionDisksClient->close(); - * } - * ``` - * - * @param string $disk The name of the persistent disk. - * @param string $project Project ID for this request. - * @param string $region The name of the region for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 stopAsyncReplication($disk, $project, $region, array $optionalArgs = []) - { - $request = new StopAsyncReplicationRegionDiskRequest(); - $requestParamHeaders = []; - $request->setDisk($disk); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['disk'] = $disk; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('StopAsyncReplication', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Stops asynchronous replication for a consistency group of disks. Can be invoked either in the primary or secondary scope. - * - * Sample code: - * ``` - * $regionDisksClient = new RegionDisksClient(); - * try { - * $disksStopGroupAsyncReplicationResourceResource = new DisksStopGroupAsyncReplicationResource(); - * $project = 'project'; - * $region = 'region'; - * $operationResponse = $regionDisksClient->stopGroupAsyncReplication($disksStopGroupAsyncReplicationResourceResource, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionDisksClient->stopGroupAsyncReplication($disksStopGroupAsyncReplicationResourceResource, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionDisksClient->resumeOperation($operationName, 'stopGroupAsyncReplication'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionDisksClient->close(); - * } - * ``` - * - * @param DisksStopGroupAsyncReplicationResource $disksStopGroupAsyncReplicationResourceResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $region The name of the region for this request. This must be the region of the primary or secondary disks in the consistency group. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 stopGroupAsyncReplication($disksStopGroupAsyncReplicationResourceResource, $project, $region, array $optionalArgs = []) - { - $request = new StopGroupAsyncReplicationRegionDiskRequest(); - $requestParamHeaders = []; - $request->setDisksStopGroupAsyncReplicationResourceResource($disksStopGroupAsyncReplicationResourceResource); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('StopGroupAsyncReplication', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns permissions that a caller has on the specified resource. - * - * Sample code: - * ``` - * $regionDisksClient = new RegionDisksClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $resource = 'resource'; - * $testPermissionsRequestResource = new TestPermissionsRequest(); - * $response = $regionDisksClient->testIamPermissions($project, $region, $resource, $testPermissionsRequestResource); - * } finally { - * $regionDisksClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region The name of the region for this request. - * @param string $resource Name or id of the resource for this request. - * @param TestPermissionsRequest $testPermissionsRequestResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\TestPermissionsResponse - * - * @throws ApiException if the remote call fails - */ - public function testIamPermissions($project, $region, $resource, $testPermissionsRequestResource, array $optionalArgs = []) - { - $request = new TestIamPermissionsRegionDiskRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setResource($resource); - $request->setTestPermissionsRequestResource($testPermissionsRequestResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['resource'] = $resource; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('TestIamPermissions', TestPermissionsResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Update the specified disk with the data included in the request. Update is performed only on selected fields included as part of update-mask. Only the following fields can be modified: user_license. - * - * Sample code: - * ``` - * $regionDisksClient = new RegionDisksClient(); - * try { - * $disk = 'disk'; - * $diskResource = new Disk(); - * $project = 'project'; - * $region = 'region'; - * $operationResponse = $regionDisksClient->update($disk, $diskResource, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionDisksClient->update($disk, $diskResource, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionDisksClient->resumeOperation($operationName, 'update'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionDisksClient->close(); - * } - * ``` - * - * @param string $disk The disk name for this request. - * @param Disk $diskResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $region The name of the region for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $paths - * @type string $requestId - * 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. 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 $updateMask - * update_mask indicates fields to be updated as part of this request. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 update($disk, $diskResource, $project, $region, array $optionalArgs = []) - { - $request = new UpdateRegionDiskRequest(); - $requestParamHeaders = []; - $request->setDisk($disk); - $request->setDiskResource($diskResource); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['disk'] = $disk; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - if (isset($optionalArgs['paths'])) { - $request->setPaths($optionalArgs['paths']); - } - - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('Update', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/RegionHealthCheckServicesGapicClient.php b/Compute/src/V1/Gapic/RegionHealthCheckServicesGapicClient.php deleted file mode 100644 index 8d06871eba2c..000000000000 --- a/Compute/src/V1/Gapic/RegionHealthCheckServicesGapicClient.php +++ /dev/null @@ -1,627 +0,0 @@ -delete($healthCheckService, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionHealthCheckServicesClient->delete($healthCheckService, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionHealthCheckServicesClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionHealthCheckServicesClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\RegionHealthCheckServicesClient}. - */ -class RegionHealthCheckServicesGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.RegionHealthCheckServices'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/region_health_check_services_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/region_health_check_services_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/region_health_check_services_rest_client_config.php', - ], - ], - 'operationsClientClass' => RegionOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an RegionOperationsClient object with the same endpoint as $this. - * - * @return RegionOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetRegionOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteRegionOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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 the specified regional HealthCheckService. - * - * Sample code: - * ``` - * $regionHealthCheckServicesClient = new RegionHealthCheckServicesClient(); - * try { - * $healthCheckService = 'health_check_service'; - * $project = 'project'; - * $region = 'region'; - * $operationResponse = $regionHealthCheckServicesClient->delete($healthCheckService, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionHealthCheckServicesClient->delete($healthCheckService, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionHealthCheckServicesClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionHealthCheckServicesClient->close(); - * } - * ``` - * - * @param string $healthCheckService Name of the HealthCheckService to delete. The name must be 1-63 characters long, and comply with RFC1035. - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($healthCheckService, $project, $region, array $optionalArgs = []) - { - $request = new DeleteRegionHealthCheckServiceRequest(); - $requestParamHeaders = []; - $request->setHealthCheckService($healthCheckService); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['health_check_service'] = $healthCheckService; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns the specified regional HealthCheckService resource. - * - * Sample code: - * ``` - * $regionHealthCheckServicesClient = new RegionHealthCheckServicesClient(); - * try { - * $healthCheckService = 'health_check_service'; - * $project = 'project'; - * $region = 'region'; - * $response = $regionHealthCheckServicesClient->get($healthCheckService, $project, $region); - * } finally { - * $regionHealthCheckServicesClient->close(); - * } - * ``` - * - * @param string $healthCheckService Name of the HealthCheckService to update. The name must be 1-63 characters long, and comply with RFC1035. - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\HealthCheckService - * - * @throws ApiException if the remote call fails - */ - public function get($healthCheckService, $project, $region, array $optionalArgs = []) - { - $request = new GetRegionHealthCheckServiceRequest(); - $requestParamHeaders = []; - $request->setHealthCheckService($healthCheckService); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['health_check_service'] = $healthCheckService; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', HealthCheckService::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates a regional HealthCheckService resource in the specified project and region using the data included in the request. - * - * Sample code: - * ``` - * $regionHealthCheckServicesClient = new RegionHealthCheckServicesClient(); - * try { - * $healthCheckServiceResource = new HealthCheckService(); - * $project = 'project'; - * $region = 'region'; - * $operationResponse = $regionHealthCheckServicesClient->insert($healthCheckServiceResource, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionHealthCheckServicesClient->insert($healthCheckServiceResource, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionHealthCheckServicesClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionHealthCheckServicesClient->close(); - * } - * ``` - * - * @param HealthCheckService $healthCheckServiceResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 insert($healthCheckServiceResource, $project, $region, array $optionalArgs = []) - { - $request = new InsertRegionHealthCheckServiceRequest(); - $requestParamHeaders = []; - $request->setHealthCheckServiceResource($healthCheckServiceResource); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Lists all the HealthCheckService resources that have been configured for the specified project in the given region. - * - * Sample code: - * ``` - * $regionHealthCheckServicesClient = new RegionHealthCheckServicesClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * // Iterate over pages of elements - * $pagedResponse = $regionHealthCheckServicesClient->list($project, $region); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $regionHealthCheckServicesClient->list($project, $region); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $regionHealthCheckServicesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, $region, array $optionalArgs = []) - { - $request = new ListRegionHealthCheckServicesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, HealthCheckServicesList::class, $request); - } - - /** - * Updates the specified regional HealthCheckService resource with the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. - * - * Sample code: - * ``` - * $regionHealthCheckServicesClient = new RegionHealthCheckServicesClient(); - * try { - * $healthCheckService = 'health_check_service'; - * $healthCheckServiceResource = new HealthCheckService(); - * $project = 'project'; - * $region = 'region'; - * $operationResponse = $regionHealthCheckServicesClient->patch($healthCheckService, $healthCheckServiceResource, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionHealthCheckServicesClient->patch($healthCheckService, $healthCheckServiceResource, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionHealthCheckServicesClient->resumeOperation($operationName, 'patch'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionHealthCheckServicesClient->close(); - * } - * ``` - * - * @param string $healthCheckService Name of the HealthCheckService to update. The name must be 1-63 characters long, and comply with RFC1035. - * @param HealthCheckService $healthCheckServiceResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 patch($healthCheckService, $healthCheckServiceResource, $project, $region, array $optionalArgs = []) - { - $request = new PatchRegionHealthCheckServiceRequest(); - $requestParamHeaders = []; - $request->setHealthCheckService($healthCheckService); - $request->setHealthCheckServiceResource($healthCheckServiceResource); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['health_check_service'] = $healthCheckService; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('Patch', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/RegionHealthChecksGapicClient.php b/Compute/src/V1/Gapic/RegionHealthChecksGapicClient.php deleted file mode 100644 index cac401baa6ce..000000000000 --- a/Compute/src/V1/Gapic/RegionHealthChecksGapicClient.php +++ /dev/null @@ -1,707 +0,0 @@ -delete($healthCheck, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionHealthChecksClient->delete($healthCheck, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionHealthChecksClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionHealthChecksClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\RegionHealthChecksClient}. - */ -class RegionHealthChecksGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.RegionHealthChecks'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/region_health_checks_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/region_health_checks_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/region_health_checks_rest_client_config.php', - ], - ], - 'operationsClientClass' => RegionOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an RegionOperationsClient object with the same endpoint as $this. - * - * @return RegionOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetRegionOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteRegionOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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 the specified HealthCheck resource. - * - * Sample code: - * ``` - * $regionHealthChecksClient = new RegionHealthChecksClient(); - * try { - * $healthCheck = 'health_check'; - * $project = 'project'; - * $region = 'region'; - * $operationResponse = $regionHealthChecksClient->delete($healthCheck, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionHealthChecksClient->delete($healthCheck, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionHealthChecksClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionHealthChecksClient->close(); - * } - * ``` - * - * @param string $healthCheck Name of the HealthCheck resource to delete. - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($healthCheck, $project, $region, array $optionalArgs = []) - { - $request = new DeleteRegionHealthCheckRequest(); - $requestParamHeaders = []; - $request->setHealthCheck($healthCheck); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['health_check'] = $healthCheck; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns the specified HealthCheck resource. - * - * Sample code: - * ``` - * $regionHealthChecksClient = new RegionHealthChecksClient(); - * try { - * $healthCheck = 'health_check'; - * $project = 'project'; - * $region = 'region'; - * $response = $regionHealthChecksClient->get($healthCheck, $project, $region); - * } finally { - * $regionHealthChecksClient->close(); - * } - * ``` - * - * @param string $healthCheck Name of the HealthCheck resource to return. - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\HealthCheck - * - * @throws ApiException if the remote call fails - */ - public function get($healthCheck, $project, $region, array $optionalArgs = []) - { - $request = new GetRegionHealthCheckRequest(); - $requestParamHeaders = []; - $request->setHealthCheck($healthCheck); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['health_check'] = $healthCheck; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', HealthCheck::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates a HealthCheck resource in the specified project using the data included in the request. - * - * Sample code: - * ``` - * $regionHealthChecksClient = new RegionHealthChecksClient(); - * try { - * $healthCheckResource = new HealthCheck(); - * $project = 'project'; - * $region = 'region'; - * $operationResponse = $regionHealthChecksClient->insert($healthCheckResource, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionHealthChecksClient->insert($healthCheckResource, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionHealthChecksClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionHealthChecksClient->close(); - * } - * ``` - * - * @param HealthCheck $healthCheckResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 insert($healthCheckResource, $project, $region, array $optionalArgs = []) - { - $request = new InsertRegionHealthCheckRequest(); - $requestParamHeaders = []; - $request->setHealthCheckResource($healthCheckResource); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Retrieves the list of HealthCheck resources available to the specified project. - * - * Sample code: - * ``` - * $regionHealthChecksClient = new RegionHealthChecksClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * // Iterate over pages of elements - * $pagedResponse = $regionHealthChecksClient->list($project, $region); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $regionHealthChecksClient->list($project, $region); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $regionHealthChecksClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, $region, array $optionalArgs = []) - { - $request = new ListRegionHealthChecksRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, HealthCheckList::class, $request); - } - - /** - * Updates a HealthCheck resource in the specified project using the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. - * - * Sample code: - * ``` - * $regionHealthChecksClient = new RegionHealthChecksClient(); - * try { - * $healthCheck = 'health_check'; - * $healthCheckResource = new HealthCheck(); - * $project = 'project'; - * $region = 'region'; - * $operationResponse = $regionHealthChecksClient->patch($healthCheck, $healthCheckResource, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionHealthChecksClient->patch($healthCheck, $healthCheckResource, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionHealthChecksClient->resumeOperation($operationName, 'patch'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionHealthChecksClient->close(); - * } - * ``` - * - * @param string $healthCheck Name of the HealthCheck resource to patch. - * @param HealthCheck $healthCheckResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 patch($healthCheck, $healthCheckResource, $project, $region, array $optionalArgs = []) - { - $request = new PatchRegionHealthCheckRequest(); - $requestParamHeaders = []; - $request->setHealthCheck($healthCheck); - $request->setHealthCheckResource($healthCheckResource); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['health_check'] = $healthCheck; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('Patch', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Updates a HealthCheck resource in the specified project using the data included in the request. - * - * Sample code: - * ``` - * $regionHealthChecksClient = new RegionHealthChecksClient(); - * try { - * $healthCheck = 'health_check'; - * $healthCheckResource = new HealthCheck(); - * $project = 'project'; - * $region = 'region'; - * $operationResponse = $regionHealthChecksClient->update($healthCheck, $healthCheckResource, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionHealthChecksClient->update($healthCheck, $healthCheckResource, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionHealthChecksClient->resumeOperation($operationName, 'update'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionHealthChecksClient->close(); - * } - * ``` - * - * @param string $healthCheck Name of the HealthCheck resource to update. - * @param HealthCheck $healthCheckResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 update($healthCheck, $healthCheckResource, $project, $region, array $optionalArgs = []) - { - $request = new UpdateRegionHealthCheckRequest(); - $requestParamHeaders = []; - $request->setHealthCheck($healthCheck); - $request->setHealthCheckResource($healthCheckResource); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['health_check'] = $healthCheck; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('Update', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/RegionInstanceGroupManagersGapicClient.php b/Compute/src/V1/Gapic/RegionInstanceGroupManagersGapicClient.php deleted file mode 100644 index 14e8bf40a259..000000000000 --- a/Compute/src/V1/Gapic/RegionInstanceGroupManagersGapicClient.php +++ /dev/null @@ -1,2112 +0,0 @@ -abandonInstances($instanceGroupManager, $project, $region, $regionInstanceGroupManagersAbandonInstancesRequestResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionInstanceGroupManagersClient->abandonInstances($instanceGroupManager, $project, $region, $regionInstanceGroupManagersAbandonInstancesRequestResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionInstanceGroupManagersClient->resumeOperation($operationName, 'abandonInstances'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionInstanceGroupManagersClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\RegionInstanceGroupManagersClient}. - */ -class RegionInstanceGroupManagersGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.RegionInstanceGroupManagers'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/region_instance_group_managers_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/region_instance_group_managers_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/region_instance_group_managers_rest_client_config.php', - ], - ], - 'operationsClientClass' => RegionOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an RegionOperationsClient object with the same endpoint as $this. - * - * @return RegionOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetRegionOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteRegionOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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); - } - - /** - * Flags the specified instances to be immediately removed from the managed instance group. Abandoning an instance does not delete the instance, but it does remove the instance from any target pools that are applied by the managed instance group. This method reduces the targetSize of the managed instance group by the number of instances that you abandon. This operation is marked as DONE when the action is scheduled even if the instances have not yet been removed from the group. You must separately verify the status of the abandoning action with the listmanagedinstances method. If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is removed or deleted. You can specify a maximum of 1000 instances with this method per request. - * - * Sample code: - * ``` - * $regionInstanceGroupManagersClient = new RegionInstanceGroupManagersClient(); - * try { - * $instanceGroupManager = 'instance_group_manager'; - * $project = 'project'; - * $region = 'region'; - * $regionInstanceGroupManagersAbandonInstancesRequestResource = new RegionInstanceGroupManagersAbandonInstancesRequest(); - * $operationResponse = $regionInstanceGroupManagersClient->abandonInstances($instanceGroupManager, $project, $region, $regionInstanceGroupManagersAbandonInstancesRequestResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionInstanceGroupManagersClient->abandonInstances($instanceGroupManager, $project, $region, $regionInstanceGroupManagersAbandonInstancesRequestResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionInstanceGroupManagersClient->resumeOperation($operationName, 'abandonInstances'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionInstanceGroupManagersClient->close(); - * } - * ``` - * - * @param string $instanceGroupManager Name of the managed instance group. - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param RegionInstanceGroupManagersAbandonInstancesRequest $regionInstanceGroupManagersAbandonInstancesRequestResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 abandonInstances($instanceGroupManager, $project, $region, $regionInstanceGroupManagersAbandonInstancesRequestResource, array $optionalArgs = []) - { - $request = new AbandonInstancesRegionInstanceGroupManagerRequest(); - $requestParamHeaders = []; - $request->setInstanceGroupManager($instanceGroupManager); - $request->setProject($project); - $request->setRegion($region); - $request->setRegionInstanceGroupManagersAbandonInstancesRequestResource($regionInstanceGroupManagersAbandonInstancesRequestResource); - $requestParamHeaders['instance_group_manager'] = $instanceGroupManager; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('AbandonInstances', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Apply updates to selected instances the managed instance group. - * - * Sample code: - * ``` - * $regionInstanceGroupManagersClient = new RegionInstanceGroupManagersClient(); - * try { - * $instanceGroupManager = 'instance_group_manager'; - * $project = 'project'; - * $region = 'region'; - * $regionInstanceGroupManagersApplyUpdatesRequestResource = new RegionInstanceGroupManagersApplyUpdatesRequest(); - * $operationResponse = $regionInstanceGroupManagersClient->applyUpdatesToInstances($instanceGroupManager, $project, $region, $regionInstanceGroupManagersApplyUpdatesRequestResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionInstanceGroupManagersClient->applyUpdatesToInstances($instanceGroupManager, $project, $region, $regionInstanceGroupManagersApplyUpdatesRequestResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionInstanceGroupManagersClient->resumeOperation($operationName, 'applyUpdatesToInstances'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionInstanceGroupManagersClient->close(); - * } - * ``` - * - * @param string $instanceGroupManager The name of the managed instance group, should conform to RFC1035. - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request, should conform to RFC1035. - * @param RegionInstanceGroupManagersApplyUpdatesRequest $regionInstanceGroupManagersApplyUpdatesRequestResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 applyUpdatesToInstances($instanceGroupManager, $project, $region, $regionInstanceGroupManagersApplyUpdatesRequestResource, array $optionalArgs = []) - { - $request = new ApplyUpdatesToInstancesRegionInstanceGroupManagerRequest(); - $requestParamHeaders = []; - $request->setInstanceGroupManager($instanceGroupManager); - $request->setProject($project); - $request->setRegion($region); - $request->setRegionInstanceGroupManagersApplyUpdatesRequestResource($regionInstanceGroupManagersApplyUpdatesRequestResource); - $requestParamHeaders['instance_group_manager'] = $instanceGroupManager; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('ApplyUpdatesToInstances', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Creates instances with per-instance configurations in this regional managed instance group. Instances are created using the current instance template. The create instances operation is marked DONE if the createInstances request is successful. The underlying actions take additional time. You must separately verify the status of the creating or actions with the listmanagedinstances method. - * - * Sample code: - * ``` - * $regionInstanceGroupManagersClient = new RegionInstanceGroupManagersClient(); - * try { - * $instanceGroupManager = 'instance_group_manager'; - * $project = 'project'; - * $region = 'region'; - * $regionInstanceGroupManagersCreateInstancesRequestResource = new RegionInstanceGroupManagersCreateInstancesRequest(); - * $operationResponse = $regionInstanceGroupManagersClient->createInstances($instanceGroupManager, $project, $region, $regionInstanceGroupManagersCreateInstancesRequestResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionInstanceGroupManagersClient->createInstances($instanceGroupManager, $project, $region, $regionInstanceGroupManagersCreateInstancesRequestResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionInstanceGroupManagersClient->resumeOperation($operationName, 'createInstances'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionInstanceGroupManagersClient->close(); - * } - * ``` - * - * @param string $instanceGroupManager The name of the managed instance group. It should conform to RFC1035. - * @param string $project Project ID for this request. - * @param string $region The name of the region where the managed instance group is located. It should conform to RFC1035. - * @param RegionInstanceGroupManagersCreateInstancesRequest $regionInstanceGroupManagersCreateInstancesRequestResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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. 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 createInstances($instanceGroupManager, $project, $region, $regionInstanceGroupManagersCreateInstancesRequestResource, array $optionalArgs = []) - { - $request = new CreateInstancesRegionInstanceGroupManagerRequest(); - $requestParamHeaders = []; - $request->setInstanceGroupManager($instanceGroupManager); - $request->setProject($project); - $request->setRegion($region); - $request->setRegionInstanceGroupManagersCreateInstancesRequestResource($regionInstanceGroupManagersCreateInstancesRequestResource); - $requestParamHeaders['instance_group_manager'] = $instanceGroupManager; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('CreateInstances', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Deletes the specified managed instance group and all of the instances in that group. - * - * Sample code: - * ``` - * $regionInstanceGroupManagersClient = new RegionInstanceGroupManagersClient(); - * try { - * $instanceGroupManager = 'instance_group_manager'; - * $project = 'project'; - * $region = 'region'; - * $operationResponse = $regionInstanceGroupManagersClient->delete($instanceGroupManager, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionInstanceGroupManagersClient->delete($instanceGroupManager, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionInstanceGroupManagersClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionInstanceGroupManagersClient->close(); - * } - * ``` - * - * @param string $instanceGroupManager Name of the managed instance group to delete. - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($instanceGroupManager, $project, $region, array $optionalArgs = []) - { - $request = new DeleteRegionInstanceGroupManagerRequest(); - $requestParamHeaders = []; - $request->setInstanceGroupManager($instanceGroupManager); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['instance_group_manager'] = $instanceGroupManager; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Flags the specified instances in the managed instance group to be immediately deleted. The instances are also removed from any target pools of which they were a member. This method reduces the targetSize of the managed instance group by the number of instances that you delete. The deleteInstances operation is marked DONE if the deleteInstances request is successful. The underlying actions take additional time. You must separately verify the status of the deleting action with the listmanagedinstances method. If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is removed or deleted. You can specify a maximum of 1000 instances with this method per request. - * - * Sample code: - * ``` - * $regionInstanceGroupManagersClient = new RegionInstanceGroupManagersClient(); - * try { - * $instanceGroupManager = 'instance_group_manager'; - * $project = 'project'; - * $region = 'region'; - * $regionInstanceGroupManagersDeleteInstancesRequestResource = new RegionInstanceGroupManagersDeleteInstancesRequest(); - * $operationResponse = $regionInstanceGroupManagersClient->deleteInstances($instanceGroupManager, $project, $region, $regionInstanceGroupManagersDeleteInstancesRequestResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionInstanceGroupManagersClient->deleteInstances($instanceGroupManager, $project, $region, $regionInstanceGroupManagersDeleteInstancesRequestResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionInstanceGroupManagersClient->resumeOperation($operationName, 'deleteInstances'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionInstanceGroupManagersClient->close(); - * } - * ``` - * - * @param string $instanceGroupManager Name of the managed instance group. - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param RegionInstanceGroupManagersDeleteInstancesRequest $regionInstanceGroupManagersDeleteInstancesRequestResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 deleteInstances($instanceGroupManager, $project, $region, $regionInstanceGroupManagersDeleteInstancesRequestResource, array $optionalArgs = []) - { - $request = new DeleteInstancesRegionInstanceGroupManagerRequest(); - $requestParamHeaders = []; - $request->setInstanceGroupManager($instanceGroupManager); - $request->setProject($project); - $request->setRegion($region); - $request->setRegionInstanceGroupManagersDeleteInstancesRequestResource($regionInstanceGroupManagersDeleteInstancesRequestResource); - $requestParamHeaders['instance_group_manager'] = $instanceGroupManager; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('DeleteInstances', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Deletes selected per-instance configurations for the managed instance group. - * - * Sample code: - * ``` - * $regionInstanceGroupManagersClient = new RegionInstanceGroupManagersClient(); - * try { - * $instanceGroupManager = 'instance_group_manager'; - * $project = 'project'; - * $region = 'region'; - * $regionInstanceGroupManagerDeleteInstanceConfigReqResource = new RegionInstanceGroupManagerDeleteInstanceConfigReq(); - * $operationResponse = $regionInstanceGroupManagersClient->deletePerInstanceConfigs($instanceGroupManager, $project, $region, $regionInstanceGroupManagerDeleteInstanceConfigReqResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionInstanceGroupManagersClient->deletePerInstanceConfigs($instanceGroupManager, $project, $region, $regionInstanceGroupManagerDeleteInstanceConfigReqResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionInstanceGroupManagersClient->resumeOperation($operationName, 'deletePerInstanceConfigs'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionInstanceGroupManagersClient->close(); - * } - * ``` - * - * @param string $instanceGroupManager The name of the managed instance group. It should conform to RFC1035. - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request, should conform to RFC1035. - * @param RegionInstanceGroupManagerDeleteInstanceConfigReq $regionInstanceGroupManagerDeleteInstanceConfigReqResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 deletePerInstanceConfigs($instanceGroupManager, $project, $region, $regionInstanceGroupManagerDeleteInstanceConfigReqResource, array $optionalArgs = []) - { - $request = new DeletePerInstanceConfigsRegionInstanceGroupManagerRequest(); - $requestParamHeaders = []; - $request->setInstanceGroupManager($instanceGroupManager); - $request->setProject($project); - $request->setRegion($region); - $request->setRegionInstanceGroupManagerDeleteInstanceConfigReqResource($regionInstanceGroupManagerDeleteInstanceConfigReqResource); - $requestParamHeaders['instance_group_manager'] = $instanceGroupManager; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('DeletePerInstanceConfigs', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns all of the details about the specified managed instance group. - * - * Sample code: - * ``` - * $regionInstanceGroupManagersClient = new RegionInstanceGroupManagersClient(); - * try { - * $instanceGroupManager = 'instance_group_manager'; - * $project = 'project'; - * $region = 'region'; - * $response = $regionInstanceGroupManagersClient->get($instanceGroupManager, $project, $region); - * } finally { - * $regionInstanceGroupManagersClient->close(); - * } - * ``` - * - * @param string $instanceGroupManager Name of the managed instance group to return. - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\InstanceGroupManager - * - * @throws ApiException if the remote call fails - */ - public function get($instanceGroupManager, $project, $region, array $optionalArgs = []) - { - $request = new GetRegionInstanceGroupManagerRequest(); - $requestParamHeaders = []; - $request->setInstanceGroupManager($instanceGroupManager); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['instance_group_manager'] = $instanceGroupManager; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', InstanceGroupManager::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates a managed instance group using the information that you specify in the request. After the group is created, instances in the group are created using the specified instance template. This operation is marked as DONE when the group is created even if the instances in the group have not yet been created. You must separately verify the status of the individual instances with the listmanagedinstances method. A regional managed instance group can contain up to 2000 instances. - * - * Sample code: - * ``` - * $regionInstanceGroupManagersClient = new RegionInstanceGroupManagersClient(); - * try { - * $instanceGroupManagerResource = new InstanceGroupManager(); - * $project = 'project'; - * $region = 'region'; - * $operationResponse = $regionInstanceGroupManagersClient->insert($instanceGroupManagerResource, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionInstanceGroupManagersClient->insert($instanceGroupManagerResource, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionInstanceGroupManagersClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionInstanceGroupManagersClient->close(); - * } - * ``` - * - * @param InstanceGroupManager $instanceGroupManagerResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 insert($instanceGroupManagerResource, $project, $region, array $optionalArgs = []) - { - $request = new InsertRegionInstanceGroupManagerRequest(); - $requestParamHeaders = []; - $request->setInstanceGroupManagerResource($instanceGroupManagerResource); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Retrieves the list of managed instance groups that are contained within the specified region. - * - * Sample code: - * ``` - * $regionInstanceGroupManagersClient = new RegionInstanceGroupManagersClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * // Iterate over pages of elements - * $pagedResponse = $regionInstanceGroupManagersClient->list($project, $region); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $regionInstanceGroupManagersClient->list($project, $region); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $regionInstanceGroupManagersClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, $region, array $optionalArgs = []) - { - $request = new ListRegionInstanceGroupManagersRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, RegionInstanceGroupManagerList::class, $request); - } - - /** - * Lists all errors thrown by actions on instances for a given regional managed instance group. The filter and orderBy query parameters are not supported. - * - * Sample code: - * ``` - * $regionInstanceGroupManagersClient = new RegionInstanceGroupManagersClient(); - * try { - * $instanceGroupManager = 'instance_group_manager'; - * $project = 'project'; - * $region = 'region'; - * // Iterate over pages of elements - * $pagedResponse = $regionInstanceGroupManagersClient->listErrors($instanceGroupManager, $project, $region); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $regionInstanceGroupManagersClient->listErrors($instanceGroupManager, $project, $region); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $regionInstanceGroupManagersClient->close(); - * } - * ``` - * - * @param string $instanceGroupManager The name of the managed instance group. It must be a string that meets the requirements in RFC1035, or an unsigned long integer: must match regexp pattern: (?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?)|1-9{0,19}. - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. This should conform to RFC1035. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 listErrors($instanceGroupManager, $project, $region, array $optionalArgs = []) - { - $request = new ListErrorsRegionInstanceGroupManagersRequest(); - $requestParamHeaders = []; - $request->setInstanceGroupManager($instanceGroupManager); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['instance_group_manager'] = $instanceGroupManager; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('ListErrors', $optionalArgs, RegionInstanceGroupManagersListErrorsResponse::class, $request); - } - - /** - * Lists the instances in the managed instance group and instances that are scheduled to be created. The list includes any current actions that the group has scheduled for its instances. The orderBy query parameter is not supported. The `pageToken` query parameter is supported only if the group's `listManagedInstancesResults` field is set to `PAGINATED`. - * - * Sample code: - * ``` - * $regionInstanceGroupManagersClient = new RegionInstanceGroupManagersClient(); - * try { - * $instanceGroupManager = 'instance_group_manager'; - * $project = 'project'; - * $region = 'region'; - * // Iterate over pages of elements - * $pagedResponse = $regionInstanceGroupManagersClient->listManagedInstances($instanceGroupManager, $project, $region); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $regionInstanceGroupManagersClient->listManagedInstances($instanceGroupManager, $project, $region); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $regionInstanceGroupManagersClient->close(); - * } - * ``` - * - * @param string $instanceGroupManager The name of the managed instance group. - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 listManagedInstances($instanceGroupManager, $project, $region, array $optionalArgs = []) - { - $request = new ListManagedInstancesRegionInstanceGroupManagersRequest(); - $requestParamHeaders = []; - $request->setInstanceGroupManager($instanceGroupManager); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['instance_group_manager'] = $instanceGroupManager; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('ListManagedInstances', $optionalArgs, RegionInstanceGroupManagersListInstancesResponse::class, $request); - } - - /** - * Lists all of the per-instance configurations defined for the managed instance group. The orderBy query parameter is not supported. - * - * Sample code: - * ``` - * $regionInstanceGroupManagersClient = new RegionInstanceGroupManagersClient(); - * try { - * $instanceGroupManager = 'instance_group_manager'; - * $project = 'project'; - * $region = 'region'; - * // Iterate over pages of elements - * $pagedResponse = $regionInstanceGroupManagersClient->listPerInstanceConfigs($instanceGroupManager, $project, $region); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $regionInstanceGroupManagersClient->listPerInstanceConfigs($instanceGroupManager, $project, $region); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $regionInstanceGroupManagersClient->close(); - * } - * ``` - * - * @param string $instanceGroupManager The name of the managed instance group. It should conform to RFC1035. - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request, should conform to RFC1035. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 listPerInstanceConfigs($instanceGroupManager, $project, $region, array $optionalArgs = []) - { - $request = new ListPerInstanceConfigsRegionInstanceGroupManagersRequest(); - $requestParamHeaders = []; - $request->setInstanceGroupManager($instanceGroupManager); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['instance_group_manager'] = $instanceGroupManager; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('ListPerInstanceConfigs', $optionalArgs, RegionInstanceGroupManagersListInstanceConfigsResp::class, $request); - } - - /** - * Updates a managed instance group using the information that you specify in the request. This operation is marked as DONE when the group is patched even if the instances in the group are still in the process of being patched. You must separately verify the status of the individual instances with the listmanagedinstances method. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. If you update your group to specify a new template or instance configuration, it's possible that your intended specification for each VM in the group is different from the current state of that VM. To learn how to apply an updated configuration to the VMs in a MIG, see Updating instances in a MIG. - * - * Sample code: - * ``` - * $regionInstanceGroupManagersClient = new RegionInstanceGroupManagersClient(); - * try { - * $instanceGroupManager = 'instance_group_manager'; - * $instanceGroupManagerResource = new InstanceGroupManager(); - * $project = 'project'; - * $region = 'region'; - * $operationResponse = $regionInstanceGroupManagersClient->patch($instanceGroupManager, $instanceGroupManagerResource, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionInstanceGroupManagersClient->patch($instanceGroupManager, $instanceGroupManagerResource, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionInstanceGroupManagersClient->resumeOperation($operationName, 'patch'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionInstanceGroupManagersClient->close(); - * } - * ``` - * - * @param string $instanceGroupManager The name of the instance group manager. - * @param InstanceGroupManager $instanceGroupManagerResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 patch($instanceGroupManager, $instanceGroupManagerResource, $project, $region, array $optionalArgs = []) - { - $request = new PatchRegionInstanceGroupManagerRequest(); - $requestParamHeaders = []; - $request->setInstanceGroupManager($instanceGroupManager); - $request->setInstanceGroupManagerResource($instanceGroupManagerResource); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['instance_group_manager'] = $instanceGroupManager; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('Patch', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Inserts or patches per-instance configurations for the managed instance group. perInstanceConfig.name serves as a key used to distinguish whether to perform insert or patch. - * - * Sample code: - * ``` - * $regionInstanceGroupManagersClient = new RegionInstanceGroupManagersClient(); - * try { - * $instanceGroupManager = 'instance_group_manager'; - * $project = 'project'; - * $region = 'region'; - * $regionInstanceGroupManagerPatchInstanceConfigReqResource = new RegionInstanceGroupManagerPatchInstanceConfigReq(); - * $operationResponse = $regionInstanceGroupManagersClient->patchPerInstanceConfigs($instanceGroupManager, $project, $region, $regionInstanceGroupManagerPatchInstanceConfigReqResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionInstanceGroupManagersClient->patchPerInstanceConfigs($instanceGroupManager, $project, $region, $regionInstanceGroupManagerPatchInstanceConfigReqResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionInstanceGroupManagersClient->resumeOperation($operationName, 'patchPerInstanceConfigs'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionInstanceGroupManagersClient->close(); - * } - * ``` - * - * @param string $instanceGroupManager The name of the managed instance group. It should conform to RFC1035. - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request, should conform to RFC1035. - * @param RegionInstanceGroupManagerPatchInstanceConfigReq $regionInstanceGroupManagerPatchInstanceConfigReqResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 patchPerInstanceConfigs($instanceGroupManager, $project, $region, $regionInstanceGroupManagerPatchInstanceConfigReqResource, array $optionalArgs = []) - { - $request = new PatchPerInstanceConfigsRegionInstanceGroupManagerRequest(); - $requestParamHeaders = []; - $request->setInstanceGroupManager($instanceGroupManager); - $request->setProject($project); - $request->setRegion($region); - $request->setRegionInstanceGroupManagerPatchInstanceConfigReqResource($regionInstanceGroupManagerPatchInstanceConfigReqResource); - $requestParamHeaders['instance_group_manager'] = $instanceGroupManager; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('PatchPerInstanceConfigs', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Flags the specified VM instances in the managed instance group to be immediately recreated. Each instance is recreated using the group's current configuration. This operation is marked as DONE when the flag is set even if the instances have not yet been recreated. You must separately verify the status of each instance by checking its currentAction field; for more information, see Checking the status of managed instances. If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is removed or deleted. You can specify a maximum of 1000 instances with this method per request. - * - * Sample code: - * ``` - * $regionInstanceGroupManagersClient = new RegionInstanceGroupManagersClient(); - * try { - * $instanceGroupManager = 'instance_group_manager'; - * $project = 'project'; - * $region = 'region'; - * $regionInstanceGroupManagersRecreateRequestResource = new RegionInstanceGroupManagersRecreateRequest(); - * $operationResponse = $regionInstanceGroupManagersClient->recreateInstances($instanceGroupManager, $project, $region, $regionInstanceGroupManagersRecreateRequestResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionInstanceGroupManagersClient->recreateInstances($instanceGroupManager, $project, $region, $regionInstanceGroupManagersRecreateRequestResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionInstanceGroupManagersClient->resumeOperation($operationName, 'recreateInstances'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionInstanceGroupManagersClient->close(); - * } - * ``` - * - * @param string $instanceGroupManager Name of the managed instance group. - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param RegionInstanceGroupManagersRecreateRequest $regionInstanceGroupManagersRecreateRequestResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 recreateInstances($instanceGroupManager, $project, $region, $regionInstanceGroupManagersRecreateRequestResource, array $optionalArgs = []) - { - $request = new RecreateInstancesRegionInstanceGroupManagerRequest(); - $requestParamHeaders = []; - $request->setInstanceGroupManager($instanceGroupManager); - $request->setProject($project); - $request->setRegion($region); - $request->setRegionInstanceGroupManagersRecreateRequestResource($regionInstanceGroupManagersRecreateRequestResource); - $requestParamHeaders['instance_group_manager'] = $instanceGroupManager; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('RecreateInstances', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Changes the intended size of the managed instance group. If you increase the size, the group creates new instances using the current instance template. If you decrease the size, the group deletes one or more instances. The resize operation is marked DONE if the resize request is successful. The underlying actions take additional time. You must separately verify the status of the creating or deleting actions with the listmanagedinstances method. If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is removed or deleted. - * - * Sample code: - * ``` - * $regionInstanceGroupManagersClient = new RegionInstanceGroupManagersClient(); - * try { - * $instanceGroupManager = 'instance_group_manager'; - * $project = 'project'; - * $region = 'region'; - * $size = 0; - * $operationResponse = $regionInstanceGroupManagersClient->resize($instanceGroupManager, $project, $region, $size); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionInstanceGroupManagersClient->resize($instanceGroupManager, $project, $region, $size); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionInstanceGroupManagersClient->resumeOperation($operationName, 'resize'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionInstanceGroupManagersClient->close(); - * } - * ``` - * - * @param string $instanceGroupManager Name of the managed instance group. - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param int $size Number of instances that should exist in this instance group manager. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 resize($instanceGroupManager, $project, $region, $size, array $optionalArgs = []) - { - $request = new ResizeRegionInstanceGroupManagerRequest(); - $requestParamHeaders = []; - $request->setInstanceGroupManager($instanceGroupManager); - $request->setProject($project); - $request->setRegion($region); - $request->setSize($size); - $requestParamHeaders['instance_group_manager'] = $instanceGroupManager; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('Resize', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Flags the specified instances in the managed instance group to be resumed. This method increases the targetSize and decreases the targetSuspendedSize of the managed instance group by the number of instances that you resume. The resumeInstances operation is marked DONE if the resumeInstances request is successful. The underlying actions take additional time. You must separately verify the status of the RESUMING action with the listmanagedinstances method. In this request, you can only specify instances that are suspended. For example, if an instance was previously suspended using the suspendInstances method, it can be resumed using the resumeInstances method. If a health check is attached to the managed instance group, the specified instances will be verified as healthy after they are resumed. You can specify a maximum of 1000 instances with this method per request. - * - * Sample code: - * ``` - * $regionInstanceGroupManagersClient = new RegionInstanceGroupManagersClient(); - * try { - * $instanceGroupManager = 'instance_group_manager'; - * $project = 'project'; - * $region = 'region'; - * $regionInstanceGroupManagersResumeInstancesRequestResource = new RegionInstanceGroupManagersResumeInstancesRequest(); - * $operationResponse = $regionInstanceGroupManagersClient->resumeInstances($instanceGroupManager, $project, $region, $regionInstanceGroupManagersResumeInstancesRequestResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionInstanceGroupManagersClient->resumeInstances($instanceGroupManager, $project, $region, $regionInstanceGroupManagersResumeInstancesRequestResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionInstanceGroupManagersClient->resumeOperation($operationName, 'resumeInstances'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionInstanceGroupManagersClient->close(); - * } - * ``` - * - * @param string $instanceGroupManager Name of the managed instance group. - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param RegionInstanceGroupManagersResumeInstancesRequest $regionInstanceGroupManagersResumeInstancesRequestResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 resumeInstances($instanceGroupManager, $project, $region, $regionInstanceGroupManagersResumeInstancesRequestResource, array $optionalArgs = []) - { - $request = new ResumeInstancesRegionInstanceGroupManagerRequest(); - $requestParamHeaders = []; - $request->setInstanceGroupManager($instanceGroupManager); - $request->setProject($project); - $request->setRegion($region); - $request->setRegionInstanceGroupManagersResumeInstancesRequestResource($regionInstanceGroupManagersResumeInstancesRequestResource); - $requestParamHeaders['instance_group_manager'] = $instanceGroupManager; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('ResumeInstances', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Sets the instance template to use when creating new instances or recreating instances in this group. Existing instances are not affected. - * - * Sample code: - * ``` - * $regionInstanceGroupManagersClient = new RegionInstanceGroupManagersClient(); - * try { - * $instanceGroupManager = 'instance_group_manager'; - * $project = 'project'; - * $region = 'region'; - * $regionInstanceGroupManagersSetTemplateRequestResource = new RegionInstanceGroupManagersSetTemplateRequest(); - * $operationResponse = $regionInstanceGroupManagersClient->setInstanceTemplate($instanceGroupManager, $project, $region, $regionInstanceGroupManagersSetTemplateRequestResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionInstanceGroupManagersClient->setInstanceTemplate($instanceGroupManager, $project, $region, $regionInstanceGroupManagersSetTemplateRequestResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionInstanceGroupManagersClient->resumeOperation($operationName, 'setInstanceTemplate'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionInstanceGroupManagersClient->close(); - * } - * ``` - * - * @param string $instanceGroupManager The name of the managed instance group. - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param RegionInstanceGroupManagersSetTemplateRequest $regionInstanceGroupManagersSetTemplateRequestResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 setInstanceTemplate($instanceGroupManager, $project, $region, $regionInstanceGroupManagersSetTemplateRequestResource, array $optionalArgs = []) - { - $request = new SetInstanceTemplateRegionInstanceGroupManagerRequest(); - $requestParamHeaders = []; - $request->setInstanceGroupManager($instanceGroupManager); - $request->setProject($project); - $request->setRegion($region); - $request->setRegionInstanceGroupManagersSetTemplateRequestResource($regionInstanceGroupManagersSetTemplateRequestResource); - $requestParamHeaders['instance_group_manager'] = $instanceGroupManager; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('SetInstanceTemplate', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Modifies the target pools to which all new instances in this group are assigned. Existing instances in the group are not affected. - * - * Sample code: - * ``` - * $regionInstanceGroupManagersClient = new RegionInstanceGroupManagersClient(); - * try { - * $instanceGroupManager = 'instance_group_manager'; - * $project = 'project'; - * $region = 'region'; - * $regionInstanceGroupManagersSetTargetPoolsRequestResource = new RegionInstanceGroupManagersSetTargetPoolsRequest(); - * $operationResponse = $regionInstanceGroupManagersClient->setTargetPools($instanceGroupManager, $project, $region, $regionInstanceGroupManagersSetTargetPoolsRequestResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionInstanceGroupManagersClient->setTargetPools($instanceGroupManager, $project, $region, $regionInstanceGroupManagersSetTargetPoolsRequestResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionInstanceGroupManagersClient->resumeOperation($operationName, 'setTargetPools'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionInstanceGroupManagersClient->close(); - * } - * ``` - * - * @param string $instanceGroupManager Name of the managed instance group. - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param RegionInstanceGroupManagersSetTargetPoolsRequest $regionInstanceGroupManagersSetTargetPoolsRequestResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 setTargetPools($instanceGroupManager, $project, $region, $regionInstanceGroupManagersSetTargetPoolsRequestResource, array $optionalArgs = []) - { - $request = new SetTargetPoolsRegionInstanceGroupManagerRequest(); - $requestParamHeaders = []; - $request->setInstanceGroupManager($instanceGroupManager); - $request->setProject($project); - $request->setRegion($region); - $request->setRegionInstanceGroupManagersSetTargetPoolsRequestResource($regionInstanceGroupManagersSetTargetPoolsRequestResource); - $requestParamHeaders['instance_group_manager'] = $instanceGroupManager; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('SetTargetPools', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Flags the specified instances in the managed instance group to be started. This method increases the targetSize and decreases the targetStoppedSize of the managed instance group by the number of instances that you start. The startInstances operation is marked DONE if the startInstances request is successful. The underlying actions take additional time. You must separately verify the status of the STARTING action with the listmanagedinstances method. In this request, you can only specify instances that are stopped. For example, if an instance was previously stopped using the stopInstances method, it can be started using the startInstances method. If a health check is attached to the managed instance group, the specified instances will be verified as healthy after they are started. You can specify a maximum of 1000 instances with this method per request. - * - * Sample code: - * ``` - * $regionInstanceGroupManagersClient = new RegionInstanceGroupManagersClient(); - * try { - * $instanceGroupManager = 'instance_group_manager'; - * $project = 'project'; - * $region = 'region'; - * $regionInstanceGroupManagersStartInstancesRequestResource = new RegionInstanceGroupManagersStartInstancesRequest(); - * $operationResponse = $regionInstanceGroupManagersClient->startInstances($instanceGroupManager, $project, $region, $regionInstanceGroupManagersStartInstancesRequestResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionInstanceGroupManagersClient->startInstances($instanceGroupManager, $project, $region, $regionInstanceGroupManagersStartInstancesRequestResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionInstanceGroupManagersClient->resumeOperation($operationName, 'startInstances'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionInstanceGroupManagersClient->close(); - * } - * ``` - * - * @param string $instanceGroupManager Name of the managed instance group. - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param RegionInstanceGroupManagersStartInstancesRequest $regionInstanceGroupManagersStartInstancesRequestResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 startInstances($instanceGroupManager, $project, $region, $regionInstanceGroupManagersStartInstancesRequestResource, array $optionalArgs = []) - { - $request = new StartInstancesRegionInstanceGroupManagerRequest(); - $requestParamHeaders = []; - $request->setInstanceGroupManager($instanceGroupManager); - $request->setProject($project); - $request->setRegion($region); - $request->setRegionInstanceGroupManagersStartInstancesRequestResource($regionInstanceGroupManagersStartInstancesRequestResource); - $requestParamHeaders['instance_group_manager'] = $instanceGroupManager; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('StartInstances', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Flags the specified instances in the managed instance group to be immediately stopped. You can only specify instances that are running in this request. This method reduces the targetSize and increases the targetStoppedSize of the managed instance group by the number of instances that you stop. The stopInstances operation is marked DONE if the stopInstances request is successful. The underlying actions take additional time. You must separately verify the status of the STOPPING action with the listmanagedinstances method. If the standbyPolicy.initialDelaySec field is set, the group delays stopping the instances until initialDelaySec have passed from instance.creationTimestamp (that is, when the instance was created). This delay gives your application time to set itself up and initialize on the instance. If more than initialDelaySec seconds have passed since instance.creationTimestamp when this method is called, there will be zero delay. If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is stopped. Stopped instances can be started using the startInstances method. You can specify a maximum of 1000 instances with this method per request. - * - * Sample code: - * ``` - * $regionInstanceGroupManagersClient = new RegionInstanceGroupManagersClient(); - * try { - * $instanceGroupManager = 'instance_group_manager'; - * $project = 'project'; - * $region = 'region'; - * $regionInstanceGroupManagersStopInstancesRequestResource = new RegionInstanceGroupManagersStopInstancesRequest(); - * $operationResponse = $regionInstanceGroupManagersClient->stopInstances($instanceGroupManager, $project, $region, $regionInstanceGroupManagersStopInstancesRequestResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionInstanceGroupManagersClient->stopInstances($instanceGroupManager, $project, $region, $regionInstanceGroupManagersStopInstancesRequestResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionInstanceGroupManagersClient->resumeOperation($operationName, 'stopInstances'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionInstanceGroupManagersClient->close(); - * } - * ``` - * - * @param string $instanceGroupManager The name of the managed instance group. - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param RegionInstanceGroupManagersStopInstancesRequest $regionInstanceGroupManagersStopInstancesRequestResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 stopInstances($instanceGroupManager, $project, $region, $regionInstanceGroupManagersStopInstancesRequestResource, array $optionalArgs = []) - { - $request = new StopInstancesRegionInstanceGroupManagerRequest(); - $requestParamHeaders = []; - $request->setInstanceGroupManager($instanceGroupManager); - $request->setProject($project); - $request->setRegion($region); - $request->setRegionInstanceGroupManagersStopInstancesRequestResource($regionInstanceGroupManagersStopInstancesRequestResource); - $requestParamHeaders['instance_group_manager'] = $instanceGroupManager; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('StopInstances', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Flags the specified instances in the managed instance group to be immediately suspended. You can only specify instances that are running in this request. This method reduces the targetSize and increases the targetSuspendedSize of the managed instance group by the number of instances that you suspend. The suspendInstances operation is marked DONE if the suspendInstances request is successful. The underlying actions take additional time. You must separately verify the status of the SUSPENDING action with the listmanagedinstances method. If the standbyPolicy.initialDelaySec field is set, the group delays suspension of the instances until initialDelaySec have passed from instance.creationTimestamp (that is, when the instance was created). This delay gives your application time to set itself up and initialize on the instance. If more than initialDelaySec seconds have passed since instance.creationTimestamp when this method is called, there will be zero delay. If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is suspended. Suspended instances can be resumed using the resumeInstances method. You can specify a maximum of 1000 instances with this method per request. - * - * Sample code: - * ``` - * $regionInstanceGroupManagersClient = new RegionInstanceGroupManagersClient(); - * try { - * $instanceGroupManager = 'instance_group_manager'; - * $project = 'project'; - * $region = 'region'; - * $regionInstanceGroupManagersSuspendInstancesRequestResource = new RegionInstanceGroupManagersSuspendInstancesRequest(); - * $operationResponse = $regionInstanceGroupManagersClient->suspendInstances($instanceGroupManager, $project, $region, $regionInstanceGroupManagersSuspendInstancesRequestResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionInstanceGroupManagersClient->suspendInstances($instanceGroupManager, $project, $region, $regionInstanceGroupManagersSuspendInstancesRequestResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionInstanceGroupManagersClient->resumeOperation($operationName, 'suspendInstances'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionInstanceGroupManagersClient->close(); - * } - * ``` - * - * @param string $instanceGroupManager Name of the managed instance group. - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param RegionInstanceGroupManagersSuspendInstancesRequest $regionInstanceGroupManagersSuspendInstancesRequestResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 suspendInstances($instanceGroupManager, $project, $region, $regionInstanceGroupManagersSuspendInstancesRequestResource, array $optionalArgs = []) - { - $request = new SuspendInstancesRegionInstanceGroupManagerRequest(); - $requestParamHeaders = []; - $request->setInstanceGroupManager($instanceGroupManager); - $request->setProject($project); - $request->setRegion($region); - $request->setRegionInstanceGroupManagersSuspendInstancesRequestResource($regionInstanceGroupManagersSuspendInstancesRequestResource); - $requestParamHeaders['instance_group_manager'] = $instanceGroupManager; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('SuspendInstances', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Inserts or updates per-instance configurations for the managed instance group. perInstanceConfig.name serves as a key used to distinguish whether to perform insert or patch. - * - * Sample code: - * ``` - * $regionInstanceGroupManagersClient = new RegionInstanceGroupManagersClient(); - * try { - * $instanceGroupManager = 'instance_group_manager'; - * $project = 'project'; - * $region = 'region'; - * $regionInstanceGroupManagerUpdateInstanceConfigReqResource = new RegionInstanceGroupManagerUpdateInstanceConfigReq(); - * $operationResponse = $regionInstanceGroupManagersClient->updatePerInstanceConfigs($instanceGroupManager, $project, $region, $regionInstanceGroupManagerUpdateInstanceConfigReqResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionInstanceGroupManagersClient->updatePerInstanceConfigs($instanceGroupManager, $project, $region, $regionInstanceGroupManagerUpdateInstanceConfigReqResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionInstanceGroupManagersClient->resumeOperation($operationName, 'updatePerInstanceConfigs'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionInstanceGroupManagersClient->close(); - * } - * ``` - * - * @param string $instanceGroupManager The name of the managed instance group. It should conform to RFC1035. - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request, should conform to RFC1035. - * @param RegionInstanceGroupManagerUpdateInstanceConfigReq $regionInstanceGroupManagerUpdateInstanceConfigReqResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 updatePerInstanceConfigs($instanceGroupManager, $project, $region, $regionInstanceGroupManagerUpdateInstanceConfigReqResource, array $optionalArgs = []) - { - $request = new UpdatePerInstanceConfigsRegionInstanceGroupManagerRequest(); - $requestParamHeaders = []; - $request->setInstanceGroupManager($instanceGroupManager); - $request->setProject($project); - $request->setRegion($region); - $request->setRegionInstanceGroupManagerUpdateInstanceConfigReqResource($regionInstanceGroupManagerUpdateInstanceConfigReqResource); - $requestParamHeaders['instance_group_manager'] = $instanceGroupManager; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('UpdatePerInstanceConfigs', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/RegionInstanceGroupsGapicClient.php b/Compute/src/V1/Gapic/RegionInstanceGroupsGapicClient.php deleted file mode 100644 index 48c3ac6cc19d..000000000000 --- a/Compute/src/V1/Gapic/RegionInstanceGroupsGapicClient.php +++ /dev/null @@ -1,550 +0,0 @@ -get($instanceGroup, $project, $region); - * } finally { - * $regionInstanceGroupsClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\RegionInstanceGroupsClient}. - */ -class RegionInstanceGroupsGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.RegionInstanceGroups'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/region_instance_groups_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/region_instance_groups_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/region_instance_groups_rest_client_config.php', - ], - ], - 'operationsClientClass' => RegionOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an RegionOperationsClient object with the same endpoint as $this. - * - * @return RegionOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetRegionOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteRegionOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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); - } - - /** - * Returns the specified instance group resource. - * - * Sample code: - * ``` - * $regionInstanceGroupsClient = new RegionInstanceGroupsClient(); - * try { - * $instanceGroup = 'instance_group'; - * $project = 'project'; - * $region = 'region'; - * $response = $regionInstanceGroupsClient->get($instanceGroup, $project, $region); - * } finally { - * $regionInstanceGroupsClient->close(); - * } - * ``` - * - * @param string $instanceGroup Name of the instance group resource to return. - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\InstanceGroup - * - * @throws ApiException if the remote call fails - */ - public function get($instanceGroup, $project, $region, array $optionalArgs = []) - { - $request = new GetRegionInstanceGroupRequest(); - $requestParamHeaders = []; - $request->setInstanceGroup($instanceGroup); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['instance_group'] = $instanceGroup; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', InstanceGroup::class, $optionalArgs, $request)->wait(); - } - - /** - * Retrieves the list of instance group resources contained within the specified region. - * - * Sample code: - * ``` - * $regionInstanceGroupsClient = new RegionInstanceGroupsClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * // Iterate over pages of elements - * $pagedResponse = $regionInstanceGroupsClient->list($project, $region); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $regionInstanceGroupsClient->list($project, $region); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $regionInstanceGroupsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, $region, array $optionalArgs = []) - { - $request = new ListRegionInstanceGroupsRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, RegionInstanceGroupList::class, $request); - } - - /** - * Lists the instances in the specified instance group and displays information about the named ports. Depending on the specified options, this method can list all instances or only the instances that are running. The orderBy query parameter is not supported. - * - * Sample code: - * ``` - * $regionInstanceGroupsClient = new RegionInstanceGroupsClient(); - * try { - * $instanceGroup = 'instance_group'; - * $project = 'project'; - * $region = 'region'; - * $regionInstanceGroupsListInstancesRequestResource = new RegionInstanceGroupsListInstancesRequest(); - * // Iterate over pages of elements - * $pagedResponse = $regionInstanceGroupsClient->listInstances($instanceGroup, $project, $region, $regionInstanceGroupsListInstancesRequestResource); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $regionInstanceGroupsClient->listInstances($instanceGroup, $project, $region, $regionInstanceGroupsListInstancesRequestResource); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $regionInstanceGroupsClient->close(); - * } - * ``` - * - * @param string $instanceGroup Name of the regional instance group for which we want to list the instances. - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param RegionInstanceGroupsListInstancesRequest $regionInstanceGroupsListInstancesRequestResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 listInstances($instanceGroup, $project, $region, $regionInstanceGroupsListInstancesRequestResource, array $optionalArgs = []) - { - $request = new ListInstancesRegionInstanceGroupsRequest(); - $requestParamHeaders = []; - $request->setInstanceGroup($instanceGroup); - $request->setProject($project); - $request->setRegion($region); - $request->setRegionInstanceGroupsListInstancesRequestResource($regionInstanceGroupsListInstancesRequestResource); - $requestParamHeaders['instance_group'] = $instanceGroup; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('ListInstances', $optionalArgs, RegionInstanceGroupsListInstances::class, $request); - } - - /** - * Sets the named ports for the specified regional instance group. - * - * Sample code: - * ``` - * $regionInstanceGroupsClient = new RegionInstanceGroupsClient(); - * try { - * $instanceGroup = 'instance_group'; - * $project = 'project'; - * $region = 'region'; - * $regionInstanceGroupsSetNamedPortsRequestResource = new RegionInstanceGroupsSetNamedPortsRequest(); - * $operationResponse = $regionInstanceGroupsClient->setNamedPorts($instanceGroup, $project, $region, $regionInstanceGroupsSetNamedPortsRequestResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionInstanceGroupsClient->setNamedPorts($instanceGroup, $project, $region, $regionInstanceGroupsSetNamedPortsRequestResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionInstanceGroupsClient->resumeOperation($operationName, 'setNamedPorts'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionInstanceGroupsClient->close(); - * } - * ``` - * - * @param string $instanceGroup The name of the regional instance group where the named ports are updated. - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param RegionInstanceGroupsSetNamedPortsRequest $regionInstanceGroupsSetNamedPortsRequestResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 setNamedPorts($instanceGroup, $project, $region, $regionInstanceGroupsSetNamedPortsRequestResource, array $optionalArgs = []) - { - $request = new SetNamedPortsRegionInstanceGroupRequest(); - $requestParamHeaders = []; - $request->setInstanceGroup($instanceGroup); - $request->setProject($project); - $request->setRegion($region); - $request->setRegionInstanceGroupsSetNamedPortsRequestResource($regionInstanceGroupsSetNamedPortsRequestResource); - $requestParamHeaders['instance_group'] = $instanceGroup; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('SetNamedPorts', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/RegionInstanceTemplatesGapicClient.php b/Compute/src/V1/Gapic/RegionInstanceTemplatesGapicClient.php deleted file mode 100644 index 3a4944021a14..000000000000 --- a/Compute/src/V1/Gapic/RegionInstanceTemplatesGapicClient.php +++ /dev/null @@ -1,547 +0,0 @@ -delete($instanceTemplate, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionInstanceTemplatesClient->delete($instanceTemplate, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionInstanceTemplatesClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionInstanceTemplatesClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\RegionInstanceTemplatesClient}. - */ -class RegionInstanceTemplatesGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.RegionInstanceTemplates'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/region_instance_templates_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/region_instance_templates_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/region_instance_templates_rest_client_config.php', - ], - ], - 'operationsClientClass' => RegionOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an RegionOperationsClient object with the same endpoint as $this. - * - * @return RegionOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetRegionOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteRegionOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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 the specified instance template. Deleting an instance template is permanent and cannot be undone. - * - * Sample code: - * ``` - * $regionInstanceTemplatesClient = new RegionInstanceTemplatesClient(); - * try { - * $instanceTemplate = 'instance_template'; - * $project = 'project'; - * $region = 'region'; - * $operationResponse = $regionInstanceTemplatesClient->delete($instanceTemplate, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionInstanceTemplatesClient->delete($instanceTemplate, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionInstanceTemplatesClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionInstanceTemplatesClient->close(); - * } - * ``` - * - * @param string $instanceTemplate The name of the instance template to delete. - * @param string $project Project ID for this request. - * @param string $region The name of the region for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($instanceTemplate, $project, $region, array $optionalArgs = []) - { - $request = new DeleteRegionInstanceTemplateRequest(); - $requestParamHeaders = []; - $request->setInstanceTemplate($instanceTemplate); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['instance_template'] = $instanceTemplate; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns the specified instance template. - * - * Sample code: - * ``` - * $regionInstanceTemplatesClient = new RegionInstanceTemplatesClient(); - * try { - * $instanceTemplate = 'instance_template'; - * $project = 'project'; - * $region = 'region'; - * $response = $regionInstanceTemplatesClient->get($instanceTemplate, $project, $region); - * } finally { - * $regionInstanceTemplatesClient->close(); - * } - * ``` - * - * @param string $instanceTemplate The name of the instance template. - * @param string $project Project ID for this request. - * @param string $region The name of the region for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\InstanceTemplate - * - * @throws ApiException if the remote call fails - */ - public function get($instanceTemplate, $project, $region, array $optionalArgs = []) - { - $request = new GetRegionInstanceTemplateRequest(); - $requestParamHeaders = []; - $request->setInstanceTemplate($instanceTemplate); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['instance_template'] = $instanceTemplate; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', InstanceTemplate::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates an instance template in the specified project and region using the global instance template whose URL is included in the request. - * - * Sample code: - * ``` - * $regionInstanceTemplatesClient = new RegionInstanceTemplatesClient(); - * try { - * $instanceTemplateResource = new InstanceTemplate(); - * $project = 'project'; - * $region = 'region'; - * $operationResponse = $regionInstanceTemplatesClient->insert($instanceTemplateResource, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionInstanceTemplatesClient->insert($instanceTemplateResource, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionInstanceTemplatesClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionInstanceTemplatesClient->close(); - * } - * ``` - * - * @param InstanceTemplate $instanceTemplateResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $region The name of the region for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 insert($instanceTemplateResource, $project, $region, array $optionalArgs = []) - { - $request = new InsertRegionInstanceTemplateRequest(); - $requestParamHeaders = []; - $request->setInstanceTemplateResource($instanceTemplateResource); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Retrieves a list of instance templates that are contained within the specified project and region. - * - * Sample code: - * ``` - * $regionInstanceTemplatesClient = new RegionInstanceTemplatesClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * // Iterate over pages of elements - * $pagedResponse = $regionInstanceTemplatesClient->list($project, $region); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $regionInstanceTemplatesClient->list($project, $region); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $regionInstanceTemplatesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region The name of the regions for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, $region, array $optionalArgs = []) - { - $request = new ListRegionInstanceTemplatesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, InstanceTemplateList::class, $request); - } -} diff --git a/Compute/src/V1/Gapic/RegionInstancesGapicClient.php b/Compute/src/V1/Gapic/RegionInstancesGapicClient.php deleted file mode 100644 index 43397204426c..000000000000 --- a/Compute/src/V1/Gapic/RegionInstancesGapicClient.php +++ /dev/null @@ -1,332 +0,0 @@ -bulkInsert($bulkInsertInstanceResourceResource, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionInstancesClient->bulkInsert($bulkInsertInstanceResourceResource, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionInstancesClient->resumeOperation($operationName, 'bulkInsert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionInstancesClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\RegionInstancesClient}. - */ -class RegionInstancesGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.RegionInstances'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/region_instances_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/region_instances_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/region_instances_rest_client_config.php', - ], - ], - 'operationsClientClass' => RegionOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an RegionOperationsClient object with the same endpoint as $this. - * - * @return RegionOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetRegionOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteRegionOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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 multiple instances in a given region. Count specifies the number of instances to create. - * - * Sample code: - * ``` - * $regionInstancesClient = new RegionInstancesClient(); - * try { - * $bulkInsertInstanceResourceResource = new BulkInsertInstanceResource(); - * $project = 'project'; - * $region = 'region'; - * $operationResponse = $regionInstancesClient->bulkInsert($bulkInsertInstanceResourceResource, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionInstancesClient->bulkInsert($bulkInsertInstanceResourceResource, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionInstancesClient->resumeOperation($operationName, 'bulkInsert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionInstancesClient->close(); - * } - * ``` - * - * @param BulkInsertInstanceResource $bulkInsertInstanceResourceResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $region The name of the region for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 bulkInsert($bulkInsertInstanceResourceResource, $project, $region, array $optionalArgs = []) - { - $request = new BulkInsertRegionInstanceRequest(); - $requestParamHeaders = []; - $request->setBulkInsertInstanceResourceResource($bulkInsertInstanceResourceResource); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('BulkInsert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/RegionInstantSnapshotsGapicClient.php b/Compute/src/V1/Gapic/RegionInstantSnapshotsGapicClient.php deleted file mode 100644 index 516c991e25a6..000000000000 --- a/Compute/src/V1/Gapic/RegionInstantSnapshotsGapicClient.php +++ /dev/null @@ -1,788 +0,0 @@ -delete($instantSnapshot, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionInstantSnapshotsClient->delete($instantSnapshot, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionInstantSnapshotsClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionInstantSnapshotsClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\RegionInstantSnapshotsClient}. - */ -class RegionInstantSnapshotsGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.RegionInstantSnapshots'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/region_instant_snapshots_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/region_instant_snapshots_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/region_instant_snapshots_rest_client_config.php', - ], - ], - 'operationsClientClass' => RegionOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an RegionOperationsClient object with the same endpoint as $this. - * - * @return RegionOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetRegionOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteRegionOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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 the specified InstantSnapshot resource. Keep in mind that deleting a single instantSnapshot might not necessarily delete all the data on that instantSnapshot. If any data on the instantSnapshot that is marked for deletion is needed for subsequent instantSnapshots, the data will be moved to the next corresponding instantSnapshot. For more information, see Deleting instantSnapshots. - * - * Sample code: - * ``` - * $regionInstantSnapshotsClient = new RegionInstantSnapshotsClient(); - * try { - * $instantSnapshot = 'instant_snapshot'; - * $project = 'project'; - * $region = 'region'; - * $operationResponse = $regionInstantSnapshotsClient->delete($instantSnapshot, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionInstantSnapshotsClient->delete($instantSnapshot, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionInstantSnapshotsClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionInstantSnapshotsClient->close(); - * } - * ``` - * - * @param string $instantSnapshot Name of the InstantSnapshot resource to delete. - * @param string $project Project ID for this request. - * @param string $region The name of the region for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($instantSnapshot, $project, $region, array $optionalArgs = []) - { - $request = new DeleteRegionInstantSnapshotRequest(); - $requestParamHeaders = []; - $request->setInstantSnapshot($instantSnapshot); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['instant_snapshot'] = $instantSnapshot; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns the specified InstantSnapshot resource in the specified region. - * - * Sample code: - * ``` - * $regionInstantSnapshotsClient = new RegionInstantSnapshotsClient(); - * try { - * $instantSnapshot = 'instant_snapshot'; - * $project = 'project'; - * $region = 'region'; - * $response = $regionInstantSnapshotsClient->get($instantSnapshot, $project, $region); - * } finally { - * $regionInstantSnapshotsClient->close(); - * } - * ``` - * - * @param string $instantSnapshot Name of the InstantSnapshot resource to return. - * @param string $project Project ID for this request. - * @param string $region The name of the region for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\InstantSnapshot - * - * @throws ApiException if the remote call fails - */ - public function get($instantSnapshot, $project, $region, array $optionalArgs = []) - { - $request = new GetRegionInstantSnapshotRequest(); - $requestParamHeaders = []; - $request->setInstantSnapshot($instantSnapshot); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['instant_snapshot'] = $instantSnapshot; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', InstantSnapshot::class, $optionalArgs, $request)->wait(); - } - - /** - * Gets the access control policy for a resource. May be empty if no such policy or resource exists. - * - * Sample code: - * ``` - * $regionInstantSnapshotsClient = new RegionInstantSnapshotsClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $resource = 'resource'; - * $response = $regionInstantSnapshotsClient->getIamPolicy($project, $region, $resource); - * } finally { - * $regionInstantSnapshotsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region The name of the region for this request. - * @param string $resource Name or id of the resource for this request. - * @param array $optionalArgs { - * Optional. - * - * @type int $optionsRequestedPolicyVersion - * Requested IAM Policy version. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function getIamPolicy($project, $region, $resource, array $optionalArgs = []) - { - $request = new GetIamPolicyRegionInstantSnapshotRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setResource($resource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['optionsRequestedPolicyVersion'])) { - $request->setOptionsRequestedPolicyVersion($optionalArgs['optionsRequestedPolicyVersion']); - } - - $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(); - } - - /** - * Creates an instant snapshot in the specified region. - * - * Sample code: - * ``` - * $regionInstantSnapshotsClient = new RegionInstantSnapshotsClient(); - * try { - * $instantSnapshotResource = new InstantSnapshot(); - * $project = 'project'; - * $region = 'region'; - * $operationResponse = $regionInstantSnapshotsClient->insert($instantSnapshotResource, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionInstantSnapshotsClient->insert($instantSnapshotResource, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionInstantSnapshotsClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionInstantSnapshotsClient->close(); - * } - * ``` - * - * @param InstantSnapshot $instantSnapshotResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $region Name of the region for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 insert($instantSnapshotResource, $project, $region, array $optionalArgs = []) - { - $request = new InsertRegionInstantSnapshotRequest(); - $requestParamHeaders = []; - $request->setInstantSnapshotResource($instantSnapshotResource); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Retrieves the list of InstantSnapshot resources contained within the specified region. - * - * Sample code: - * ``` - * $regionInstantSnapshotsClient = new RegionInstantSnapshotsClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * // Iterate over pages of elements - * $pagedResponse = $regionInstantSnapshotsClient->list($project, $region); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $regionInstantSnapshotsClient->list($project, $region); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $regionInstantSnapshotsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region The name of the region for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, $region, array $optionalArgs = []) - { - $request = new ListRegionInstantSnapshotsRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, InstantSnapshotList::class, $request); - } - - /** - * Sets the access control policy on the specified resource. Replaces any existing policy. - * - * Sample code: - * ``` - * $regionInstantSnapshotsClient = new RegionInstantSnapshotsClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $regionSetPolicyRequestResource = new RegionSetPolicyRequest(); - * $resource = 'resource'; - * $response = $regionInstantSnapshotsClient->setIamPolicy($project, $region, $regionSetPolicyRequestResource, $resource); - * } finally { - * $regionInstantSnapshotsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region The name of the region for this request. - * @param RegionSetPolicyRequest $regionSetPolicyRequestResource The body resource for this request - * @param string $resource Name or id of the resource for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function setIamPolicy($project, $region, $regionSetPolicyRequestResource, $resource, array $optionalArgs = []) - { - $request = new SetIamPolicyRegionInstantSnapshotRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setRegionSetPolicyRequestResource($regionSetPolicyRequestResource); - $request->setResource($resource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['resource'] = $resource; - $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(); - } - - /** - * Sets the labels on a instantSnapshot in the given region. To learn more about labels, read the Labeling Resources documentation. - * - * Sample code: - * ``` - * $regionInstantSnapshotsClient = new RegionInstantSnapshotsClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $regionSetLabelsRequestResource = new RegionSetLabelsRequest(); - * $resource = 'resource'; - * $operationResponse = $regionInstantSnapshotsClient->setLabels($project, $region, $regionSetLabelsRequestResource, $resource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionInstantSnapshotsClient->setLabels($project, $region, $regionSetLabelsRequestResource, $resource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionInstantSnapshotsClient->resumeOperation($operationName, 'setLabels'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionInstantSnapshotsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region The region for this request. - * @param RegionSetLabelsRequest $regionSetLabelsRequestResource The body resource for this request - * @param string $resource Name or id of the resource for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 setLabels($project, $region, $regionSetLabelsRequestResource, $resource, array $optionalArgs = []) - { - $request = new SetLabelsRegionInstantSnapshotRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setRegionSetLabelsRequestResource($regionSetLabelsRequestResource); - $request->setResource($resource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['resource'] = $resource; - 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('SetLabels', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns permissions that a caller has on the specified resource. - * - * Sample code: - * ``` - * $regionInstantSnapshotsClient = new RegionInstantSnapshotsClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $resource = 'resource'; - * $testPermissionsRequestResource = new TestPermissionsRequest(); - * $response = $regionInstantSnapshotsClient->testIamPermissions($project, $region, $resource, $testPermissionsRequestResource); - * } finally { - * $regionInstantSnapshotsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region The name of the region for this request. - * @param string $resource Name or id of the resource for this request. - * @param TestPermissionsRequest $testPermissionsRequestResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\TestPermissionsResponse - * - * @throws ApiException if the remote call fails - */ - public function testIamPermissions($project, $region, $resource, $testPermissionsRequestResource, array $optionalArgs = []) - { - $request = new TestIamPermissionsRegionInstantSnapshotRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setResource($resource); - $request->setTestPermissionsRequestResource($testPermissionsRequestResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['resource'] = $resource; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('TestIamPermissions', TestPermissionsResponse::class, $optionalArgs, $request)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/RegionNetworkEndpointGroupsGapicClient.php b/Compute/src/V1/Gapic/RegionNetworkEndpointGroupsGapicClient.php deleted file mode 100644 index ba21ae58f492..000000000000 --- a/Compute/src/V1/Gapic/RegionNetworkEndpointGroupsGapicClient.php +++ /dev/null @@ -1,804 +0,0 @@ -attachNetworkEndpoints($networkEndpointGroup, $project, $region, $regionNetworkEndpointGroupsAttachEndpointsRequestResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionNetworkEndpointGroupsClient->attachNetworkEndpoints($networkEndpointGroup, $project, $region, $regionNetworkEndpointGroupsAttachEndpointsRequestResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionNetworkEndpointGroupsClient->resumeOperation($operationName, 'attachNetworkEndpoints'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionNetworkEndpointGroupsClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\RegionNetworkEndpointGroupsClient}. - */ -class RegionNetworkEndpointGroupsGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.RegionNetworkEndpointGroups'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/region_network_endpoint_groups_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/region_network_endpoint_groups_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/region_network_endpoint_groups_rest_client_config.php', - ], - ], - 'operationsClientClass' => RegionOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an RegionOperationsClient object with the same endpoint as $this. - * - * @return RegionOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetRegionOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteRegionOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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); - } - - /** - * Attach a list of network endpoints to the specified network endpoint group. - * - * Sample code: - * ``` - * $regionNetworkEndpointGroupsClient = new RegionNetworkEndpointGroupsClient(); - * try { - * $networkEndpointGroup = 'network_endpoint_group'; - * $project = 'project'; - * $region = 'region'; - * $regionNetworkEndpointGroupsAttachEndpointsRequestResource = new RegionNetworkEndpointGroupsAttachEndpointsRequest(); - * $operationResponse = $regionNetworkEndpointGroupsClient->attachNetworkEndpoints($networkEndpointGroup, $project, $region, $regionNetworkEndpointGroupsAttachEndpointsRequestResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionNetworkEndpointGroupsClient->attachNetworkEndpoints($networkEndpointGroup, $project, $region, $regionNetworkEndpointGroupsAttachEndpointsRequestResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionNetworkEndpointGroupsClient->resumeOperation($operationName, 'attachNetworkEndpoints'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionNetworkEndpointGroupsClient->close(); - * } - * ``` - * - * @param string $networkEndpointGroup The name of the network endpoint group where you are attaching network endpoints to. It should comply with RFC1035. - * @param string $project Project ID for this request. - * @param string $region The name of the region where you want to create the network endpoint group. It should comply with RFC1035. - * @param RegionNetworkEndpointGroupsAttachEndpointsRequest $regionNetworkEndpointGroupsAttachEndpointsRequestResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 attachNetworkEndpoints($networkEndpointGroup, $project, $region, $regionNetworkEndpointGroupsAttachEndpointsRequestResource, array $optionalArgs = []) - { - $request = new AttachNetworkEndpointsRegionNetworkEndpointGroupRequest(); - $requestParamHeaders = []; - $request->setNetworkEndpointGroup($networkEndpointGroup); - $request->setProject($project); - $request->setRegion($region); - $request->setRegionNetworkEndpointGroupsAttachEndpointsRequestResource($regionNetworkEndpointGroupsAttachEndpointsRequestResource); - $requestParamHeaders['network_endpoint_group'] = $networkEndpointGroup; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('AttachNetworkEndpoints', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Deletes the specified network endpoint group. Note that the NEG cannot be deleted if it is configured as a backend of a backend service. - * - * Sample code: - * ``` - * $regionNetworkEndpointGroupsClient = new RegionNetworkEndpointGroupsClient(); - * try { - * $networkEndpointGroup = 'network_endpoint_group'; - * $project = 'project'; - * $region = 'region'; - * $operationResponse = $regionNetworkEndpointGroupsClient->delete($networkEndpointGroup, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionNetworkEndpointGroupsClient->delete($networkEndpointGroup, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionNetworkEndpointGroupsClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionNetworkEndpointGroupsClient->close(); - * } - * ``` - * - * @param string $networkEndpointGroup The name of the network endpoint group to delete. It should comply with RFC1035. - * @param string $project Project ID for this request. - * @param string $region The name of the region where the network endpoint group is located. It should comply with RFC1035. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($networkEndpointGroup, $project, $region, array $optionalArgs = []) - { - $request = new DeleteRegionNetworkEndpointGroupRequest(); - $requestParamHeaders = []; - $request->setNetworkEndpointGroup($networkEndpointGroup); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['network_endpoint_group'] = $networkEndpointGroup; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Detach the network endpoint from the specified network endpoint group. - * - * Sample code: - * ``` - * $regionNetworkEndpointGroupsClient = new RegionNetworkEndpointGroupsClient(); - * try { - * $networkEndpointGroup = 'network_endpoint_group'; - * $project = 'project'; - * $region = 'region'; - * $regionNetworkEndpointGroupsDetachEndpointsRequestResource = new RegionNetworkEndpointGroupsDetachEndpointsRequest(); - * $operationResponse = $regionNetworkEndpointGroupsClient->detachNetworkEndpoints($networkEndpointGroup, $project, $region, $regionNetworkEndpointGroupsDetachEndpointsRequestResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionNetworkEndpointGroupsClient->detachNetworkEndpoints($networkEndpointGroup, $project, $region, $regionNetworkEndpointGroupsDetachEndpointsRequestResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionNetworkEndpointGroupsClient->resumeOperation($operationName, 'detachNetworkEndpoints'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionNetworkEndpointGroupsClient->close(); - * } - * ``` - * - * @param string $networkEndpointGroup The name of the network endpoint group you are detaching network endpoints from. It should comply with RFC1035. - * @param string $project Project ID for this request. - * @param string $region The name of the region where the network endpoint group is located. It should comply with RFC1035. - * @param RegionNetworkEndpointGroupsDetachEndpointsRequest $regionNetworkEndpointGroupsDetachEndpointsRequestResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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). end_interface: MixerMutationRequestBuilder - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 detachNetworkEndpoints($networkEndpointGroup, $project, $region, $regionNetworkEndpointGroupsDetachEndpointsRequestResource, array $optionalArgs = []) - { - $request = new DetachNetworkEndpointsRegionNetworkEndpointGroupRequest(); - $requestParamHeaders = []; - $request->setNetworkEndpointGroup($networkEndpointGroup); - $request->setProject($project); - $request->setRegion($region); - $request->setRegionNetworkEndpointGroupsDetachEndpointsRequestResource($regionNetworkEndpointGroupsDetachEndpointsRequestResource); - $requestParamHeaders['network_endpoint_group'] = $networkEndpointGroup; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('DetachNetworkEndpoints', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns the specified network endpoint group. - * - * Sample code: - * ``` - * $regionNetworkEndpointGroupsClient = new RegionNetworkEndpointGroupsClient(); - * try { - * $networkEndpointGroup = 'network_endpoint_group'; - * $project = 'project'; - * $region = 'region'; - * $response = $regionNetworkEndpointGroupsClient->get($networkEndpointGroup, $project, $region); - * } finally { - * $regionNetworkEndpointGroupsClient->close(); - * } - * ``` - * - * @param string $networkEndpointGroup The name of the network endpoint group. It should comply with RFC1035. - * @param string $project Project ID for this request. - * @param string $region The name of the region where the network endpoint group is located. It should comply with RFC1035. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\NetworkEndpointGroup - * - * @throws ApiException if the remote call fails - */ - public function get($networkEndpointGroup, $project, $region, array $optionalArgs = []) - { - $request = new GetRegionNetworkEndpointGroupRequest(); - $requestParamHeaders = []; - $request->setNetworkEndpointGroup($networkEndpointGroup); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['network_endpoint_group'] = $networkEndpointGroup; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', NetworkEndpointGroup::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates a network endpoint group in the specified project using the parameters that are included in the request. - * - * Sample code: - * ``` - * $regionNetworkEndpointGroupsClient = new RegionNetworkEndpointGroupsClient(); - * try { - * $networkEndpointGroupResource = new NetworkEndpointGroup(); - * $project = 'project'; - * $region = 'region'; - * $operationResponse = $regionNetworkEndpointGroupsClient->insert($networkEndpointGroupResource, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionNetworkEndpointGroupsClient->insert($networkEndpointGroupResource, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionNetworkEndpointGroupsClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionNetworkEndpointGroupsClient->close(); - * } - * ``` - * - * @param NetworkEndpointGroup $networkEndpointGroupResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $region The name of the region where you want to create the network endpoint group. It should comply with RFC1035. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 insert($networkEndpointGroupResource, $project, $region, array $optionalArgs = []) - { - $request = new InsertRegionNetworkEndpointGroupRequest(); - $requestParamHeaders = []; - $request->setNetworkEndpointGroupResource($networkEndpointGroupResource); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Retrieves the list of regional network endpoint groups available to the specified project in the given region. - * - * Sample code: - * ``` - * $regionNetworkEndpointGroupsClient = new RegionNetworkEndpointGroupsClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * // Iterate over pages of elements - * $pagedResponse = $regionNetworkEndpointGroupsClient->list($project, $region); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $regionNetworkEndpointGroupsClient->list($project, $region); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $regionNetworkEndpointGroupsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region The name of the region where the network endpoint group is located. It should comply with RFC1035. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, $region, array $optionalArgs = []) - { - $request = new ListRegionNetworkEndpointGroupsRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, NetworkEndpointGroupList::class, $request); - } - - /** - * Lists the network endpoints in the specified network endpoint group. - * - * Sample code: - * ``` - * $regionNetworkEndpointGroupsClient = new RegionNetworkEndpointGroupsClient(); - * try { - * $networkEndpointGroup = 'network_endpoint_group'; - * $project = 'project'; - * $region = 'region'; - * // Iterate over pages of elements - * $pagedResponse = $regionNetworkEndpointGroupsClient->listNetworkEndpoints($networkEndpointGroup, $project, $region); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $regionNetworkEndpointGroupsClient->listNetworkEndpoints($networkEndpointGroup, $project, $region); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $regionNetworkEndpointGroupsClient->close(); - * } - * ``` - * - * @param string $networkEndpointGroup The name of the network endpoint group from which you want to generate a list of included network endpoints. It should comply with RFC1035. - * @param string $project Project ID for this request. - * @param string $region The name of the region where the network endpoint group is located. It should comply with RFC1035. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 listNetworkEndpoints($networkEndpointGroup, $project, $region, array $optionalArgs = []) - { - $request = new ListNetworkEndpointsRegionNetworkEndpointGroupsRequest(); - $requestParamHeaders = []; - $request->setNetworkEndpointGroup($networkEndpointGroup); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['network_endpoint_group'] = $networkEndpointGroup; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('ListNetworkEndpoints', $optionalArgs, NetworkEndpointGroupsListNetworkEndpoints::class, $request); - } -} diff --git a/Compute/src/V1/Gapic/RegionNetworkFirewallPoliciesGapicClient.php b/Compute/src/V1/Gapic/RegionNetworkFirewallPoliciesGapicClient.php deleted file mode 100644 index 382d81ac47fa..000000000000 --- a/Compute/src/V1/Gapic/RegionNetworkFirewallPoliciesGapicClient.php +++ /dev/null @@ -1,1459 +0,0 @@ -addAssociation($firewallPolicy, $firewallPolicyAssociationResource, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionNetworkFirewallPoliciesClient->addAssociation($firewallPolicy, $firewallPolicyAssociationResource, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionNetworkFirewallPoliciesClient->resumeOperation($operationName, 'addAssociation'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionNetworkFirewallPoliciesClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\RegionNetworkFirewallPoliciesClient}. - */ -class RegionNetworkFirewallPoliciesGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.RegionNetworkFirewallPolicies'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/region_network_firewall_policies_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/region_network_firewall_policies_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/region_network_firewall_policies_rest_client_config.php', - ], - ], - 'operationsClientClass' => RegionOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an RegionOperationsClient object with the same endpoint as $this. - * - * @return RegionOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetRegionOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteRegionOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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); - } - - /** - * Inserts an association for the specified network firewall policy. - * - * Sample code: - * ``` - * $regionNetworkFirewallPoliciesClient = new RegionNetworkFirewallPoliciesClient(); - * try { - * $firewallPolicy = 'firewall_policy'; - * $firewallPolicyAssociationResource = new FirewallPolicyAssociation(); - * $project = 'project'; - * $region = 'region'; - * $operationResponse = $regionNetworkFirewallPoliciesClient->addAssociation($firewallPolicy, $firewallPolicyAssociationResource, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionNetworkFirewallPoliciesClient->addAssociation($firewallPolicy, $firewallPolicyAssociationResource, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionNetworkFirewallPoliciesClient->resumeOperation($operationName, 'addAssociation'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionNetworkFirewallPoliciesClient->close(); - * } - * ``` - * - * @param string $firewallPolicy Name of the firewall policy to update. - * @param FirewallPolicyAssociation $firewallPolicyAssociationResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type bool $replaceExistingAssociation - * Indicates whether or not to replace it if an association already exists. This is false by default, in which case an error will be returned if an association already exists. - * @type string $requestId - * 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. 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 addAssociation($firewallPolicy, $firewallPolicyAssociationResource, $project, $region, array $optionalArgs = []) - { - $request = new AddAssociationRegionNetworkFirewallPolicyRequest(); - $requestParamHeaders = []; - $request->setFirewallPolicy($firewallPolicy); - $request->setFirewallPolicyAssociationResource($firewallPolicyAssociationResource); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['firewall_policy'] = $firewallPolicy; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - if (isset($optionalArgs['replaceExistingAssociation'])) { - $request->setReplaceExistingAssociation($optionalArgs['replaceExistingAssociation']); - } - - 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('AddAssociation', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Inserts a rule into a network firewall policy. - * - * Sample code: - * ``` - * $regionNetworkFirewallPoliciesClient = new RegionNetworkFirewallPoliciesClient(); - * try { - * $firewallPolicy = 'firewall_policy'; - * $firewallPolicyRuleResource = new FirewallPolicyRule(); - * $project = 'project'; - * $region = 'region'; - * $operationResponse = $regionNetworkFirewallPoliciesClient->addRule($firewallPolicy, $firewallPolicyRuleResource, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionNetworkFirewallPoliciesClient->addRule($firewallPolicy, $firewallPolicyRuleResource, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionNetworkFirewallPoliciesClient->resumeOperation($operationName, 'addRule'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionNetworkFirewallPoliciesClient->close(); - * } - * ``` - * - * @param string $firewallPolicy Name of the firewall policy to update. - * @param FirewallPolicyRule $firewallPolicyRuleResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type int $maxPriority - * When rule.priority is not specified, auto choose a unused priority between minPriority and maxPriority>. This field is exclusive with rule.priority. - * @type int $minPriority - * When rule.priority is not specified, auto choose a unused priority between minPriority and maxPriority>. This field is exclusive with rule.priority. - * @type string $requestId - * 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. 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 addRule($firewallPolicy, $firewallPolicyRuleResource, $project, $region, array $optionalArgs = []) - { - $request = new AddRuleRegionNetworkFirewallPolicyRequest(); - $requestParamHeaders = []; - $request->setFirewallPolicy($firewallPolicy); - $request->setFirewallPolicyRuleResource($firewallPolicyRuleResource); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['firewall_policy'] = $firewallPolicy; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - if (isset($optionalArgs['maxPriority'])) { - $request->setMaxPriority($optionalArgs['maxPriority']); - } - - if (isset($optionalArgs['minPriority'])) { - $request->setMinPriority($optionalArgs['minPriority']); - } - - 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('AddRule', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Copies rules to the specified network firewall policy. - * - * Sample code: - * ``` - * $regionNetworkFirewallPoliciesClient = new RegionNetworkFirewallPoliciesClient(); - * try { - * $firewallPolicy = 'firewall_policy'; - * $project = 'project'; - * $region = 'region'; - * $operationResponse = $regionNetworkFirewallPoliciesClient->cloneRules($firewallPolicy, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionNetworkFirewallPoliciesClient->cloneRules($firewallPolicy, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionNetworkFirewallPoliciesClient->resumeOperation($operationName, 'cloneRules'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionNetworkFirewallPoliciesClient->close(); - * } - * ``` - * - * @param string $firewallPolicy Name of the firewall policy to update. - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 $sourceFirewallPolicy - * The firewall policy from which to copy rules. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 cloneRules($firewallPolicy, $project, $region, array $optionalArgs = []) - { - $request = new CloneRulesRegionNetworkFirewallPolicyRequest(); - $requestParamHeaders = []; - $request->setFirewallPolicy($firewallPolicy); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['firewall_policy'] = $firewallPolicy; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - if (isset($optionalArgs['sourceFirewallPolicy'])) { - $request->setSourceFirewallPolicy($optionalArgs['sourceFirewallPolicy']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('CloneRules', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Deletes the specified network firewall policy. - * - * Sample code: - * ``` - * $regionNetworkFirewallPoliciesClient = new RegionNetworkFirewallPoliciesClient(); - * try { - * $firewallPolicy = 'firewall_policy'; - * $project = 'project'; - * $region = 'region'; - * $operationResponse = $regionNetworkFirewallPoliciesClient->delete($firewallPolicy, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionNetworkFirewallPoliciesClient->delete($firewallPolicy, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionNetworkFirewallPoliciesClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionNetworkFirewallPoliciesClient->close(); - * } - * ``` - * - * @param string $firewallPolicy Name of the firewall policy to delete. - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($firewallPolicy, $project, $region, array $optionalArgs = []) - { - $request = new DeleteRegionNetworkFirewallPolicyRequest(); - $requestParamHeaders = []; - $request->setFirewallPolicy($firewallPolicy); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['firewall_policy'] = $firewallPolicy; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns the specified network firewall policy. - * - * Sample code: - * ``` - * $regionNetworkFirewallPoliciesClient = new RegionNetworkFirewallPoliciesClient(); - * try { - * $firewallPolicy = 'firewall_policy'; - * $project = 'project'; - * $region = 'region'; - * $response = $regionNetworkFirewallPoliciesClient->get($firewallPolicy, $project, $region); - * } finally { - * $regionNetworkFirewallPoliciesClient->close(); - * } - * ``` - * - * @param string $firewallPolicy Name of the firewall policy to get. - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\FirewallPolicy - * - * @throws ApiException if the remote call fails - */ - public function get($firewallPolicy, $project, $region, array $optionalArgs = []) - { - $request = new GetRegionNetworkFirewallPolicyRequest(); - $requestParamHeaders = []; - $request->setFirewallPolicy($firewallPolicy); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['firewall_policy'] = $firewallPolicy; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', FirewallPolicy::class, $optionalArgs, $request)->wait(); - } - - /** - * Gets an association with the specified name. - * - * Sample code: - * ``` - * $regionNetworkFirewallPoliciesClient = new RegionNetworkFirewallPoliciesClient(); - * try { - * $firewallPolicy = 'firewall_policy'; - * $project = 'project'; - * $region = 'region'; - * $response = $regionNetworkFirewallPoliciesClient->getAssociation($firewallPolicy, $project, $region); - * } finally { - * $regionNetworkFirewallPoliciesClient->close(); - * } - * ``` - * - * @param string $firewallPolicy Name of the firewall policy to which the queried association belongs. - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * The name of the association to get from the firewall policy. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\FirewallPolicyAssociation - * - * @throws ApiException if the remote call fails - */ - public function getAssociation($firewallPolicy, $project, $region, array $optionalArgs = []) - { - $request = new GetAssociationRegionNetworkFirewallPolicyRequest(); - $requestParamHeaders = []; - $request->setFirewallPolicy($firewallPolicy); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['firewall_policy'] = $firewallPolicy; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['name']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetAssociation', FirewallPolicyAssociation::class, $optionalArgs, $request)->wait(); - } - - /** - * Returns the effective firewalls on a given network. - * - * Sample code: - * ``` - * $regionNetworkFirewallPoliciesClient = new RegionNetworkFirewallPoliciesClient(); - * try { - * $network = 'network'; - * $project = 'project'; - * $region = 'region'; - * $response = $regionNetworkFirewallPoliciesClient->getEffectiveFirewalls($network, $project, $region); - * } finally { - * $regionNetworkFirewallPoliciesClient->close(); - * } - * ``` - * - * @param string $network Network reference - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\RegionNetworkFirewallPoliciesGetEffectiveFirewallsResponse - * - * @throws ApiException if the remote call fails - */ - public function getEffectiveFirewalls($network, $project, $region, array $optionalArgs = []) - { - $request = new GetEffectiveFirewallsRegionNetworkFirewallPolicyRequest(); - $requestParamHeaders = []; - $request->setNetwork($network); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetEffectiveFirewalls', RegionNetworkFirewallPoliciesGetEffectiveFirewallsResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Gets the access control policy for a resource. May be empty if no such policy or resource exists. - * - * Sample code: - * ``` - * $regionNetworkFirewallPoliciesClient = new RegionNetworkFirewallPoliciesClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $resource = 'resource'; - * $response = $regionNetworkFirewallPoliciesClient->getIamPolicy($project, $region, $resource); - * } finally { - * $regionNetworkFirewallPoliciesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region The name of the region for this request. - * @param string $resource Name or id of the resource for this request. - * @param array $optionalArgs { - * Optional. - * - * @type int $optionsRequestedPolicyVersion - * Requested IAM Policy version. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function getIamPolicy($project, $region, $resource, array $optionalArgs = []) - { - $request = new GetIamPolicyRegionNetworkFirewallPolicyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setResource($resource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['optionsRequestedPolicyVersion'])) { - $request->setOptionsRequestedPolicyVersion($optionalArgs['optionsRequestedPolicyVersion']); - } - - $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 a rule of the specified priority. - * - * Sample code: - * ``` - * $regionNetworkFirewallPoliciesClient = new RegionNetworkFirewallPoliciesClient(); - * try { - * $firewallPolicy = 'firewall_policy'; - * $project = 'project'; - * $region = 'region'; - * $response = $regionNetworkFirewallPoliciesClient->getRule($firewallPolicy, $project, $region); - * } finally { - * $regionNetworkFirewallPoliciesClient->close(); - * } - * ``` - * - * @param string $firewallPolicy Name of the firewall policy to which the queried rule belongs. - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type int $priority - * The priority of the rule to get from the firewall policy. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\FirewallPolicyRule - * - * @throws ApiException if the remote call fails - */ - public function getRule($firewallPolicy, $project, $region, array $optionalArgs = []) - { - $request = new GetRuleRegionNetworkFirewallPolicyRequest(); - $requestParamHeaders = []; - $request->setFirewallPolicy($firewallPolicy); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['firewall_policy'] = $firewallPolicy; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - if (isset($optionalArgs['priority'])) { - $request->setPriority($optionalArgs['priority']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetRule', FirewallPolicyRule::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates a new network firewall policy in the specified project and region. - * - * Sample code: - * ``` - * $regionNetworkFirewallPoliciesClient = new RegionNetworkFirewallPoliciesClient(); - * try { - * $firewallPolicyResource = new FirewallPolicy(); - * $project = 'project'; - * $region = 'region'; - * $operationResponse = $regionNetworkFirewallPoliciesClient->insert($firewallPolicyResource, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionNetworkFirewallPoliciesClient->insert($firewallPolicyResource, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionNetworkFirewallPoliciesClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionNetworkFirewallPoliciesClient->close(); - * } - * ``` - * - * @param FirewallPolicy $firewallPolicyResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 insert($firewallPolicyResource, $project, $region, array $optionalArgs = []) - { - $request = new InsertRegionNetworkFirewallPolicyRequest(); - $requestParamHeaders = []; - $request->setFirewallPolicyResource($firewallPolicyResource); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Lists all the network firewall policies that have been configured for the specified project in the given region. - * - * Sample code: - * ``` - * $regionNetworkFirewallPoliciesClient = new RegionNetworkFirewallPoliciesClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * // Iterate over pages of elements - * $pagedResponse = $regionNetworkFirewallPoliciesClient->list($project, $region); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $regionNetworkFirewallPoliciesClient->list($project, $region); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $regionNetworkFirewallPoliciesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, $region, array $optionalArgs = []) - { - $request = new ListRegionNetworkFirewallPoliciesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, FirewallPolicyList::class, $request); - } - - /** - * Patches the specified network firewall policy. - * - * Sample code: - * ``` - * $regionNetworkFirewallPoliciesClient = new RegionNetworkFirewallPoliciesClient(); - * try { - * $firewallPolicy = 'firewall_policy'; - * $firewallPolicyResource = new FirewallPolicy(); - * $project = 'project'; - * $region = 'region'; - * $operationResponse = $regionNetworkFirewallPoliciesClient->patch($firewallPolicy, $firewallPolicyResource, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionNetworkFirewallPoliciesClient->patch($firewallPolicy, $firewallPolicyResource, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionNetworkFirewallPoliciesClient->resumeOperation($operationName, 'patch'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionNetworkFirewallPoliciesClient->close(); - * } - * ``` - * - * @param string $firewallPolicy Name of the firewall policy to update. - * @param FirewallPolicy $firewallPolicyResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 patch($firewallPolicy, $firewallPolicyResource, $project, $region, array $optionalArgs = []) - { - $request = new PatchRegionNetworkFirewallPolicyRequest(); - $requestParamHeaders = []; - $request->setFirewallPolicy($firewallPolicy); - $request->setFirewallPolicyResource($firewallPolicyResource); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['firewall_policy'] = $firewallPolicy; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('Patch', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Patches a rule of the specified priority. - * - * Sample code: - * ``` - * $regionNetworkFirewallPoliciesClient = new RegionNetworkFirewallPoliciesClient(); - * try { - * $firewallPolicy = 'firewall_policy'; - * $firewallPolicyRuleResource = new FirewallPolicyRule(); - * $project = 'project'; - * $region = 'region'; - * $operationResponse = $regionNetworkFirewallPoliciesClient->patchRule($firewallPolicy, $firewallPolicyRuleResource, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionNetworkFirewallPoliciesClient->patchRule($firewallPolicy, $firewallPolicyRuleResource, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionNetworkFirewallPoliciesClient->resumeOperation($operationName, 'patchRule'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionNetworkFirewallPoliciesClient->close(); - * } - * ``` - * - * @param string $firewallPolicy Name of the firewall policy to update. - * @param FirewallPolicyRule $firewallPolicyRuleResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type int $priority - * The priority of the rule to patch. - * @type string $requestId - * 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. 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 patchRule($firewallPolicy, $firewallPolicyRuleResource, $project, $region, array $optionalArgs = []) - { - $request = new PatchRuleRegionNetworkFirewallPolicyRequest(); - $requestParamHeaders = []; - $request->setFirewallPolicy($firewallPolicy); - $request->setFirewallPolicyRuleResource($firewallPolicyRuleResource); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['firewall_policy'] = $firewallPolicy; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - if (isset($optionalArgs['priority'])) { - $request->setPriority($optionalArgs['priority']); - } - - 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('PatchRule', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Removes an association for the specified network firewall policy. - * - * Sample code: - * ``` - * $regionNetworkFirewallPoliciesClient = new RegionNetworkFirewallPoliciesClient(); - * try { - * $firewallPolicy = 'firewall_policy'; - * $project = 'project'; - * $region = 'region'; - * $operationResponse = $regionNetworkFirewallPoliciesClient->removeAssociation($firewallPolicy, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionNetworkFirewallPoliciesClient->removeAssociation($firewallPolicy, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionNetworkFirewallPoliciesClient->resumeOperation($operationName, 'removeAssociation'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionNetworkFirewallPoliciesClient->close(); - * } - * ``` - * - * @param string $firewallPolicy Name of the firewall policy to update. - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $name - * Name for the association that will be removed. - * @type string $requestId - * 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. 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 removeAssociation($firewallPolicy, $project, $region, array $optionalArgs = []) - { - $request = new RemoveAssociationRegionNetworkFirewallPolicyRequest(); - $requestParamHeaders = []; - $request->setFirewallPolicy($firewallPolicy); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['firewall_policy'] = $firewallPolicy; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - if (isset($optionalArgs['name'])) { - $request->setName($optionalArgs['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('RemoveAssociation', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Deletes a rule of the specified priority. - * - * Sample code: - * ``` - * $regionNetworkFirewallPoliciesClient = new RegionNetworkFirewallPoliciesClient(); - * try { - * $firewallPolicy = 'firewall_policy'; - * $project = 'project'; - * $region = 'region'; - * $operationResponse = $regionNetworkFirewallPoliciesClient->removeRule($firewallPolicy, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionNetworkFirewallPoliciesClient->removeRule($firewallPolicy, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionNetworkFirewallPoliciesClient->resumeOperation($operationName, 'removeRule'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionNetworkFirewallPoliciesClient->close(); - * } - * ``` - * - * @param string $firewallPolicy Name of the firewall policy to update. - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type int $priority - * The priority of the rule to remove from the firewall policy. - * @type string $requestId - * 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. 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 removeRule($firewallPolicy, $project, $region, array $optionalArgs = []) - { - $request = new RemoveRuleRegionNetworkFirewallPolicyRequest(); - $requestParamHeaders = []; - $request->setFirewallPolicy($firewallPolicy); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['firewall_policy'] = $firewallPolicy; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - if (isset($optionalArgs['priority'])) { - $request->setPriority($optionalArgs['priority']); - } - - 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('RemoveRule', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Sets the access control policy on the specified resource. Replaces any existing policy. - * - * Sample code: - * ``` - * $regionNetworkFirewallPoliciesClient = new RegionNetworkFirewallPoliciesClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $regionSetPolicyRequestResource = new RegionSetPolicyRequest(); - * $resource = 'resource'; - * $response = $regionNetworkFirewallPoliciesClient->setIamPolicy($project, $region, $regionSetPolicyRequestResource, $resource); - * } finally { - * $regionNetworkFirewallPoliciesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region The name of the region for this request. - * @param RegionSetPolicyRequest $regionSetPolicyRequestResource The body resource for this request - * @param string $resource Name or id of the resource for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function setIamPolicy($project, $region, $regionSetPolicyRequestResource, $resource, array $optionalArgs = []) - { - $request = new SetIamPolicyRegionNetworkFirewallPolicyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setRegionSetPolicyRequestResource($regionSetPolicyRequestResource); - $request->setResource($resource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['resource'] = $resource; - $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 resource. - * - * Sample code: - * ``` - * $regionNetworkFirewallPoliciesClient = new RegionNetworkFirewallPoliciesClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $resource = 'resource'; - * $testPermissionsRequestResource = new TestPermissionsRequest(); - * $response = $regionNetworkFirewallPoliciesClient->testIamPermissions($project, $region, $resource, $testPermissionsRequestResource); - * } finally { - * $regionNetworkFirewallPoliciesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region The name of the region for this request. - * @param string $resource Name or id of the resource for this request. - * @param TestPermissionsRequest $testPermissionsRequestResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\TestPermissionsResponse - * - * @throws ApiException if the remote call fails - */ - public function testIamPermissions($project, $region, $resource, $testPermissionsRequestResource, array $optionalArgs = []) - { - $request = new TestIamPermissionsRegionNetworkFirewallPolicyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setResource($resource); - $request->setTestPermissionsRequestResource($testPermissionsRequestResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['resource'] = $resource; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('TestIamPermissions', TestPermissionsResponse::class, $optionalArgs, $request)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/RegionNotificationEndpointsGapicClient.php b/Compute/src/V1/Gapic/RegionNotificationEndpointsGapicClient.php deleted file mode 100644 index 7d5ec2383192..000000000000 --- a/Compute/src/V1/Gapic/RegionNotificationEndpointsGapicClient.php +++ /dev/null @@ -1,547 +0,0 @@ -delete($notificationEndpoint, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionNotificationEndpointsClient->delete($notificationEndpoint, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionNotificationEndpointsClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionNotificationEndpointsClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\RegionNotificationEndpointsClient}. - */ -class RegionNotificationEndpointsGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.RegionNotificationEndpoints'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/region_notification_endpoints_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/region_notification_endpoints_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/region_notification_endpoints_rest_client_config.php', - ], - ], - 'operationsClientClass' => RegionOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an RegionOperationsClient object with the same endpoint as $this. - * - * @return RegionOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetRegionOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteRegionOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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 the specified NotificationEndpoint in the given region - * - * Sample code: - * ``` - * $regionNotificationEndpointsClient = new RegionNotificationEndpointsClient(); - * try { - * $notificationEndpoint = 'notification_endpoint'; - * $project = 'project'; - * $region = 'region'; - * $operationResponse = $regionNotificationEndpointsClient->delete($notificationEndpoint, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionNotificationEndpointsClient->delete($notificationEndpoint, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionNotificationEndpointsClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionNotificationEndpointsClient->close(); - * } - * ``` - * - * @param string $notificationEndpoint Name of the NotificationEndpoint resource to delete. - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($notificationEndpoint, $project, $region, array $optionalArgs = []) - { - $request = new DeleteRegionNotificationEndpointRequest(); - $requestParamHeaders = []; - $request->setNotificationEndpoint($notificationEndpoint); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['notification_endpoint'] = $notificationEndpoint; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns the specified NotificationEndpoint resource in the given region. - * - * Sample code: - * ``` - * $regionNotificationEndpointsClient = new RegionNotificationEndpointsClient(); - * try { - * $notificationEndpoint = 'notification_endpoint'; - * $project = 'project'; - * $region = 'region'; - * $response = $regionNotificationEndpointsClient->get($notificationEndpoint, $project, $region); - * } finally { - * $regionNotificationEndpointsClient->close(); - * } - * ``` - * - * @param string $notificationEndpoint Name of the NotificationEndpoint resource to return. - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\NotificationEndpoint - * - * @throws ApiException if the remote call fails - */ - public function get($notificationEndpoint, $project, $region, array $optionalArgs = []) - { - $request = new GetRegionNotificationEndpointRequest(); - $requestParamHeaders = []; - $request->setNotificationEndpoint($notificationEndpoint); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['notification_endpoint'] = $notificationEndpoint; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', NotificationEndpoint::class, $optionalArgs, $request)->wait(); - } - - /** - * Create a NotificationEndpoint in the specified project in the given region using the parameters that are included in the request. - * - * Sample code: - * ``` - * $regionNotificationEndpointsClient = new RegionNotificationEndpointsClient(); - * try { - * $notificationEndpointResource = new NotificationEndpoint(); - * $project = 'project'; - * $region = 'region'; - * $operationResponse = $regionNotificationEndpointsClient->insert($notificationEndpointResource, $project, $region); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionNotificationEndpointsClient->insert($notificationEndpointResource, $project, $region); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionNotificationEndpointsClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionNotificationEndpointsClient->close(); - * } - * ``` - * - * @param NotificationEndpoint $notificationEndpointResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 insert($notificationEndpointResource, $project, $region, array $optionalArgs = []) - { - $request = new InsertRegionNotificationEndpointRequest(); - $requestParamHeaders = []; - $request->setNotificationEndpointResource($notificationEndpointResource); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Lists the NotificationEndpoints for a project in the given region. - * - * Sample code: - * ``` - * $regionNotificationEndpointsClient = new RegionNotificationEndpointsClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * // Iterate over pages of elements - * $pagedResponse = $regionNotificationEndpointsClient->list($project, $region); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $regionNotificationEndpointsClient->list($project, $region); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $regionNotificationEndpointsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, $region, array $optionalArgs = []) - { - $request = new ListRegionNotificationEndpointsRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, NotificationEndpointList::class, $request); - } -} diff --git a/Compute/src/V1/Gapic/RegionOperationsGapicClient.php b/Compute/src/V1/Gapic/RegionOperationsGapicClient.php deleted file mode 100644 index 8b30f44522b7..000000000000 --- a/Compute/src/V1/Gapic/RegionOperationsGapicClient.php +++ /dev/null @@ -1,410 +0,0 @@ -delete($operation, $project, $region); - * } finally { - * $regionOperationsClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\RegionOperationsClient}. - */ -class RegionOperationsGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.RegionOperations'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/region_operations_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/region_operations_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/region_operations_rest_client_config.php', - ], - ], - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * 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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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); - } - - /** - * Deletes the specified region-specific Operations resource. - * - * Sample code: - * ``` - * $regionOperationsClient = new RegionOperationsClient(); - * try { - * $operation = 'operation'; - * $project = 'project'; - * $region = 'region'; - * $response = $regionOperationsClient->delete($operation, $project, $region); - * } finally { - * $regionOperationsClient->close(); - * } - * ``` - * - * @param string $operation Name of the Operations resource to delete, or its unique numeric identifier. - * @param string $project Project ID for this request. - * @param string $region Name of the region for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\DeleteRegionOperationResponse - * - * @throws ApiException if the remote call fails - */ - public function delete($operation, $project, $region, array $optionalArgs = []) - { - $request = new DeleteRegionOperationRequest(); - $requestParamHeaders = []; - $request->setOperation($operation); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['operation'] = $operation; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Delete', DeleteRegionOperationResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Retrieves the specified region-specific Operations resource. - * - * Sample code: - * ``` - * $regionOperationsClient = new RegionOperationsClient(); - * try { - * $operation = 'operation'; - * $project = 'project'; - * $region = 'region'; - * $response = $regionOperationsClient->get($operation, $project, $region); - * } finally { - * $regionOperationsClient->close(); - * } - * ``` - * - * @param string $operation Name of the Operations resource to return, or its unique numeric identifier. - * @param string $project Project ID for this request. - * @param string $region Name of the region for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Operation - * - * @throws ApiException if the remote call fails - */ - public function get($operation, $project, $region, array $optionalArgs = []) - { - $request = new GetRegionOperationRequest(); - $requestParamHeaders = []; - $request->setOperation($operation); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['operation'] = $operation; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', Operation::class, $optionalArgs, $request)->wait(); - } - - /** - * Retrieves a list of Operation resources contained within the specified region. - * - * Sample code: - * ``` - * $regionOperationsClient = new RegionOperationsClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * // Iterate over pages of elements - * $pagedResponse = $regionOperationsClient->list($project, $region); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $regionOperationsClient->list($project, $region); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $regionOperationsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, $region, array $optionalArgs = []) - { - $request = new ListRegionOperationsRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, OperationList::class, $request); - } - - /** - * Waits for the specified Operation resource to return as `DONE` or for the request to approach the 2 minute deadline, and retrieves the specified Operation resource. This method differs from the `GET` method in that it waits for no more than the default deadline (2 minutes) and then returns the current state of the operation, which might be `DONE` or still in progress. This method is called on a best-effort basis. Specifically: - In uncommon cases, when the server is overloaded, the request might return before the default deadline is reached, or might return after zero seconds. - If the default deadline is reached, there is no guarantee that the operation is actually done when the method returns. Be prepared to retry if the operation is not `DONE`. - * - * Sample code: - * ``` - * $regionOperationsClient = new RegionOperationsClient(); - * try { - * $operation = 'operation'; - * $project = 'project'; - * $region = 'region'; - * $response = $regionOperationsClient->wait($operation, $project, $region); - * } finally { - * $regionOperationsClient->close(); - * } - * ``` - * - * @param string $operation Name of the Operations resource to return, or its unique numeric identifier. - * @param string $project Project ID for this request. - * @param string $region Name of the region for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Operation - * - * @throws ApiException if the remote call fails - */ - public function wait($operation, $project, $region, array $optionalArgs = []) - { - $request = new WaitRegionOperationRequest(); - $requestParamHeaders = []; - $request->setOperation($operation); - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['operation'] = $operation; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Wait', Operation::class, $optionalArgs, $request)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/RegionSecurityPoliciesGapicClient.php b/Compute/src/V1/Gapic/RegionSecurityPoliciesGapicClient.php deleted file mode 100644 index a0c7f32516fb..000000000000 --- a/Compute/src/V1/Gapic/RegionSecurityPoliciesGapicClient.php +++ /dev/null @@ -1,1025 +0,0 @@ -addRule($project, $region, $securityPolicy, $securityPolicyRuleResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionSecurityPoliciesClient->addRule($project, $region, $securityPolicy, $securityPolicyRuleResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionSecurityPoliciesClient->resumeOperation($operationName, 'addRule'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionSecurityPoliciesClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\RegionSecurityPoliciesClient}. - */ -class RegionSecurityPoliciesGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.RegionSecurityPolicies'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/region_security_policies_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/region_security_policies_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/region_security_policies_rest_client_config.php', - ], - ], - 'operationsClientClass' => RegionOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an RegionOperationsClient object with the same endpoint as $this. - * - * @return RegionOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetRegionOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteRegionOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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); - } - - /** - * Inserts a rule into a security policy. - * - * Sample code: - * ``` - * $regionSecurityPoliciesClient = new RegionSecurityPoliciesClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $securityPolicy = 'security_policy'; - * $securityPolicyRuleResource = new SecurityPolicyRule(); - * $operationResponse = $regionSecurityPoliciesClient->addRule($project, $region, $securityPolicy, $securityPolicyRuleResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionSecurityPoliciesClient->addRule($project, $region, $securityPolicy, $securityPolicyRuleResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionSecurityPoliciesClient->resumeOperation($operationName, 'addRule'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionSecurityPoliciesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param string $securityPolicy Name of the security policy to update. - * @param SecurityPolicyRule $securityPolicyRuleResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type bool $validateOnly - * If true, the request will not be committed. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 addRule($project, $region, $securityPolicy, $securityPolicyRuleResource, array $optionalArgs = []) - { - $request = new AddRuleRegionSecurityPolicyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setSecurityPolicy($securityPolicy); - $request->setSecurityPolicyRuleResource($securityPolicyRuleResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['security_policy'] = $securityPolicy; - 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('AddRule', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Deletes the specified policy. - * - * Sample code: - * ``` - * $regionSecurityPoliciesClient = new RegionSecurityPoliciesClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $securityPolicy = 'security_policy'; - * $operationResponse = $regionSecurityPoliciesClient->delete($project, $region, $securityPolicy); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionSecurityPoliciesClient->delete($project, $region, $securityPolicy); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionSecurityPoliciesClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionSecurityPoliciesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param string $securityPolicy Name of the security policy to delete. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($project, $region, $securityPolicy, array $optionalArgs = []) - { - $request = new DeleteRegionSecurityPolicyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setSecurityPolicy($securityPolicy); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['security_policy'] = $securityPolicy; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * List all of the ordered rules present in a single specified policy. - * - * Sample code: - * ``` - * $regionSecurityPoliciesClient = new RegionSecurityPoliciesClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $securityPolicy = 'security_policy'; - * $response = $regionSecurityPoliciesClient->get($project, $region, $securityPolicy); - * } finally { - * $regionSecurityPoliciesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param string $securityPolicy Name of the security policy to get. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\SecurityPolicy - * - * @throws ApiException if the remote call fails - */ - public function get($project, $region, $securityPolicy, array $optionalArgs = []) - { - $request = new GetRegionSecurityPolicyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setSecurityPolicy($securityPolicy); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['security_policy'] = $securityPolicy; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', SecurityPolicy::class, $optionalArgs, $request)->wait(); - } - - /** - * Gets a rule at the specified priority. - * - * Sample code: - * ``` - * $regionSecurityPoliciesClient = new RegionSecurityPoliciesClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $securityPolicy = 'security_policy'; - * $response = $regionSecurityPoliciesClient->getRule($project, $region, $securityPolicy); - * } finally { - * $regionSecurityPoliciesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param string $securityPolicy Name of the security policy to which the queried rule belongs. - * @param array $optionalArgs { - * Optional. - * - * @type int $priority - * The priority of the rule to get from the security policy. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\SecurityPolicyRule - * - * @throws ApiException if the remote call fails - */ - public function getRule($project, $region, $securityPolicy, array $optionalArgs = []) - { - $request = new GetRuleRegionSecurityPolicyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setSecurityPolicy($securityPolicy); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['security_policy'] = $securityPolicy; - if (isset($optionalArgs['priority'])) { - $request->setPriority($optionalArgs['priority']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetRule', SecurityPolicyRule::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates a new policy in the specified project using the data included in the request. - * - * Sample code: - * ``` - * $regionSecurityPoliciesClient = new RegionSecurityPoliciesClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $securityPolicyResource = new SecurityPolicy(); - * $operationResponse = $regionSecurityPoliciesClient->insert($project, $region, $securityPolicyResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionSecurityPoliciesClient->insert($project, $region, $securityPolicyResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionSecurityPoliciesClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionSecurityPoliciesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param SecurityPolicy $securityPolicyResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 $validateOnly - * If true, the request will not be committed. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 insert($project, $region, $securityPolicyResource, array $optionalArgs = []) - { - $request = new InsertRegionSecurityPolicyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setSecurityPolicyResource($securityPolicyResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * List all the policies that have been configured for the specified project and region. - * - * Sample code: - * ``` - * $regionSecurityPoliciesClient = new RegionSecurityPoliciesClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * // Iterate over pages of elements - * $pagedResponse = $regionSecurityPoliciesClient->list($project, $region); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $regionSecurityPoliciesClient->list($project, $region); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $regionSecurityPoliciesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, $region, array $optionalArgs = []) - { - $request = new ListRegionSecurityPoliciesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, SecurityPolicyList::class, $request); - } - - /** - * Patches the specified policy with the data included in the request. To clear fields in the policy, leave the fields empty and specify them in the updateMask. This cannot be used to be update the rules in the policy. Please use the per rule methods like addRule, patchRule, and removeRule instead. - * - * Sample code: - * ``` - * $regionSecurityPoliciesClient = new RegionSecurityPoliciesClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $securityPolicy = 'security_policy'; - * $securityPolicyResource = new SecurityPolicy(); - * $operationResponse = $regionSecurityPoliciesClient->patch($project, $region, $securityPolicy, $securityPolicyResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionSecurityPoliciesClient->patch($project, $region, $securityPolicy, $securityPolicyResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionSecurityPoliciesClient->resumeOperation($operationName, 'patch'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionSecurityPoliciesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param string $securityPolicy Name of the security policy to update. - * @param SecurityPolicy $securityPolicyResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 $updateMask - * Indicates fields to be cleared as part of this request. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 patch($project, $region, $securityPolicy, $securityPolicyResource, array $optionalArgs = []) - { - $request = new PatchRegionSecurityPolicyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setSecurityPolicy($securityPolicy); - $request->setSecurityPolicyResource($securityPolicyResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['security_policy'] = $securityPolicy; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('Patch', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Patches a rule at the specified priority. To clear fields in the rule, leave the fields empty and specify them in the updateMask. - * - * Sample code: - * ``` - * $regionSecurityPoliciesClient = new RegionSecurityPoliciesClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $securityPolicy = 'security_policy'; - * $securityPolicyRuleResource = new SecurityPolicyRule(); - * $operationResponse = $regionSecurityPoliciesClient->patchRule($project, $region, $securityPolicy, $securityPolicyRuleResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionSecurityPoliciesClient->patchRule($project, $region, $securityPolicy, $securityPolicyRuleResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionSecurityPoliciesClient->resumeOperation($operationName, 'patchRule'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionSecurityPoliciesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param string $securityPolicy Name of the security policy to update. - * @param SecurityPolicyRule $securityPolicyRuleResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type int $priority - * The priority of the rule to patch. - * @type string $updateMask - * Indicates fields to be cleared as part of this request. - * @type bool $validateOnly - * If true, the request will not be committed. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 patchRule($project, $region, $securityPolicy, $securityPolicyRuleResource, array $optionalArgs = []) - { - $request = new PatchRuleRegionSecurityPolicyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setSecurityPolicy($securityPolicy); - $request->setSecurityPolicyRuleResource($securityPolicyRuleResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['security_policy'] = $securityPolicy; - if (isset($optionalArgs['priority'])) { - $request->setPriority($optionalArgs['priority']); - } - - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - 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('PatchRule', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Deletes a rule at the specified priority. - * - * Sample code: - * ``` - * $regionSecurityPoliciesClient = new RegionSecurityPoliciesClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $securityPolicy = 'security_policy'; - * $operationResponse = $regionSecurityPoliciesClient->removeRule($project, $region, $securityPolicy); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionSecurityPoliciesClient->removeRule($project, $region, $securityPolicy); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionSecurityPoliciesClient->resumeOperation($operationName, 'removeRule'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionSecurityPoliciesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param string $securityPolicy Name of the security policy to update. - * @param array $optionalArgs { - * Optional. - * - * @type int $priority - * The priority of the rule to remove from the security policy. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 removeRule($project, $region, $securityPolicy, array $optionalArgs = []) - { - $request = new RemoveRuleRegionSecurityPolicyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setSecurityPolicy($securityPolicy); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['security_policy'] = $securityPolicy; - if (isset($optionalArgs['priority'])) { - $request->setPriority($optionalArgs['priority']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('RemoveRule', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Sets the labels on a security policy. To learn more about labels, read the Labeling Resources documentation. - * - * Sample code: - * ``` - * $regionSecurityPoliciesClient = new RegionSecurityPoliciesClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $regionSetLabelsRequestResource = new RegionSetLabelsRequest(); - * $resource = 'resource'; - * $operationResponse = $regionSecurityPoliciesClient->setLabels($project, $region, $regionSetLabelsRequestResource, $resource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionSecurityPoliciesClient->setLabels($project, $region, $regionSetLabelsRequestResource, $resource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionSecurityPoliciesClient->resumeOperation($operationName, 'setLabels'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionSecurityPoliciesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region The region for this request. - * @param RegionSetLabelsRequest $regionSetLabelsRequestResource The body resource for this request - * @param string $resource Name or id of the resource for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 setLabels($project, $region, $regionSetLabelsRequestResource, $resource, array $optionalArgs = []) - { - $request = new SetLabelsRegionSecurityPolicyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setRegionSetLabelsRequestResource($regionSetLabelsRequestResource); - $request->setResource($resource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['resource'] = $resource; - 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('SetLabels', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/RegionSslCertificatesGapicClient.php b/Compute/src/V1/Gapic/RegionSslCertificatesGapicClient.php deleted file mode 100644 index 4b4d18d95f4a..000000000000 --- a/Compute/src/V1/Gapic/RegionSslCertificatesGapicClient.php +++ /dev/null @@ -1,547 +0,0 @@ -delete($project, $region, $sslCertificate); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionSslCertificatesClient->delete($project, $region, $sslCertificate); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionSslCertificatesClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionSslCertificatesClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\RegionSslCertificatesClient}. - */ -class RegionSslCertificatesGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.RegionSslCertificates'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/region_ssl_certificates_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/region_ssl_certificates_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/region_ssl_certificates_rest_client_config.php', - ], - ], - 'operationsClientClass' => RegionOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an RegionOperationsClient object with the same endpoint as $this. - * - * @return RegionOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetRegionOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteRegionOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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 the specified SslCertificate resource in the region. - * - * Sample code: - * ``` - * $regionSslCertificatesClient = new RegionSslCertificatesClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $sslCertificate = 'ssl_certificate'; - * $operationResponse = $regionSslCertificatesClient->delete($project, $region, $sslCertificate); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionSslCertificatesClient->delete($project, $region, $sslCertificate); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionSslCertificatesClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionSslCertificatesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param string $sslCertificate Name of the SslCertificate resource to delete. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($project, $region, $sslCertificate, array $optionalArgs = []) - { - $request = new DeleteRegionSslCertificateRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setSslCertificate($sslCertificate); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['ssl_certificate'] = $sslCertificate; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns the specified SslCertificate resource in the specified region. Get a list of available SSL certificates by making a list() request. - * - * Sample code: - * ``` - * $regionSslCertificatesClient = new RegionSslCertificatesClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $sslCertificate = 'ssl_certificate'; - * $response = $regionSslCertificatesClient->get($project, $region, $sslCertificate); - * } finally { - * $regionSslCertificatesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param string $sslCertificate Name of the SslCertificate resource to return. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\SslCertificate - * - * @throws ApiException if the remote call fails - */ - public function get($project, $region, $sslCertificate, array $optionalArgs = []) - { - $request = new GetRegionSslCertificateRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setSslCertificate($sslCertificate); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['ssl_certificate'] = $sslCertificate; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', SslCertificate::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates a SslCertificate resource in the specified project and region using the data included in the request - * - * Sample code: - * ``` - * $regionSslCertificatesClient = new RegionSslCertificatesClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $sslCertificateResource = new SslCertificate(); - * $operationResponse = $regionSslCertificatesClient->insert($project, $region, $sslCertificateResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionSslCertificatesClient->insert($project, $region, $sslCertificateResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionSslCertificatesClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionSslCertificatesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param SslCertificate $sslCertificateResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 insert($project, $region, $sslCertificateResource, array $optionalArgs = []) - { - $request = new InsertRegionSslCertificateRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setSslCertificateResource($sslCertificateResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Retrieves the list of SslCertificate resources available to the specified project in the specified region. - * - * Sample code: - * ``` - * $regionSslCertificatesClient = new RegionSslCertificatesClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * // Iterate over pages of elements - * $pagedResponse = $regionSslCertificatesClient->list($project, $region); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $regionSslCertificatesClient->list($project, $region); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $regionSslCertificatesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, $region, array $optionalArgs = []) - { - $request = new ListRegionSslCertificatesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, SslCertificateList::class, $request); - } -} diff --git a/Compute/src/V1/Gapic/RegionSslPoliciesGapicClient.php b/Compute/src/V1/Gapic/RegionSslPoliciesGapicClient.php deleted file mode 100644 index 023e25f4c3ba..000000000000 --- a/Compute/src/V1/Gapic/RegionSslPoliciesGapicClient.php +++ /dev/null @@ -1,702 +0,0 @@ -delete($project, $region, $sslPolicy); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionSslPoliciesClient->delete($project, $region, $sslPolicy); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionSslPoliciesClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionSslPoliciesClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\RegionSslPoliciesClient}. - */ -class RegionSslPoliciesGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.RegionSslPolicies'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/region_ssl_policies_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/region_ssl_policies_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/region_ssl_policies_rest_client_config.php', - ], - ], - 'operationsClientClass' => RegionOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an RegionOperationsClient object with the same endpoint as $this. - * - * @return RegionOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetRegionOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteRegionOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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 the specified SSL policy. The SSL policy resource can be deleted only if it is not in use by any TargetHttpsProxy or TargetSslProxy resources. - * - * Sample code: - * ``` - * $regionSslPoliciesClient = new RegionSslPoliciesClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $sslPolicy = 'ssl_policy'; - * $operationResponse = $regionSslPoliciesClient->delete($project, $region, $sslPolicy); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionSslPoliciesClient->delete($project, $region, $sslPolicy); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionSslPoliciesClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionSslPoliciesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param string $sslPolicy Name of the SSL policy to delete. The name must be 1-63 characters long, and comply with RFC1035. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($project, $region, $sslPolicy, array $optionalArgs = []) - { - $request = new DeleteRegionSslPolicyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setSslPolicy($sslPolicy); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['ssl_policy'] = $sslPolicy; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Lists all of the ordered rules present in a single specified policy. - * - * Sample code: - * ``` - * $regionSslPoliciesClient = new RegionSslPoliciesClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $sslPolicy = 'ssl_policy'; - * $response = $regionSslPoliciesClient->get($project, $region, $sslPolicy); - * } finally { - * $regionSslPoliciesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param string $sslPolicy Name of the SSL policy to update. The name must be 1-63 characters long, and comply with RFC1035. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\SslPolicy - * - * @throws ApiException if the remote call fails - */ - public function get($project, $region, $sslPolicy, array $optionalArgs = []) - { - $request = new GetRegionSslPolicyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setSslPolicy($sslPolicy); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['ssl_policy'] = $sslPolicy; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', SslPolicy::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates a new policy in the specified project and region using the data included in the request. - * - * Sample code: - * ``` - * $regionSslPoliciesClient = new RegionSslPoliciesClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $sslPolicyResource = new SslPolicy(); - * $operationResponse = $regionSslPoliciesClient->insert($project, $region, $sslPolicyResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionSslPoliciesClient->insert($project, $region, $sslPolicyResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionSslPoliciesClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionSslPoliciesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param SslPolicy $sslPolicyResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 insert($project, $region, $sslPolicyResource, array $optionalArgs = []) - { - $request = new InsertRegionSslPolicyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setSslPolicyResource($sslPolicyResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Lists all the SSL policies that have been configured for the specified project and region. - * - * Sample code: - * ``` - * $regionSslPoliciesClient = new RegionSslPoliciesClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * // Iterate over pages of elements - * $pagedResponse = $regionSslPoliciesClient->list($project, $region); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $regionSslPoliciesClient->list($project, $region); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $regionSslPoliciesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, $region, array $optionalArgs = []) - { - $request = new ListRegionSslPoliciesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, SslPoliciesList::class, $request); - } - - /** - * Lists all features that can be specified in the SSL policy when using custom profile. - * - * Sample code: - * ``` - * $regionSslPoliciesClient = new RegionSslPoliciesClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $response = $regionSslPoliciesClient->listAvailableFeatures($project, $region); - * } finally { - * $regionSslPoliciesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @type string $pageToken - * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. - * @type bool $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\SslPoliciesListAvailableFeaturesResponse - * - * @throws ApiException if the remote call fails - */ - public function listAvailableFeatures($project, $region, array $optionalArgs = []) - { - $request = new ListAvailableFeaturesRegionSslPoliciesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('ListAvailableFeatures', SslPoliciesListAvailableFeaturesResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Patches the specified SSL policy with the data included in the request. - * - * Sample code: - * ``` - * $regionSslPoliciesClient = new RegionSslPoliciesClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $sslPolicy = 'ssl_policy'; - * $sslPolicyResource = new SslPolicy(); - * $operationResponse = $regionSslPoliciesClient->patch($project, $region, $sslPolicy, $sslPolicyResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionSslPoliciesClient->patch($project, $region, $sslPolicy, $sslPolicyResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionSslPoliciesClient->resumeOperation($operationName, 'patch'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionSslPoliciesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param string $sslPolicy Name of the SSL policy to update. The name must be 1-63 characters long, and comply with RFC1035. - * @param SslPolicy $sslPolicyResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 patch($project, $region, $sslPolicy, $sslPolicyResource, array $optionalArgs = []) - { - $request = new PatchRegionSslPolicyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setSslPolicy($sslPolicy); - $request->setSslPolicyResource($sslPolicyResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['ssl_policy'] = $sslPolicy; - 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('Patch', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/RegionTargetHttpProxiesGapicClient.php b/Compute/src/V1/Gapic/RegionTargetHttpProxiesGapicClient.php deleted file mode 100644 index cb4cfe783db3..000000000000 --- a/Compute/src/V1/Gapic/RegionTargetHttpProxiesGapicClient.php +++ /dev/null @@ -1,628 +0,0 @@ -delete($project, $region, $targetHttpProxy); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionTargetHttpProxiesClient->delete($project, $region, $targetHttpProxy); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionTargetHttpProxiesClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionTargetHttpProxiesClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\RegionTargetHttpProxiesClient}. - */ -class RegionTargetHttpProxiesGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.RegionTargetHttpProxies'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/region_target_http_proxies_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/region_target_http_proxies_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/region_target_http_proxies_rest_client_config.php', - ], - ], - 'operationsClientClass' => RegionOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an RegionOperationsClient object with the same endpoint as $this. - * - * @return RegionOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetRegionOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteRegionOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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 the specified TargetHttpProxy resource. - * - * Sample code: - * ``` - * $regionTargetHttpProxiesClient = new RegionTargetHttpProxiesClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $targetHttpProxy = 'target_http_proxy'; - * $operationResponse = $regionTargetHttpProxiesClient->delete($project, $region, $targetHttpProxy); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionTargetHttpProxiesClient->delete($project, $region, $targetHttpProxy); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionTargetHttpProxiesClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionTargetHttpProxiesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param string $targetHttpProxy Name of the TargetHttpProxy resource to delete. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($project, $region, $targetHttpProxy, array $optionalArgs = []) - { - $request = new DeleteRegionTargetHttpProxyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setTargetHttpProxy($targetHttpProxy); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['target_http_proxy'] = $targetHttpProxy; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns the specified TargetHttpProxy resource in the specified region. - * - * Sample code: - * ``` - * $regionTargetHttpProxiesClient = new RegionTargetHttpProxiesClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $targetHttpProxy = 'target_http_proxy'; - * $response = $regionTargetHttpProxiesClient->get($project, $region, $targetHttpProxy); - * } finally { - * $regionTargetHttpProxiesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param string $targetHttpProxy Name of the TargetHttpProxy resource to return. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\TargetHttpProxy - * - * @throws ApiException if the remote call fails - */ - public function get($project, $region, $targetHttpProxy, array $optionalArgs = []) - { - $request = new GetRegionTargetHttpProxyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setTargetHttpProxy($targetHttpProxy); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['target_http_proxy'] = $targetHttpProxy; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', TargetHttpProxy::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates a TargetHttpProxy resource in the specified project and region using the data included in the request. - * - * Sample code: - * ``` - * $regionTargetHttpProxiesClient = new RegionTargetHttpProxiesClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $targetHttpProxyResource = new TargetHttpProxy(); - * $operationResponse = $regionTargetHttpProxiesClient->insert($project, $region, $targetHttpProxyResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionTargetHttpProxiesClient->insert($project, $region, $targetHttpProxyResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionTargetHttpProxiesClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionTargetHttpProxiesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param TargetHttpProxy $targetHttpProxyResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 insert($project, $region, $targetHttpProxyResource, array $optionalArgs = []) - { - $request = new InsertRegionTargetHttpProxyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setTargetHttpProxyResource($targetHttpProxyResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Retrieves the list of TargetHttpProxy resources available to the specified project in the specified region. - * - * Sample code: - * ``` - * $regionTargetHttpProxiesClient = new RegionTargetHttpProxiesClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * // Iterate over pages of elements - * $pagedResponse = $regionTargetHttpProxiesClient->list($project, $region); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $regionTargetHttpProxiesClient->list($project, $region); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $regionTargetHttpProxiesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, $region, array $optionalArgs = []) - { - $request = new ListRegionTargetHttpProxiesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, TargetHttpProxyList::class, $request); - } - - /** - * Changes the URL map for TargetHttpProxy. - * - * Sample code: - * ``` - * $regionTargetHttpProxiesClient = new RegionTargetHttpProxiesClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $targetHttpProxy = 'target_http_proxy'; - * $urlMapReferenceResource = new UrlMapReference(); - * $operationResponse = $regionTargetHttpProxiesClient->setUrlMap($project, $region, $targetHttpProxy, $urlMapReferenceResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionTargetHttpProxiesClient->setUrlMap($project, $region, $targetHttpProxy, $urlMapReferenceResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionTargetHttpProxiesClient->resumeOperation($operationName, 'setUrlMap'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionTargetHttpProxiesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param string $targetHttpProxy Name of the TargetHttpProxy to set a URL map for. - * @param UrlMapReference $urlMapReferenceResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 setUrlMap($project, $region, $targetHttpProxy, $urlMapReferenceResource, array $optionalArgs = []) - { - $request = new SetUrlMapRegionTargetHttpProxyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setTargetHttpProxy($targetHttpProxy); - $request->setUrlMapReferenceResource($urlMapReferenceResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['target_http_proxy'] = $targetHttpProxy; - 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('SetUrlMap', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/RegionTargetHttpsProxiesGapicClient.php b/Compute/src/V1/Gapic/RegionTargetHttpsProxiesGapicClient.php deleted file mode 100644 index 4575ac37e659..000000000000 --- a/Compute/src/V1/Gapic/RegionTargetHttpsProxiesGapicClient.php +++ /dev/null @@ -1,789 +0,0 @@ -delete($project, $region, $targetHttpsProxy); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionTargetHttpsProxiesClient->delete($project, $region, $targetHttpsProxy); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionTargetHttpsProxiesClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionTargetHttpsProxiesClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\RegionTargetHttpsProxiesClient}. - */ -class RegionTargetHttpsProxiesGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.RegionTargetHttpsProxies'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/region_target_https_proxies_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/region_target_https_proxies_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/region_target_https_proxies_rest_client_config.php', - ], - ], - 'operationsClientClass' => RegionOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an RegionOperationsClient object with the same endpoint as $this. - * - * @return RegionOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetRegionOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteRegionOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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 the specified TargetHttpsProxy resource. - * - * Sample code: - * ``` - * $regionTargetHttpsProxiesClient = new RegionTargetHttpsProxiesClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $targetHttpsProxy = 'target_https_proxy'; - * $operationResponse = $regionTargetHttpsProxiesClient->delete($project, $region, $targetHttpsProxy); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionTargetHttpsProxiesClient->delete($project, $region, $targetHttpsProxy); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionTargetHttpsProxiesClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionTargetHttpsProxiesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param string $targetHttpsProxy Name of the TargetHttpsProxy resource to delete. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($project, $region, $targetHttpsProxy, array $optionalArgs = []) - { - $request = new DeleteRegionTargetHttpsProxyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setTargetHttpsProxy($targetHttpsProxy); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['target_https_proxy'] = $targetHttpsProxy; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns the specified TargetHttpsProxy resource in the specified region. - * - * Sample code: - * ``` - * $regionTargetHttpsProxiesClient = new RegionTargetHttpsProxiesClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $targetHttpsProxy = 'target_https_proxy'; - * $response = $regionTargetHttpsProxiesClient->get($project, $region, $targetHttpsProxy); - * } finally { - * $regionTargetHttpsProxiesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param string $targetHttpsProxy Name of the TargetHttpsProxy resource to return. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\TargetHttpsProxy - * - * @throws ApiException if the remote call fails - */ - public function get($project, $region, $targetHttpsProxy, array $optionalArgs = []) - { - $request = new GetRegionTargetHttpsProxyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setTargetHttpsProxy($targetHttpsProxy); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['target_https_proxy'] = $targetHttpsProxy; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', TargetHttpsProxy::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates a TargetHttpsProxy resource in the specified project and region using the data included in the request. - * - * Sample code: - * ``` - * $regionTargetHttpsProxiesClient = new RegionTargetHttpsProxiesClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $targetHttpsProxyResource = new TargetHttpsProxy(); - * $operationResponse = $regionTargetHttpsProxiesClient->insert($project, $region, $targetHttpsProxyResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionTargetHttpsProxiesClient->insert($project, $region, $targetHttpsProxyResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionTargetHttpsProxiesClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionTargetHttpsProxiesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param TargetHttpsProxy $targetHttpsProxyResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 insert($project, $region, $targetHttpsProxyResource, array $optionalArgs = []) - { - $request = new InsertRegionTargetHttpsProxyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setTargetHttpsProxyResource($targetHttpsProxyResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Retrieves the list of TargetHttpsProxy resources available to the specified project in the specified region. - * - * Sample code: - * ``` - * $regionTargetHttpsProxiesClient = new RegionTargetHttpsProxiesClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * // Iterate over pages of elements - * $pagedResponse = $regionTargetHttpsProxiesClient->list($project, $region); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $regionTargetHttpsProxiesClient->list($project, $region); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $regionTargetHttpsProxiesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, $region, array $optionalArgs = []) - { - $request = new ListRegionTargetHttpsProxiesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, TargetHttpsProxyList::class, $request); - } - - /** - * Patches the specified regional TargetHttpsProxy resource with the data included in the request. This method supports PATCH semantics and uses JSON merge patch format and processing rules. - * - * Sample code: - * ``` - * $regionTargetHttpsProxiesClient = new RegionTargetHttpsProxiesClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $targetHttpsProxy = 'target_https_proxy'; - * $targetHttpsProxyResource = new TargetHttpsProxy(); - * $operationResponse = $regionTargetHttpsProxiesClient->patch($project, $region, $targetHttpsProxy, $targetHttpsProxyResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionTargetHttpsProxiesClient->patch($project, $region, $targetHttpsProxy, $targetHttpsProxyResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionTargetHttpsProxiesClient->resumeOperation($operationName, 'patch'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionTargetHttpsProxiesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region for this request. - * @param string $targetHttpsProxy Name of the TargetHttpsProxy resource to patch. - * @param TargetHttpsProxy $targetHttpsProxyResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 patch($project, $region, $targetHttpsProxy, $targetHttpsProxyResource, array $optionalArgs = []) - { - $request = new PatchRegionTargetHttpsProxyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setTargetHttpsProxy($targetHttpsProxy); - $request->setTargetHttpsProxyResource($targetHttpsProxyResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['target_https_proxy'] = $targetHttpsProxy; - 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('Patch', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Replaces SslCertificates for TargetHttpsProxy. - * - * Sample code: - * ``` - * $regionTargetHttpsProxiesClient = new RegionTargetHttpsProxiesClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $regionTargetHttpsProxiesSetSslCertificatesRequestResource = new RegionTargetHttpsProxiesSetSslCertificatesRequest(); - * $targetHttpsProxy = 'target_https_proxy'; - * $operationResponse = $regionTargetHttpsProxiesClient->setSslCertificates($project, $region, $regionTargetHttpsProxiesSetSslCertificatesRequestResource, $targetHttpsProxy); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionTargetHttpsProxiesClient->setSslCertificates($project, $region, $regionTargetHttpsProxiesSetSslCertificatesRequestResource, $targetHttpsProxy); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionTargetHttpsProxiesClient->resumeOperation($operationName, 'setSslCertificates'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionTargetHttpsProxiesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param RegionTargetHttpsProxiesSetSslCertificatesRequest $regionTargetHttpsProxiesSetSslCertificatesRequestResource The body resource for this request - * @param string $targetHttpsProxy Name of the TargetHttpsProxy resource to set an SslCertificates resource for. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 setSslCertificates($project, $region, $regionTargetHttpsProxiesSetSslCertificatesRequestResource, $targetHttpsProxy, array $optionalArgs = []) - { - $request = new SetSslCertificatesRegionTargetHttpsProxyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setRegionTargetHttpsProxiesSetSslCertificatesRequestResource($regionTargetHttpsProxiesSetSslCertificatesRequestResource); - $request->setTargetHttpsProxy($targetHttpsProxy); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['target_https_proxy'] = $targetHttpsProxy; - 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('SetSslCertificates', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Changes the URL map for TargetHttpsProxy. - * - * Sample code: - * ``` - * $regionTargetHttpsProxiesClient = new RegionTargetHttpsProxiesClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $targetHttpsProxy = 'target_https_proxy'; - * $urlMapReferenceResource = new UrlMapReference(); - * $operationResponse = $regionTargetHttpsProxiesClient->setUrlMap($project, $region, $targetHttpsProxy, $urlMapReferenceResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionTargetHttpsProxiesClient->setUrlMap($project, $region, $targetHttpsProxy, $urlMapReferenceResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionTargetHttpsProxiesClient->resumeOperation($operationName, 'setUrlMap'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionTargetHttpsProxiesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param string $targetHttpsProxy Name of the TargetHttpsProxy to set a URL map for. - * @param UrlMapReference $urlMapReferenceResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 setUrlMap($project, $region, $targetHttpsProxy, $urlMapReferenceResource, array $optionalArgs = []) - { - $request = new SetUrlMapRegionTargetHttpsProxyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setTargetHttpsProxy($targetHttpsProxy); - $request->setUrlMapReferenceResource($urlMapReferenceResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['target_https_proxy'] = $targetHttpsProxy; - 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('SetUrlMap', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/RegionTargetTcpProxiesGapicClient.php b/Compute/src/V1/Gapic/RegionTargetTcpProxiesGapicClient.php deleted file mode 100644 index 788b69ef6cd1..000000000000 --- a/Compute/src/V1/Gapic/RegionTargetTcpProxiesGapicClient.php +++ /dev/null @@ -1,547 +0,0 @@ -delete($project, $region, $targetTcpProxy); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionTargetTcpProxiesClient->delete($project, $region, $targetTcpProxy); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionTargetTcpProxiesClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionTargetTcpProxiesClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\RegionTargetTcpProxiesClient}. - */ -class RegionTargetTcpProxiesGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.RegionTargetTcpProxies'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/region_target_tcp_proxies_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/region_target_tcp_proxies_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/region_target_tcp_proxies_rest_client_config.php', - ], - ], - 'operationsClientClass' => RegionOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an RegionOperationsClient object with the same endpoint as $this. - * - * @return RegionOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetRegionOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteRegionOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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 the specified TargetTcpProxy resource. - * - * Sample code: - * ``` - * $regionTargetTcpProxiesClient = new RegionTargetTcpProxiesClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $targetTcpProxy = 'target_tcp_proxy'; - * $operationResponse = $regionTargetTcpProxiesClient->delete($project, $region, $targetTcpProxy); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionTargetTcpProxiesClient->delete($project, $region, $targetTcpProxy); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionTargetTcpProxiesClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionTargetTcpProxiesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param string $targetTcpProxy Name of the TargetTcpProxy resource to delete. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($project, $region, $targetTcpProxy, array $optionalArgs = []) - { - $request = new DeleteRegionTargetTcpProxyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setTargetTcpProxy($targetTcpProxy); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['target_tcp_proxy'] = $targetTcpProxy; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns the specified TargetTcpProxy resource. - * - * Sample code: - * ``` - * $regionTargetTcpProxiesClient = new RegionTargetTcpProxiesClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $targetTcpProxy = 'target_tcp_proxy'; - * $response = $regionTargetTcpProxiesClient->get($project, $region, $targetTcpProxy); - * } finally { - * $regionTargetTcpProxiesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param string $targetTcpProxy Name of the TargetTcpProxy resource to return. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\TargetTcpProxy - * - * @throws ApiException if the remote call fails - */ - public function get($project, $region, $targetTcpProxy, array $optionalArgs = []) - { - $request = new GetRegionTargetTcpProxyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setTargetTcpProxy($targetTcpProxy); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['target_tcp_proxy'] = $targetTcpProxy; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', TargetTcpProxy::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates a TargetTcpProxy resource in the specified project and region using the data included in the request. - * - * Sample code: - * ``` - * $regionTargetTcpProxiesClient = new RegionTargetTcpProxiesClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $targetTcpProxyResource = new TargetTcpProxy(); - * $operationResponse = $regionTargetTcpProxiesClient->insert($project, $region, $targetTcpProxyResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionTargetTcpProxiesClient->insert($project, $region, $targetTcpProxyResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionTargetTcpProxiesClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionTargetTcpProxiesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param TargetTcpProxy $targetTcpProxyResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 insert($project, $region, $targetTcpProxyResource, array $optionalArgs = []) - { - $request = new InsertRegionTargetTcpProxyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setTargetTcpProxyResource($targetTcpProxyResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Retrieves a list of TargetTcpProxy resources available to the specified project in a given region. - * - * Sample code: - * ``` - * $regionTargetTcpProxiesClient = new RegionTargetTcpProxiesClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * // Iterate over pages of elements - * $pagedResponse = $regionTargetTcpProxiesClient->list($project, $region); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $regionTargetTcpProxiesClient->list($project, $region); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $regionTargetTcpProxiesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, $region, array $optionalArgs = []) - { - $request = new ListRegionTargetTcpProxiesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, TargetTcpProxyList::class, $request); - } -} diff --git a/Compute/src/V1/Gapic/RegionUrlMapsGapicClient.php b/Compute/src/V1/Gapic/RegionUrlMapsGapicClient.php deleted file mode 100644 index 09918e9d2624..000000000000 --- a/Compute/src/V1/Gapic/RegionUrlMapsGapicClient.php +++ /dev/null @@ -1,760 +0,0 @@ -delete($project, $region, $urlMap); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionUrlMapsClient->delete($project, $region, $urlMap); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionUrlMapsClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionUrlMapsClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\RegionUrlMapsClient}. - */ -class RegionUrlMapsGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.RegionUrlMaps'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/region_url_maps_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/region_url_maps_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/region_url_maps_rest_client_config.php', - ], - ], - 'operationsClientClass' => RegionOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an RegionOperationsClient object with the same endpoint as $this. - * - * @return RegionOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetRegionOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteRegionOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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 the specified UrlMap resource. - * - * Sample code: - * ``` - * $regionUrlMapsClient = new RegionUrlMapsClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $urlMap = 'url_map'; - * $operationResponse = $regionUrlMapsClient->delete($project, $region, $urlMap); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionUrlMapsClient->delete($project, $region, $urlMap); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionUrlMapsClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionUrlMapsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param string $urlMap Name of the UrlMap resource to delete. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * begin_interface: MixerMutationRequestBuilder Request ID to support idempotency. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 delete($project, $region, $urlMap, array $optionalArgs = []) - { - $request = new DeleteRegionUrlMapRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setUrlMap($urlMap); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['url_map'] = $urlMap; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns the specified UrlMap resource. - * - * Sample code: - * ``` - * $regionUrlMapsClient = new RegionUrlMapsClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $urlMap = 'url_map'; - * $response = $regionUrlMapsClient->get($project, $region, $urlMap); - * } finally { - * $regionUrlMapsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param string $urlMap Name of the UrlMap resource to return. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\UrlMap - * - * @throws ApiException if the remote call fails - */ - public function get($project, $region, $urlMap, array $optionalArgs = []) - { - $request = new GetRegionUrlMapRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setUrlMap($urlMap); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['url_map'] = $urlMap; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', UrlMap::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates a UrlMap resource in the specified project using the data included in the request. - * - * Sample code: - * ``` - * $regionUrlMapsClient = new RegionUrlMapsClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $urlMapResource = new UrlMap(); - * $operationResponse = $regionUrlMapsClient->insert($project, $region, $urlMapResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionUrlMapsClient->insert($project, $region, $urlMapResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionUrlMapsClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionUrlMapsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param UrlMap $urlMapResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * begin_interface: MixerMutationRequestBuilder Request ID to support idempotency. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 insert($project, $region, $urlMapResource, array $optionalArgs = []) - { - $request = new InsertRegionUrlMapRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setUrlMapResource($urlMapResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Retrieves the list of UrlMap resources available to the specified project in the specified region. - * - * Sample code: - * ``` - * $regionUrlMapsClient = new RegionUrlMapsClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * // Iterate over pages of elements - * $pagedResponse = $regionUrlMapsClient->list($project, $region); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $regionUrlMapsClient->list($project, $region); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $regionUrlMapsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, $region, array $optionalArgs = []) - { - $request = new ListRegionUrlMapsRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, UrlMapList::class, $request); - } - - /** - * Patches the specified UrlMap resource with the data included in the request. This method supports PATCH semantics and uses JSON merge patch format and processing rules. - * - * Sample code: - * ``` - * $regionUrlMapsClient = new RegionUrlMapsClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $urlMap = 'url_map'; - * $urlMapResource = new UrlMap(); - * $operationResponse = $regionUrlMapsClient->patch($project, $region, $urlMap, $urlMapResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionUrlMapsClient->patch($project, $region, $urlMap, $urlMapResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionUrlMapsClient->resumeOperation($operationName, 'patch'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionUrlMapsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param string $urlMap Name of the UrlMap resource to patch. - * @param UrlMap $urlMapResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * begin_interface: MixerMutationRequestBuilder Request ID to support idempotency. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 patch($project, $region, $urlMap, $urlMapResource, array $optionalArgs = []) - { - $request = new PatchRegionUrlMapRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setUrlMap($urlMap); - $request->setUrlMapResource($urlMapResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['url_map'] = $urlMap; - 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('Patch', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Updates the specified UrlMap resource with the data included in the request. - * - * Sample code: - * ``` - * $regionUrlMapsClient = new RegionUrlMapsClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $urlMap = 'url_map'; - * $urlMapResource = new UrlMap(); - * $operationResponse = $regionUrlMapsClient->update($project, $region, $urlMap, $urlMapResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $regionUrlMapsClient->update($project, $region, $urlMap, $urlMapResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $regionUrlMapsClient->resumeOperation($operationName, 'update'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $regionUrlMapsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param string $urlMap Name of the UrlMap resource to update. - * @param UrlMap $urlMapResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * begin_interface: MixerMutationRequestBuilder Request ID to support idempotency. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 update($project, $region, $urlMap, $urlMapResource, array $optionalArgs = []) - { - $request = new UpdateRegionUrlMapRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setUrlMap($urlMap); - $request->setUrlMapResource($urlMapResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['url_map'] = $urlMap; - 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('Update', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Runs static validation for the UrlMap. In particular, the tests of the provided UrlMap will be run. Calling this method does NOT create the UrlMap. - * - * Sample code: - * ``` - * $regionUrlMapsClient = new RegionUrlMapsClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $regionUrlMapsValidateRequestResource = new RegionUrlMapsValidateRequest(); - * $urlMap = 'url_map'; - * $response = $regionUrlMapsClient->validate($project, $region, $regionUrlMapsValidateRequestResource, $urlMap); - * } finally { - * $regionUrlMapsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param RegionUrlMapsValidateRequest $regionUrlMapsValidateRequestResource The body resource for this request - * @param string $urlMap Name of the UrlMap resource to be validated as. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\UrlMapsValidateResponse - * - * @throws ApiException if the remote call fails - */ - public function validate($project, $region, $regionUrlMapsValidateRequestResource, $urlMap, array $optionalArgs = []) - { - $request = new ValidateRegionUrlMapRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setRegionUrlMapsValidateRequestResource($regionUrlMapsValidateRequestResource); - $request->setUrlMap($urlMap); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['url_map'] = $urlMap; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Validate', UrlMapsValidateResponse::class, $optionalArgs, $request)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/RegionZonesGapicClient.php b/Compute/src/V1/Gapic/RegionZonesGapicClient.php deleted file mode 100644 index 7e0e17e18808..000000000000 --- a/Compute/src/V1/Gapic/RegionZonesGapicClient.php +++ /dev/null @@ -1,276 +0,0 @@ -list($project, $region); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $regionZonesClient->list($project, $region); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $regionZonesClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\RegionZonesClient}. - */ -class RegionZonesGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.RegionZones'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute.readonly', - 'https://www.googleapis.com/auth/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/region_zones_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/region_zones_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/region_zones_rest_client_config.php', - ], - ], - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * 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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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); - } - - /** - * Retrieves the list of Zone resources under the specific region available to the specified project. - * - * Sample code: - * ``` - * $regionZonesClient = new RegionZonesClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * // Iterate over pages of elements - * $pagedResponse = $regionZonesClient->list($project, $region); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $regionZonesClient->list($project, $region); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $regionZonesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Region for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, $region, array $optionalArgs = []) - { - $request = new ListRegionZonesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, ZoneList::class, $request); - } -} diff --git a/Compute/src/V1/Gapic/RegionsGapicClient.php b/Compute/src/V1/Gapic/RegionsGapicClient.php deleted file mode 100644 index e1a8cb070d32..000000000000 --- a/Compute/src/V1/Gapic/RegionsGapicClient.php +++ /dev/null @@ -1,305 +0,0 @@ -get($project, $region); - * } finally { - * $regionsClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\RegionsClient}. - */ -class RegionsGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.Regions'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute.readonly', - 'https://www.googleapis.com/auth/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/regions_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/regions_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/regions_rest_client_config.php', - ], - ], - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * 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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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); - } - - /** - * Returns the specified Region resource. To decrease latency for this method, you can optionally omit any unneeded information from the response by using a field mask. This practice is especially recommended for unused quota information (the `quotas` field). To exclude one or more fields, set your request's `fields` query parameter to only include the fields you need. For example, to only include the `id` and `selfLink` fields, add the query parameter `?fields=id,selfLink` to your request. This method fails if the quota information is unavailable for the region and if the organization policy constraint compute.requireBasicQuotaInResponse is enforced. This constraint, when enforced, disables the fail-open behaviour when quota information (the `items.quotas` field) is unavailable for the region. It is recommended to use the default setting for the constraint unless your application requires the fail-closed behaviour for this method. - * - * Sample code: - * ``` - * $regionsClient = new RegionsClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $response = $regionsClient->get($project, $region); - * } finally { - * $regionsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region resource to return. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Region - * - * @throws ApiException if the remote call fails - */ - public function get($project, $region, array $optionalArgs = []) - { - $request = new GetRegionRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', Region::class, $optionalArgs, $request)->wait(); - } - - /** - * Retrieves the list of region resources available to the specified project. To decrease latency for this method, you can optionally omit any unneeded information from the response by using a field mask. This practice is especially recommended for unused quota information (the `items.quotas` field). To exclude one or more fields, set your request's `fields` query parameter to only include the fields you need. For example, to only include the `id` and `selfLink` fields, add the query parameter `?fields=id,selfLink` to your request. This method fails if the quota information is unavailable for the region and if the organization policy constraint compute.requireBasicQuotaInResponse is enforced. This constraint, when enforced, disables the fail-open behaviour when quota information (the `items.quotas` field) is unavailable for the region. It is recommended to use the default setting for the constraint unless your application requires the fail-closed behaviour for this method. - * - * Sample code: - * ``` - * $regionsClient = new RegionsClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $regionsClient->list($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $regionsClient->list($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $regionsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, array $optionalArgs = []) - { - $request = new ListRegionsRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, RegionList::class, $request); - } -} diff --git a/Compute/src/V1/Gapic/ReservationBlocksGapicClient.php b/Compute/src/V1/Gapic/ReservationBlocksGapicClient.php deleted file mode 100644 index cfddaec0c1fb..000000000000 --- a/Compute/src/V1/Gapic/ReservationBlocksGapicClient.php +++ /dev/null @@ -1,472 +0,0 @@ -get($project, $reservation, $reservationBlock, $zone); - * } finally { - * $reservationBlocksClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\ReservationBlocksClient}. - */ -class ReservationBlocksGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.ReservationBlocks'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/reservation_blocks_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/reservation_blocks_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/reservation_blocks_rest_client_config.php', - ], - ], - 'operationsClientClass' => ZoneOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an ZoneOperationsClient object with the same endpoint as $this. - * - * @return ZoneOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getZone', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetZoneOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteZoneOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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); - } - - /** - * Retrieves information about the specified reservation block. - * - * Sample code: - * ``` - * $reservationBlocksClient = new ReservationBlocksClient(); - * try { - * $project = 'project'; - * $reservation = 'reservation'; - * $reservationBlock = 'reservation_block'; - * $zone = 'zone'; - * $response = $reservationBlocksClient->get($project, $reservation, $reservationBlock, $zone); - * } finally { - * $reservationBlocksClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $reservation The name of the reservation. Name should conform to RFC1035 or be a resource ID. - * @param string $reservationBlock The name of the reservation block. Name should conform to RFC1035 or be a resource ID. - * @param string $zone Name of the zone for this request. Zone name should conform to RFC1035. - * @param array $optionalArgs { - * Optional. - * - * @type string $view - * View of the Block. - * Check the View enum for the list of possible values. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\ReservationBlocksGetResponse - * - * @throws ApiException if the remote call fails - */ - public function get($project, $reservation, $reservationBlock, $zone, array $optionalArgs = []) - { - $request = new GetReservationBlockRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setReservation($reservation); - $request->setReservationBlock($reservationBlock); - $request->setZone($zone); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['reservation'] = $reservation; - $requestParamHeaders['reservation_block'] = $reservationBlock; - $requestParamHeaders['zone'] = $zone; - if (isset($optionalArgs['view'])) { - $request->setView($optionalArgs['view']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', ReservationBlocksGetResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Retrieves a list of reservation blocks under a single reservation. - * - * Sample code: - * ``` - * $reservationBlocksClient = new ReservationBlocksClient(); - * try { - * $project = 'project'; - * $reservation = 'reservation'; - * $zone = 'zone'; - * // Iterate over pages of elements - * $pagedResponse = $reservationBlocksClient->list($project, $reservation, $zone); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $reservationBlocksClient->list($project, $reservation, $zone); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $reservationBlocksClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $reservation The name of the reservation. Name should conform to RFC1035 or be a resource ID. - * @param string $zone Name of the zone for this request. Zone name should conform to RFC1035. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, $reservation, $zone, array $optionalArgs = []) - { - $request = new ListReservationBlocksRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setReservation($reservation); - $request->setZone($zone); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['reservation'] = $reservation; - $requestParamHeaders['zone'] = $zone; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, ReservationBlocksListResponse::class, $request); - } - - /** - * Allows customers to perform maintenance on a reservation block - * - * Sample code: - * ``` - * $reservationBlocksClient = new ReservationBlocksClient(); - * try { - * $project = 'project'; - * $reservation = 'reservation'; - * $reservationBlock = 'reservation_block'; - * $reservationsBlocksPerformMaintenanceRequestResource = new ReservationsBlocksPerformMaintenanceRequest(); - * $zone = 'zone'; - * $operationResponse = $reservationBlocksClient->performMaintenance($project, $reservation, $reservationBlock, $reservationsBlocksPerformMaintenanceRequestResource, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $reservationBlocksClient->performMaintenance($project, $reservation, $reservationBlock, $reservationsBlocksPerformMaintenanceRequestResource, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $reservationBlocksClient->resumeOperation($operationName, 'performMaintenance'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $reservationBlocksClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $reservation The name of the reservation. Name should conform to RFC1035 or be a resource ID. - * @param string $reservationBlock The name of the reservation block. Name should conform to RFC1035 or be a resource ID. - * @param ReservationsBlocksPerformMaintenanceRequest $reservationsBlocksPerformMaintenanceRequestResource The body resource for this request - * @param string $zone Name of the zone for this request. Zone name should conform to RFC1035. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 performMaintenance($project, $reservation, $reservationBlock, $reservationsBlocksPerformMaintenanceRequestResource, $zone, array $optionalArgs = []) - { - $request = new PerformMaintenanceReservationBlockRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setReservation($reservation); - $request->setReservationBlock($reservationBlock); - $request->setReservationsBlocksPerformMaintenanceRequestResource($reservationsBlocksPerformMaintenanceRequestResource); - $request->setZone($zone); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['reservation'] = $reservation; - $requestParamHeaders['reservation_block'] = $reservationBlock; - $requestParamHeaders['zone'] = $zone; - 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('PerformMaintenance', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/ReservationSubBlocksGapicClient.php b/Compute/src/V1/Gapic/ReservationSubBlocksGapicClient.php deleted file mode 100644 index 2fa756a1e980..000000000000 --- a/Compute/src/V1/Gapic/ReservationSubBlocksGapicClient.php +++ /dev/null @@ -1,461 +0,0 @@ -get($parentName, $project, $reservationSubBlock, $zone); - * } finally { - * $reservationSubBlocksClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\ReservationSubBlocksClient}. - */ -class ReservationSubBlocksGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.ReservationSubBlocks'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/reservation_sub_blocks_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/reservation_sub_blocks_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/reservation_sub_blocks_rest_client_config.php', - ], - ], - 'operationsClientClass' => ZoneOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an ZoneOperationsClient object with the same endpoint as $this. - * - * @return ZoneOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getZone', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetZoneOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteZoneOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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); - } - - /** - * Retrieves information about the specified reservation subBlock. - * - * Sample code: - * ``` - * $reservationSubBlocksClient = new ReservationSubBlocksClient(); - * try { - * $parentName = 'parent_name'; - * $project = 'project'; - * $reservationSubBlock = 'reservation_sub_block'; - * $zone = 'zone'; - * $response = $reservationSubBlocksClient->get($parentName, $project, $reservationSubBlock, $zone); - * } finally { - * $reservationSubBlocksClient->close(); - * } - * ``` - * - * @param string $parentName The name of the parent reservation and parent block. In the format of reservations/{reservation_name}/reservationBlocks/{reservation_block_name} - * @param string $project Project ID for this request. - * @param string $reservationSubBlock The name of the reservation subBlock. Name should conform to RFC1035 or be a resource ID. - * @param string $zone Name of the zone for this request. Zone name should conform to RFC1035. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\ReservationSubBlocksGetResponse - * - * @throws ApiException if the remote call fails - */ - public function get($parentName, $project, $reservationSubBlock, $zone, array $optionalArgs = []) - { - $request = new GetReservationSubBlockRequest(); - $requestParamHeaders = []; - $request->setParentName($parentName); - $request->setProject($project); - $request->setReservationSubBlock($reservationSubBlock); - $request->setZone($zone); - $requestParamHeaders['parent_name'] = $parentName; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['reservation_sub_block'] = $reservationSubBlock; - $requestParamHeaders['zone'] = $zone; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', ReservationSubBlocksGetResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Retrieves a list of reservation subBlocks under a single reservation. - * - * Sample code: - * ``` - * $reservationSubBlocksClient = new ReservationSubBlocksClient(); - * try { - * $parentName = 'parent_name'; - * $project = 'project'; - * $zone = 'zone'; - * // Iterate over pages of elements - * $pagedResponse = $reservationSubBlocksClient->list($parentName, $project, $zone); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $reservationSubBlocksClient->list($parentName, $project, $zone); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $reservationSubBlocksClient->close(); - * } - * ``` - * - * @param string $parentName The name of the parent reservation and parent block. In the format of reservations/{reservation_name}/reservationBlocks/{reservation_block_name} - * @param string $project Project ID for this request. - * @param string $zone Name of the zone for this request. Zone name should conform to RFC1035. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($parentName, $project, $zone, array $optionalArgs = []) - { - $request = new ListReservationSubBlocksRequest(); - $requestParamHeaders = []; - $request->setParentName($parentName); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['parent_name'] = $parentName; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, ReservationSubBlocksListResponse::class, $request); - } - - /** - * Allows customers to perform maintenance on a reservation subBlock - * - * Sample code: - * ``` - * $reservationSubBlocksClient = new ReservationSubBlocksClient(); - * try { - * $parentName = 'parent_name'; - * $project = 'project'; - * $reservationSubBlock = 'reservation_sub_block'; - * $zone = 'zone'; - * $operationResponse = $reservationSubBlocksClient->performMaintenance($parentName, $project, $reservationSubBlock, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $reservationSubBlocksClient->performMaintenance($parentName, $project, $reservationSubBlock, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $reservationSubBlocksClient->resumeOperation($operationName, 'performMaintenance'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $reservationSubBlocksClient->close(); - * } - * ``` - * - * @param string $parentName The name of the parent reservation and parent block. In the format of reservations/{reservation_name}/reservationBlocks/{reservation_block_name} - * @param string $project Project ID for this request. - * @param string $reservationSubBlock The name of the reservation subBlock. Name should conform to RFC1035 or be a resource ID. - * @param string $zone Name of the zone for this request. Zone name should conform to RFC1035. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 performMaintenance($parentName, $project, $reservationSubBlock, $zone, array $optionalArgs = []) - { - $request = new PerformMaintenanceReservationSubBlockRequest(); - $requestParamHeaders = []; - $request->setParentName($parentName); - $request->setProject($project); - $request->setReservationSubBlock($reservationSubBlock); - $request->setZone($zone); - $requestParamHeaders['parent_name'] = $parentName; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['reservation_sub_block'] = $reservationSubBlock; - $requestParamHeaders['zone'] = $zone; - 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('PerformMaintenance', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/ReservationsGapicClient.php b/Compute/src/V1/Gapic/ReservationsGapicClient.php deleted file mode 100644 index 3ac58dd226d5..000000000000 --- a/Compute/src/V1/Gapic/ReservationsGapicClient.php +++ /dev/null @@ -1,1045 +0,0 @@ -aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $reservationsClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $reservationsClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\ReservationsClient}. - */ -class ReservationsGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.Reservations'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/reservations_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/reservations_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/reservations_rest_client_config.php', - ], - ], - 'operationsClientClass' => ZoneOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an ZoneOperationsClient object with the same endpoint as $this. - * - * @return ZoneOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getZone', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetZoneOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteZoneOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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); - } - - /** - * Retrieves an aggregated list of reservations. To prevent failure, Google recommends that you set the `returnPartialSuccess` parameter to `true`. - * - * Sample code: - * ``` - * $reservationsClient = new ReservationsClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $reservationsClient->aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $reservationsClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $reservationsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type bool $includeAllScopes - * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type int $serviceProjectNumber - * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable 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 aggregatedList($project, array $optionalArgs = []) - { - $request = new AggregatedListReservationsRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['includeAllScopes'])) { - $request->setIncludeAllScopes($optionalArgs['includeAllScopes']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - if (isset($optionalArgs['serviceProjectNumber'])) { - $request->setServiceProjectNumber($optionalArgs['serviceProjectNumber']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('AggregatedList', $optionalArgs, ReservationAggregatedList::class, $request); - } - - /** - * Deletes the specified reservation. - * - * Sample code: - * ``` - * $reservationsClient = new ReservationsClient(); - * try { - * $project = 'project'; - * $reservation = 'reservation'; - * $zone = 'zone'; - * $operationResponse = $reservationsClient->delete($project, $reservation, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $reservationsClient->delete($project, $reservation, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $reservationsClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $reservationsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $reservation Name of the reservation to delete. - * @param string $zone Name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($project, $reservation, $zone, array $optionalArgs = []) - { - $request = new DeleteReservationRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setReservation($reservation); - $request->setZone($zone); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['reservation'] = $reservation; - $requestParamHeaders['zone'] = $zone; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Retrieves information about the specified reservation. - * - * Sample code: - * ``` - * $reservationsClient = new ReservationsClient(); - * try { - * $project = 'project'; - * $reservation = 'reservation'; - * $zone = 'zone'; - * $response = $reservationsClient->get($project, $reservation, $zone); - * } finally { - * $reservationsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $reservation Name of the reservation to retrieve. - * @param string $zone Name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Reservation - * - * @throws ApiException if the remote call fails - */ - public function get($project, $reservation, $zone, array $optionalArgs = []) - { - $request = new GetReservationRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setReservation($reservation); - $request->setZone($zone); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['reservation'] = $reservation; - $requestParamHeaders['zone'] = $zone; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', Reservation::class, $optionalArgs, $request)->wait(); - } - - /** - * Gets the access control policy for a resource. May be empty if no such policy or resource exists. - * - * Sample code: - * ``` - * $reservationsClient = new ReservationsClient(); - * try { - * $project = 'project'; - * $resource = 'resource'; - * $zone = 'zone'; - * $response = $reservationsClient->getIamPolicy($project, $resource, $zone); - * } finally { - * $reservationsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $resource Name or id of the resource for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type int $optionsRequestedPolicyVersion - * Requested IAM Policy version. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function getIamPolicy($project, $resource, $zone, array $optionalArgs = []) - { - $request = new GetIamPolicyReservationRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setResource($resource); - $request->setZone($zone); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['resource'] = $resource; - $requestParamHeaders['zone'] = $zone; - if (isset($optionalArgs['optionsRequestedPolicyVersion'])) { - $request->setOptionsRequestedPolicyVersion($optionalArgs['optionsRequestedPolicyVersion']); - } - - $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(); - } - - /** - * Creates a new reservation. For more information, read Reserving zonal resources. - * - * Sample code: - * ``` - * $reservationsClient = new ReservationsClient(); - * try { - * $project = 'project'; - * $reservationResource = new Reservation(); - * $zone = 'zone'; - * $operationResponse = $reservationsClient->insert($project, $reservationResource, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $reservationsClient->insert($project, $reservationResource, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $reservationsClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $reservationsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param Reservation $reservationResource The body resource for this request - * @param string $zone Name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 insert($project, $reservationResource, $zone, array $optionalArgs = []) - { - $request = new InsertReservationRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setReservationResource($reservationResource); - $request->setZone($zone); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * A list of all the reservations that have been configured for the specified project in specified zone. - * - * Sample code: - * ``` - * $reservationsClient = new ReservationsClient(); - * try { - * $project = 'project'; - * $zone = 'zone'; - * // Iterate over pages of elements - * $pagedResponse = $reservationsClient->list($project, $zone); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $reservationsClient->list($project, $zone); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $reservationsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $zone Name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, $zone, array $optionalArgs = []) - { - $request = new ListReservationsRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, ReservationList::class, $request); - } - - /** - * Perform maintenance on an extended reservation - * - * Sample code: - * ``` - * $reservationsClient = new ReservationsClient(); - * try { - * $project = 'project'; - * $reservation = 'reservation'; - * $reservationsPerformMaintenanceRequestResource = new ReservationsPerformMaintenanceRequest(); - * $zone = 'zone'; - * $operationResponse = $reservationsClient->performMaintenance($project, $reservation, $reservationsPerformMaintenanceRequestResource, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $reservationsClient->performMaintenance($project, $reservation, $reservationsPerformMaintenanceRequestResource, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $reservationsClient->resumeOperation($operationName, 'performMaintenance'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $reservationsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $reservation The name of the reservation. Name should conform to RFC1035 or be a resource ID. - * @param ReservationsPerformMaintenanceRequest $reservationsPerformMaintenanceRequestResource The body resource for this request - * @param string $zone Name of the zone for this request. Zone name should conform to RFC1035. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 performMaintenance($project, $reservation, $reservationsPerformMaintenanceRequestResource, $zone, array $optionalArgs = []) - { - $request = new PerformMaintenanceReservationRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setReservation($reservation); - $request->setReservationsPerformMaintenanceRequestResource($reservationsPerformMaintenanceRequestResource); - $request->setZone($zone); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['reservation'] = $reservation; - $requestParamHeaders['zone'] = $zone; - 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('PerformMaintenance', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Resizes the reservation (applicable to standalone reservations only). For more information, read Modifying reservations. - * - * Sample code: - * ``` - * $reservationsClient = new ReservationsClient(); - * try { - * $project = 'project'; - * $reservation = 'reservation'; - * $reservationsResizeRequestResource = new ReservationsResizeRequest(); - * $zone = 'zone'; - * $operationResponse = $reservationsClient->resize($project, $reservation, $reservationsResizeRequestResource, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $reservationsClient->resize($project, $reservation, $reservationsResizeRequestResource, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $reservationsClient->resumeOperation($operationName, 'resize'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $reservationsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $reservation Name of the reservation to update. - * @param ReservationsResizeRequest $reservationsResizeRequestResource The body resource for this request - * @param string $zone Name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 resize($project, $reservation, $reservationsResizeRequestResource, $zone, array $optionalArgs = []) - { - $request = new ResizeReservationRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setReservation($reservation); - $request->setReservationsResizeRequestResource($reservationsResizeRequestResource); - $request->setZone($zone); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['reservation'] = $reservation; - $requestParamHeaders['zone'] = $zone; - 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('Resize', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Sets the access control policy on the specified resource. Replaces any existing policy. - * - * Sample code: - * ``` - * $reservationsClient = new ReservationsClient(); - * try { - * $project = 'project'; - * $resource = 'resource'; - * $zone = 'zone'; - * $zoneSetPolicyRequestResource = new ZoneSetPolicyRequest(); - * $response = $reservationsClient->setIamPolicy($project, $resource, $zone, $zoneSetPolicyRequestResource); - * } finally { - * $reservationsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $resource Name or id of the resource for this request. - * @param string $zone The name of the zone for this request. - * @param ZoneSetPolicyRequest $zoneSetPolicyRequestResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function setIamPolicy($project, $resource, $zone, $zoneSetPolicyRequestResource, array $optionalArgs = []) - { - $request = new SetIamPolicyReservationRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setResource($resource); - $request->setZone($zone); - $request->setZoneSetPolicyRequestResource($zoneSetPolicyRequestResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['resource'] = $resource; - $requestParamHeaders['zone'] = $zone; - $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 resource. - * - * Sample code: - * ``` - * $reservationsClient = new ReservationsClient(); - * try { - * $project = 'project'; - * $resource = 'resource'; - * $testPermissionsRequestResource = new TestPermissionsRequest(); - * $zone = 'zone'; - * $response = $reservationsClient->testIamPermissions($project, $resource, $testPermissionsRequestResource, $zone); - * } finally { - * $reservationsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $resource Name or id of the resource for this request. - * @param TestPermissionsRequest $testPermissionsRequestResource The body resource for this request - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\TestPermissionsResponse - * - * @throws ApiException if the remote call fails - */ - public function testIamPermissions($project, $resource, $testPermissionsRequestResource, $zone, array $optionalArgs = []) - { - $request = new TestIamPermissionsReservationRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setResource($resource); - $request->setTestPermissionsRequestResource($testPermissionsRequestResource); - $request->setZone($zone); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['resource'] = $resource; - $requestParamHeaders['zone'] = $zone; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('TestIamPermissions', TestPermissionsResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Update share settings of the reservation. - * - * Sample code: - * ``` - * $reservationsClient = new ReservationsClient(); - * try { - * $project = 'project'; - * $reservation = 'reservation'; - * $reservationResource = new Reservation(); - * $zone = 'zone'; - * $operationResponse = $reservationsClient->update($project, $reservation, $reservationResource, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $reservationsClient->update($project, $reservation, $reservationResource, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $reservationsClient->resumeOperation($operationName, 'update'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $reservationsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $reservation Name of the reservation to update. - * @param Reservation $reservationResource The body resource for this request - * @param string $zone Name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $paths - * @type string $requestId - * 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. 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 $updateMask - * Update_mask indicates fields to be updated as part of this request. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 update($project, $reservation, $reservationResource, $zone, array $optionalArgs = []) - { - $request = new UpdateReservationRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setReservation($reservation); - $request->setReservationResource($reservationResource); - $request->setZone($zone); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['reservation'] = $reservation; - $requestParamHeaders['zone'] = $zone; - if (isset($optionalArgs['paths'])) { - $request->setPaths($optionalArgs['paths']); - } - - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('Update', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/ResourcePoliciesGapicClient.php b/Compute/src/V1/Gapic/ResourcePoliciesGapicClient.php deleted file mode 100644 index 8071da9b826a..000000000000 --- a/Compute/src/V1/Gapic/ResourcePoliciesGapicClient.php +++ /dev/null @@ -1,878 +0,0 @@ -aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $resourcePoliciesClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $resourcePoliciesClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\ResourcePoliciesClient}. - */ -class ResourcePoliciesGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.ResourcePolicies'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/resource_policies_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/resource_policies_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/resource_policies_rest_client_config.php', - ], - ], - 'operationsClientClass' => RegionOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an RegionOperationsClient object with the same endpoint as $this. - * - * @return RegionOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetRegionOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteRegionOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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); - } - - /** - * Retrieves an aggregated list of resource policies. To prevent failure, Google recommends that you set the `returnPartialSuccess` parameter to `true`. - * - * Sample code: - * ``` - * $resourcePoliciesClient = new ResourcePoliciesClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $resourcePoliciesClient->aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $resourcePoliciesClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $resourcePoliciesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type bool $includeAllScopes - * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type int $serviceProjectNumber - * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable 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 aggregatedList($project, array $optionalArgs = []) - { - $request = new AggregatedListResourcePoliciesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['includeAllScopes'])) { - $request->setIncludeAllScopes($optionalArgs['includeAllScopes']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - if (isset($optionalArgs['serviceProjectNumber'])) { - $request->setServiceProjectNumber($optionalArgs['serviceProjectNumber']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('AggregatedList', $optionalArgs, ResourcePolicyAggregatedList::class, $request); - } - - /** - * Deletes the specified resource policy. - * - * Sample code: - * ``` - * $resourcePoliciesClient = new ResourcePoliciesClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $resourcePolicy = 'resource_policy'; - * $operationResponse = $resourcePoliciesClient->delete($project, $region, $resourcePolicy); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $resourcePoliciesClient->delete($project, $region, $resourcePolicy); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $resourcePoliciesClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $resourcePoliciesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region for this request. - * @param string $resourcePolicy Name of the resource policy to delete. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($project, $region, $resourcePolicy, array $optionalArgs = []) - { - $request = new DeleteResourcePolicyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setResourcePolicy($resourcePolicy); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['resource_policy'] = $resourcePolicy; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Retrieves all information of the specified resource policy. - * - * Sample code: - * ``` - * $resourcePoliciesClient = new ResourcePoliciesClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $resourcePolicy = 'resource_policy'; - * $response = $resourcePoliciesClient->get($project, $region, $resourcePolicy); - * } finally { - * $resourcePoliciesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region for this request. - * @param string $resourcePolicy Name of the resource policy to retrieve. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\ResourcePolicy - * - * @throws ApiException if the remote call fails - */ - public function get($project, $region, $resourcePolicy, array $optionalArgs = []) - { - $request = new GetResourcePolicyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setResourcePolicy($resourcePolicy); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['resource_policy'] = $resourcePolicy; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', ResourcePolicy::class, $optionalArgs, $request)->wait(); - } - - /** - * Gets the access control policy for a resource. May be empty if no such policy or resource exists. - * - * Sample code: - * ``` - * $resourcePoliciesClient = new ResourcePoliciesClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $resource = 'resource'; - * $response = $resourcePoliciesClient->getIamPolicy($project, $region, $resource); - * } finally { - * $resourcePoliciesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region The name of the region for this request. - * @param string $resource Name or id of the resource for this request. - * @param array $optionalArgs { - * Optional. - * - * @type int $optionsRequestedPolicyVersion - * Requested IAM Policy version. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function getIamPolicy($project, $region, $resource, array $optionalArgs = []) - { - $request = new GetIamPolicyResourcePolicyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setResource($resource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['optionsRequestedPolicyVersion'])) { - $request->setOptionsRequestedPolicyVersion($optionalArgs['optionsRequestedPolicyVersion']); - } - - $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(); - } - - /** - * Creates a new resource policy. - * - * Sample code: - * ``` - * $resourcePoliciesClient = new ResourcePoliciesClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $resourcePolicyResource = new ResourcePolicy(); - * $operationResponse = $resourcePoliciesClient->insert($project, $region, $resourcePolicyResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $resourcePoliciesClient->insert($project, $region, $resourcePolicyResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $resourcePoliciesClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $resourcePoliciesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region for this request. - * @param ResourcePolicy $resourcePolicyResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 insert($project, $region, $resourcePolicyResource, array $optionalArgs = []) - { - $request = new InsertResourcePolicyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setResourcePolicyResource($resourcePolicyResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * A list all the resource policies that have been configured for the specified project in specified region. - * - * Sample code: - * ``` - * $resourcePoliciesClient = new ResourcePoliciesClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * // Iterate over pages of elements - * $pagedResponse = $resourcePoliciesClient->list($project, $region); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $resourcePoliciesClient->list($project, $region); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $resourcePoliciesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, $region, array $optionalArgs = []) - { - $request = new ListResourcePoliciesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, ResourcePolicyList::class, $request); - } - - /** - * Modify the specified resource policy. - * - * Sample code: - * ``` - * $resourcePoliciesClient = new ResourcePoliciesClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $resourcePolicy = 'resource_policy'; - * $resourcePolicyResource = new ResourcePolicy(); - * $operationResponse = $resourcePoliciesClient->patch($project, $region, $resourcePolicy, $resourcePolicyResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $resourcePoliciesClient->patch($project, $region, $resourcePolicy, $resourcePolicyResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $resourcePoliciesClient->resumeOperation($operationName, 'patch'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $resourcePoliciesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region for this request. - * @param string $resourcePolicy Id of the resource policy to patch. - * @param ResourcePolicy $resourcePolicyResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 $updateMask - * update_mask indicates fields to be updated as part of this request. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 patch($project, $region, $resourcePolicy, $resourcePolicyResource, array $optionalArgs = []) - { - $request = new PatchResourcePolicyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setResourcePolicy($resourcePolicy); - $request->setResourcePolicyResource($resourcePolicyResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['resource_policy'] = $resourcePolicy; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('Patch', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Sets the access control policy on the specified resource. Replaces any existing policy. - * - * Sample code: - * ``` - * $resourcePoliciesClient = new ResourcePoliciesClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $regionSetPolicyRequestResource = new RegionSetPolicyRequest(); - * $resource = 'resource'; - * $response = $resourcePoliciesClient->setIamPolicy($project, $region, $regionSetPolicyRequestResource, $resource); - * } finally { - * $resourcePoliciesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region The name of the region for this request. - * @param RegionSetPolicyRequest $regionSetPolicyRequestResource The body resource for this request - * @param string $resource Name or id of the resource for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function setIamPolicy($project, $region, $regionSetPolicyRequestResource, $resource, array $optionalArgs = []) - { - $request = new SetIamPolicyResourcePolicyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setRegionSetPolicyRequestResource($regionSetPolicyRequestResource); - $request->setResource($resource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['resource'] = $resource; - $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 resource. - * - * Sample code: - * ``` - * $resourcePoliciesClient = new ResourcePoliciesClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $resource = 'resource'; - * $testPermissionsRequestResource = new TestPermissionsRequest(); - * $response = $resourcePoliciesClient->testIamPermissions($project, $region, $resource, $testPermissionsRequestResource); - * } finally { - * $resourcePoliciesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region The name of the region for this request. - * @param string $resource Name or id of the resource for this request. - * @param TestPermissionsRequest $testPermissionsRequestResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\TestPermissionsResponse - * - * @throws ApiException if the remote call fails - */ - public function testIamPermissions($project, $region, $resource, $testPermissionsRequestResource, array $optionalArgs = []) - { - $request = new TestIamPermissionsResourcePolicyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setResource($resource); - $request->setTestPermissionsRequestResource($testPermissionsRequestResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['resource'] = $resource; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('TestIamPermissions', TestPermissionsResponse::class, $optionalArgs, $request)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/RoutersGapicClient.php b/Compute/src/V1/Gapic/RoutersGapicClient.php deleted file mode 100644 index 38c6f722bea6..000000000000 --- a/Compute/src/V1/Gapic/RoutersGapicClient.php +++ /dev/null @@ -1,1537 +0,0 @@ -aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $routersClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $routersClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\RoutersClient}. - */ -class RoutersGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.Routers'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/routers_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/routers_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/routers_rest_client_config.php', - ], - ], - 'operationsClientClass' => RegionOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an RegionOperationsClient object with the same endpoint as $this. - * - * @return RegionOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetRegionOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteRegionOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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); - } - - /** - * Retrieves an aggregated list of routers. To prevent failure, Google recommends that you set the `returnPartialSuccess` parameter to `true`. - * - * Sample code: - * ``` - * $routersClient = new RoutersClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $routersClient->aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $routersClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $routersClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type bool $includeAllScopes - * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type int $serviceProjectNumber - * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable 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 aggregatedList($project, array $optionalArgs = []) - { - $request = new AggregatedListRoutersRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['includeAllScopes'])) { - $request->setIncludeAllScopes($optionalArgs['includeAllScopes']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - if (isset($optionalArgs['serviceProjectNumber'])) { - $request->setServiceProjectNumber($optionalArgs['serviceProjectNumber']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('AggregatedList', $optionalArgs, RouterAggregatedList::class, $request); - } - - /** - * Deletes the specified Router resource. - * - * Sample code: - * ``` - * $routersClient = new RoutersClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $router = 'router'; - * $operationResponse = $routersClient->delete($project, $region, $router); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $routersClient->delete($project, $region, $router); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $routersClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $routersClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region for this request. - * @param string $router Name of the Router resource to delete. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($project, $region, $router, array $optionalArgs = []) - { - $request = new DeleteRouterRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setRouter($router); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['router'] = $router; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Deletes Route Policy - * - * Sample code: - * ``` - * $routersClient = new RoutersClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $router = 'router'; - * $operationResponse = $routersClient->deleteRoutePolicy($project, $region, $router); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $routersClient->deleteRoutePolicy($project, $region, $router); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $routersClient->resumeOperation($operationName, 'deleteRoutePolicy'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $routersClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region for this request. - * @param string $router Name of the Router resource where Route Policy is defined. - * @param array $optionalArgs { - * Optional. - * - * @type string $policy - * The Policy name for this request. Name must conform to RFC1035 - * @type string $requestId - * 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. 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 deleteRoutePolicy($project, $region, $router, array $optionalArgs = []) - { - $request = new DeleteRoutePolicyRouterRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setRouter($router); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['router'] = $router; - if (isset($optionalArgs['policy'])) { - $request->setPolicy($optionalArgs['policy']); - } - - 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('DeleteRoutePolicy', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns the specified Router resource. - * - * Sample code: - * ``` - * $routersClient = new RoutersClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $router = 'router'; - * $response = $routersClient->get($project, $region, $router); - * } finally { - * $routersClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region for this request. - * @param string $router Name of the Router resource to return. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Router - * - * @throws ApiException if the remote call fails - */ - public function get($project, $region, $router, array $optionalArgs = []) - { - $request = new GetRouterRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setRouter($router); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['router'] = $router; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', Router::class, $optionalArgs, $request)->wait(); - } - - /** - * Retrieves runtime NAT IP information. - * - * Sample code: - * ``` - * $routersClient = new RoutersClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $router = 'router'; - * $response = $routersClient->getNatIpInfo($project, $region, $router); - * } finally { - * $routersClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region for this request. - * @param string $router Name of the Router resource to query for Nat IP information. The name should conform to RFC1035. - * @param array $optionalArgs { - * Optional. - * - * @type string $natName - * Name of the nat service to filter the NAT IP information. If it is omitted, all nats for this router will be returned. Name should conform to RFC1035. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\NatIpInfoResponse - * - * @throws ApiException if the remote call fails - */ - public function getNatIpInfo($project, $region, $router, array $optionalArgs = []) - { - $request = new GetNatIpInfoRouterRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setRouter($router); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['router'] = $router; - if (isset($optionalArgs['natName'])) { - $request->setNatName($optionalArgs['natName']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetNatIpInfo', NatIpInfoResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Retrieves runtime Nat mapping information of VM endpoints. - * - * Sample code: - * ``` - * $routersClient = new RoutersClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $router = 'router'; - * // Iterate over pages of elements - * $pagedResponse = $routersClient->getNatMappingInfo($project, $region, $router); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $routersClient->getNatMappingInfo($project, $region, $router); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $routersClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region for this request. - * @param string $router Name of the Router resource to query for Nat Mapping information of VM endpoints. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $natName - * Name of the nat service to filter the Nat Mapping information. If it is omitted, all nats for this router will be returned. Name should conform to RFC1035. - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 getNatMappingInfo($project, $region, $router, array $optionalArgs = []) - { - $request = new GetNatMappingInfoRoutersRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setRouter($router); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['router'] = $router; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['natName'])) { - $request->setNatName($optionalArgs['natName']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('GetNatMappingInfo', $optionalArgs, VmEndpointNatMappingsList::class, $request); - } - - /** - * Returns specified Route Policy - * - * Sample code: - * ``` - * $routersClient = new RoutersClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $router = 'router'; - * $response = $routersClient->getRoutePolicy($project, $region, $router); - * } finally { - * $routersClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region for this request. - * @param string $router Name of the Router resource to query for the route policy. The name should conform to RFC1035. - * @param array $optionalArgs { - * Optional. - * - * @type string $policy - * The Policy name for this request. Name must conform to RFC1035 - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\RoutersGetRoutePolicyResponse - * - * @throws ApiException if the remote call fails - */ - public function getRoutePolicy($project, $region, $router, array $optionalArgs = []) - { - $request = new GetRoutePolicyRouterRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setRouter($router); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['router'] = $router; - if (isset($optionalArgs['policy'])) { - $request->setPolicy($optionalArgs['policy']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetRoutePolicy', RoutersGetRoutePolicyResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Retrieves runtime information of the specified router. - * - * Sample code: - * ``` - * $routersClient = new RoutersClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $router = 'router'; - * $response = $routersClient->getRouterStatus($project, $region, $router); - * } finally { - * $routersClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region for this request. - * @param string $router Name of the Router resource to query. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\RouterStatusResponse - * - * @throws ApiException if the remote call fails - */ - public function getRouterStatus($project, $region, $router, array $optionalArgs = []) - { - $request = new GetRouterStatusRouterRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setRouter($router); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['router'] = $router; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetRouterStatus', RouterStatusResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates a Router resource in the specified project and region using the data included in the request. - * - * Sample code: - * ``` - * $routersClient = new RoutersClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $routerResource = new Router(); - * $operationResponse = $routersClient->insert($project, $region, $routerResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $routersClient->insert($project, $region, $routerResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $routersClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $routersClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region for this request. - * @param Router $routerResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 insert($project, $region, $routerResource, array $optionalArgs = []) - { - $request = new InsertRouterRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setRouterResource($routerResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Retrieves a list of Router resources available to the specified project. - * - * Sample code: - * ``` - * $routersClient = new RoutersClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * // Iterate over pages of elements - * $pagedResponse = $routersClient->list($project, $region); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $routersClient->list($project, $region); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $routersClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, $region, array $optionalArgs = []) - { - $request = new ListRoutersRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, RouterList::class, $request); - } - - /** - * Retrieves a list of router bgp routes available to the specified project. - * - * Sample code: - * ``` - * $routersClient = new RoutersClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $router = 'router'; - * $response = $routersClient->listBgpRoutes($project, $region, $router); - * } finally { - * $routersClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region for this request. - * @param string $router Name or id of the resource for this request. Name should conform to RFC1035. - * @param array $optionalArgs { - * Optional. - * - * @type string $addressFamily - * (Required) limit results to this address family (either IPv4 or IPv6) - * Check the AddressFamily enum for the list of possible values. - * @type string $destinationPrefix - * Limit results to destinations that are subnets of this CIDR range - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @type string $pageToken - * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. - * @type string $peer - * (Required) limit results to the BGP peer with the given name. Name should conform to RFC1035. - * @type bool $policyApplied - * When true, the method returns post-policy routes. Otherwise, it returns pre-policy routes. - * @type bool $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type string $routeType - * (Required) limit results to this type of route (either LEARNED or ADVERTISED) - * Check the RouteType enum for the list of possible values. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\RoutersListBgpRoutes - * - * @throws ApiException if the remote call fails - */ - public function listBgpRoutes($project, $region, $router, array $optionalArgs = []) - { - $request = new ListBgpRoutesRoutersRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setRouter($router); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['router'] = $router; - if (isset($optionalArgs['addressFamily'])) { - $request->setAddressFamily($optionalArgs['addressFamily']); - } - - if (isset($optionalArgs['destinationPrefix'])) { - $request->setDestinationPrefix($optionalArgs['destinationPrefix']); - } - - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['peer'])) { - $request->setPeer($optionalArgs['peer']); - } - - if (isset($optionalArgs['policyApplied'])) { - $request->setPolicyApplied($optionalArgs['policyApplied']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - if (isset($optionalArgs['routeType'])) { - $request->setRouteType($optionalArgs['routeType']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('ListBgpRoutes', RoutersListBgpRoutes::class, $optionalArgs, $request)->wait(); - } - - /** - * Retrieves a list of router route policy subresources available to the specified project. - * - * Sample code: - * ``` - * $routersClient = new RoutersClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $router = 'router'; - * $response = $routersClient->listRoutePolicies($project, $region, $router); - * } finally { - * $routersClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region for this request. - * @param string $router Name or id of the resource for this request. Name should conform to RFC1035. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @type string $pageToken - * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. - * @type bool $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\RoutersListRoutePolicies - * - * @throws ApiException if the remote call fails - */ - public function listRoutePolicies($project, $region, $router, array $optionalArgs = []) - { - $request = new ListRoutePoliciesRoutersRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setRouter($router); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['router'] = $router; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('ListRoutePolicies', RoutersListRoutePolicies::class, $optionalArgs, $request)->wait(); - } - - /** - * Patches the specified Router resource with the data included in the request. This method supports PATCH semantics and uses JSON merge patch format and processing rules. - * - * Sample code: - * ``` - * $routersClient = new RoutersClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $router = 'router'; - * $routerResource = new Router(); - * $operationResponse = $routersClient->patch($project, $region, $router, $routerResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $routersClient->patch($project, $region, $router, $routerResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $routersClient->resumeOperation($operationName, 'patch'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $routersClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region for this request. - * @param string $router Name of the Router resource to patch. - * @param Router $routerResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 patch($project, $region, $router, $routerResource, array $optionalArgs = []) - { - $request = new PatchRouterRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setRouter($router); - $request->setRouterResource($routerResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['router'] = $router; - 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('Patch', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Patches Route Policy - * - * Sample code: - * ``` - * $routersClient = new RoutersClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $routePolicyResource = new RoutePolicy(); - * $router = 'router'; - * $operationResponse = $routersClient->patchRoutePolicy($project, $region, $routePolicyResource, $router); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $routersClient->patchRoutePolicy($project, $region, $routePolicyResource, $router); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $routersClient->resumeOperation($operationName, 'patchRoutePolicy'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $routersClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region for this request. - * @param RoutePolicy $routePolicyResource The body resource for this request - * @param string $router Name of the Router resource where Route Policy is defined. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 patchRoutePolicy($project, $region, $routePolicyResource, $router, array $optionalArgs = []) - { - $request = new PatchRoutePolicyRouterRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setRoutePolicyResource($routePolicyResource); - $request->setRouter($router); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['router'] = $router; - 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('PatchRoutePolicy', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Preview fields auto-generated during router create and update operations. Calling this method does NOT create or update the router. - * - * Sample code: - * ``` - * $routersClient = new RoutersClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $router = 'router'; - * $routerResource = new Router(); - * $response = $routersClient->preview($project, $region, $router, $routerResource); - * } finally { - * $routersClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region for this request. - * @param string $router Name of the Router resource to query. - * @param Router $routerResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\RoutersPreviewResponse - * - * @throws ApiException if the remote call fails - */ - public function preview($project, $region, $router, $routerResource, array $optionalArgs = []) - { - $request = new PreviewRouterRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setRouter($router); - $request->setRouterResource($routerResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['router'] = $router; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Preview', RoutersPreviewResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Updates the specified Router resource with the data included in the request. This method conforms to PUT semantics, which requests that the state of the target resource be created or replaced with the state defined by the representation enclosed in the request message payload. - * - * Sample code: - * ``` - * $routersClient = new RoutersClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $router = 'router'; - * $routerResource = new Router(); - * $operationResponse = $routersClient->update($project, $region, $router, $routerResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $routersClient->update($project, $region, $router, $routerResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $routersClient->resumeOperation($operationName, 'update'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $routersClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region for this request. - * @param string $router Name of the Router resource to update. - * @param Router $routerResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 update($project, $region, $router, $routerResource, array $optionalArgs = []) - { - $request = new UpdateRouterRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setRouter($router); - $request->setRouterResource($routerResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['router'] = $router; - 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('Update', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Updates or creates new Route Policy - * - * Sample code: - * ``` - * $routersClient = new RoutersClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $routePolicyResource = new RoutePolicy(); - * $router = 'router'; - * $operationResponse = $routersClient->updateRoutePolicy($project, $region, $routePolicyResource, $router); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $routersClient->updateRoutePolicy($project, $region, $routePolicyResource, $router); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $routersClient->resumeOperation($operationName, 'updateRoutePolicy'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $routersClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region for this request. - * @param RoutePolicy $routePolicyResource The body resource for this request - * @param string $router Name of the Router resource where Route Policy is defined. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 updateRoutePolicy($project, $region, $routePolicyResource, $router, array $optionalArgs = []) - { - $request = new UpdateRoutePolicyRouterRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setRoutePolicyResource($routePolicyResource); - $request->setRouter($router); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['router'] = $router; - 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('UpdateRoutePolicy', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/RoutesGapicClient.php b/Compute/src/V1/Gapic/RoutesGapicClient.php deleted file mode 100644 index 4e86bf44da83..000000000000 --- a/Compute/src/V1/Gapic/RoutesGapicClient.php +++ /dev/null @@ -1,529 +0,0 @@ -delete($project, $route); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $routesClient->delete($project, $route); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $routesClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $routesClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\RoutesClient}. - */ -class RoutesGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.Routes'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/routes_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/routes_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/routes_rest_client_config.php', - ], - ], - 'operationsClientClass' => GlobalOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an GlobalOperationsClient object with the same endpoint as $this. - * - * @return GlobalOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetGlobalOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteGlobalOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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 the specified Route resource. - * - * Sample code: - * ``` - * $routesClient = new RoutesClient(); - * try { - * $project = 'project'; - * $route = 'route'; - * $operationResponse = $routesClient->delete($project, $route); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $routesClient->delete($project, $route); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $routesClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $routesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $route Name of the Route resource to delete. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($project, $route, array $optionalArgs = []) - { - $request = new DeleteRouteRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRoute($route); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['route'] = $route; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns the specified Route resource. - * - * Sample code: - * ``` - * $routesClient = new RoutesClient(); - * try { - * $project = 'project'; - * $route = 'route'; - * $response = $routesClient->get($project, $route); - * } finally { - * $routesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $route Name of the Route resource to return. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Route - * - * @throws ApiException if the remote call fails - */ - public function get($project, $route, array $optionalArgs = []) - { - $request = new GetRouteRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRoute($route); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['route'] = $route; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', Route::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates a Route resource in the specified project using the data included in the request. - * - * Sample code: - * ``` - * $routesClient = new RoutesClient(); - * try { - * $project = 'project'; - * $routeResource = new Route(); - * $operationResponse = $routesClient->insert($project, $routeResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $routesClient->insert($project, $routeResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $routesClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $routesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param Route $routeResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 insert($project, $routeResource, array $optionalArgs = []) - { - $request = new InsertRouteRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRouteResource($routeResource); - $requestParamHeaders['project'] = $project; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Retrieves the list of Route resources available to the specified project. - * - * Sample code: - * ``` - * $routesClient = new RoutesClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $routesClient->list($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $routesClient->list($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $routesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, array $optionalArgs = []) - { - $request = new ListRoutesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, RouteList::class, $request); - } -} diff --git a/Compute/src/V1/Gapic/SecurityPoliciesGapicClient.php b/Compute/src/V1/Gapic/SecurityPoliciesGapicClient.php deleted file mode 100644 index fd747d5ff98f..000000000000 --- a/Compute/src/V1/Gapic/SecurityPoliciesGapicClient.php +++ /dev/null @@ -1,1146 +0,0 @@ -addRule($project, $securityPolicy, $securityPolicyRuleResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $securityPoliciesClient->addRule($project, $securityPolicy, $securityPolicyRuleResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $securityPoliciesClient->resumeOperation($operationName, 'addRule'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $securityPoliciesClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\SecurityPoliciesClient}. - */ -class SecurityPoliciesGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.SecurityPolicies'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/security_policies_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/security_policies_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/security_policies_rest_client_config.php', - ], - ], - 'operationsClientClass' => GlobalOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an GlobalOperationsClient object with the same endpoint as $this. - * - * @return GlobalOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetGlobalOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteGlobalOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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); - } - - /** - * Inserts a rule into a security policy. - * - * Sample code: - * ``` - * $securityPoliciesClient = new SecurityPoliciesClient(); - * try { - * $project = 'project'; - * $securityPolicy = 'security_policy'; - * $securityPolicyRuleResource = new SecurityPolicyRule(); - * $operationResponse = $securityPoliciesClient->addRule($project, $securityPolicy, $securityPolicyRuleResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $securityPoliciesClient->addRule($project, $securityPolicy, $securityPolicyRuleResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $securityPoliciesClient->resumeOperation($operationName, 'addRule'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $securityPoliciesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $securityPolicy Name of the security policy to update. - * @param SecurityPolicyRule $securityPolicyRuleResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type bool $validateOnly - * If true, the request will not be committed. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 addRule($project, $securityPolicy, $securityPolicyRuleResource, array $optionalArgs = []) - { - $request = new AddRuleSecurityPolicyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setSecurityPolicy($securityPolicy); - $request->setSecurityPolicyRuleResource($securityPolicyRuleResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['security_policy'] = $securityPolicy; - 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('AddRule', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Retrieves the list of all SecurityPolicy resources, regional and global, available to the specified project. To prevent failure, Google recommends that you set the `returnPartialSuccess` parameter to `true`. - * - * Sample code: - * ``` - * $securityPoliciesClient = new SecurityPoliciesClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $securityPoliciesClient->aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $securityPoliciesClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $securityPoliciesClient->close(); - * } - * ``` - * - * @param string $project Name of the project scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type bool $includeAllScopes - * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type int $serviceProjectNumber - * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable 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 aggregatedList($project, array $optionalArgs = []) - { - $request = new AggregatedListSecurityPoliciesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['includeAllScopes'])) { - $request->setIncludeAllScopes($optionalArgs['includeAllScopes']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - if (isset($optionalArgs['serviceProjectNumber'])) { - $request->setServiceProjectNumber($optionalArgs['serviceProjectNumber']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('AggregatedList', $optionalArgs, SecurityPoliciesAggregatedList::class, $request); - } - - /** - * Deletes the specified policy. - * - * Sample code: - * ``` - * $securityPoliciesClient = new SecurityPoliciesClient(); - * try { - * $project = 'project'; - * $securityPolicy = 'security_policy'; - * $operationResponse = $securityPoliciesClient->delete($project, $securityPolicy); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $securityPoliciesClient->delete($project, $securityPolicy); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $securityPoliciesClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $securityPoliciesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $securityPolicy Name of the security policy to delete. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($project, $securityPolicy, array $optionalArgs = []) - { - $request = new DeleteSecurityPolicyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setSecurityPolicy($securityPolicy); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['security_policy'] = $securityPolicy; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * List all of the ordered rules present in a single specified policy. - * - * Sample code: - * ``` - * $securityPoliciesClient = new SecurityPoliciesClient(); - * try { - * $project = 'project'; - * $securityPolicy = 'security_policy'; - * $response = $securityPoliciesClient->get($project, $securityPolicy); - * } finally { - * $securityPoliciesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $securityPolicy Name of the security policy to get. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\SecurityPolicy - * - * @throws ApiException if the remote call fails - */ - public function get($project, $securityPolicy, array $optionalArgs = []) - { - $request = new GetSecurityPolicyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setSecurityPolicy($securityPolicy); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['security_policy'] = $securityPolicy; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', SecurityPolicy::class, $optionalArgs, $request)->wait(); - } - - /** - * Gets a rule at the specified priority. - * - * Sample code: - * ``` - * $securityPoliciesClient = new SecurityPoliciesClient(); - * try { - * $project = 'project'; - * $securityPolicy = 'security_policy'; - * $response = $securityPoliciesClient->getRule($project, $securityPolicy); - * } finally { - * $securityPoliciesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $securityPolicy Name of the security policy to which the queried rule belongs. - * @param array $optionalArgs { - * Optional. - * - * @type int $priority - * The priority of the rule to get from the security policy. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\SecurityPolicyRule - * - * @throws ApiException if the remote call fails - */ - public function getRule($project, $securityPolicy, array $optionalArgs = []) - { - $request = new GetRuleSecurityPolicyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setSecurityPolicy($securityPolicy); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['security_policy'] = $securityPolicy; - if (isset($optionalArgs['priority'])) { - $request->setPriority($optionalArgs['priority']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetRule', SecurityPolicyRule::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates a new policy in the specified project using the data included in the request. - * - * Sample code: - * ``` - * $securityPoliciesClient = new SecurityPoliciesClient(); - * try { - * $project = 'project'; - * $securityPolicyResource = new SecurityPolicy(); - * $operationResponse = $securityPoliciesClient->insert($project, $securityPolicyResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $securityPoliciesClient->insert($project, $securityPolicyResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $securityPoliciesClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $securityPoliciesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param SecurityPolicy $securityPolicyResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 $validateOnly - * If true, the request will not be committed. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 insert($project, $securityPolicyResource, array $optionalArgs = []) - { - $request = new InsertSecurityPolicyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setSecurityPolicyResource($securityPolicyResource); - $requestParamHeaders['project'] = $project; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * List all the policies that have been configured for the specified project. - * - * Sample code: - * ``` - * $securityPoliciesClient = new SecurityPoliciesClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $securityPoliciesClient->list($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $securityPoliciesClient->list($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $securityPoliciesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, array $optionalArgs = []) - { - $request = new ListSecurityPoliciesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, SecurityPolicyList::class, $request); - } - - /** - * Gets the current list of preconfigured Web Application Firewall (WAF) expressions. - * - * Sample code: - * ``` - * $securityPoliciesClient = new SecurityPoliciesClient(); - * try { - * $project = 'project'; - * $response = $securityPoliciesClient->listPreconfiguredExpressionSets($project); - * } finally { - * $securityPoliciesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @type string $pageToken - * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. - * @type bool $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\SecurityPoliciesListPreconfiguredExpressionSetsResponse - * - * @throws ApiException if the remote call fails - */ - public function listPreconfiguredExpressionSets($project, array $optionalArgs = []) - { - $request = new ListPreconfiguredExpressionSetsSecurityPoliciesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('ListPreconfiguredExpressionSets', SecurityPoliciesListPreconfiguredExpressionSetsResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Patches the specified policy with the data included in the request. To clear fields in the policy, leave the fields empty and specify them in the updateMask. This cannot be used to be update the rules in the policy. Please use the per rule methods like addRule, patchRule, and removeRule instead. - * - * Sample code: - * ``` - * $securityPoliciesClient = new SecurityPoliciesClient(); - * try { - * $project = 'project'; - * $securityPolicy = 'security_policy'; - * $securityPolicyResource = new SecurityPolicy(); - * $operationResponse = $securityPoliciesClient->patch($project, $securityPolicy, $securityPolicyResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $securityPoliciesClient->patch($project, $securityPolicy, $securityPolicyResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $securityPoliciesClient->resumeOperation($operationName, 'patch'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $securityPoliciesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $securityPolicy Name of the security policy to update. - * @param SecurityPolicy $securityPolicyResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 $updateMask - * Indicates fields to be cleared as part of this request. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 patch($project, $securityPolicy, $securityPolicyResource, array $optionalArgs = []) - { - $request = new PatchSecurityPolicyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setSecurityPolicy($securityPolicy); - $request->setSecurityPolicyResource($securityPolicyResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['security_policy'] = $securityPolicy; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('Patch', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Patches a rule at the specified priority. To clear fields in the rule, leave the fields empty and specify them in the updateMask. - * - * Sample code: - * ``` - * $securityPoliciesClient = new SecurityPoliciesClient(); - * try { - * $project = 'project'; - * $securityPolicy = 'security_policy'; - * $securityPolicyRuleResource = new SecurityPolicyRule(); - * $operationResponse = $securityPoliciesClient->patchRule($project, $securityPolicy, $securityPolicyRuleResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $securityPoliciesClient->patchRule($project, $securityPolicy, $securityPolicyRuleResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $securityPoliciesClient->resumeOperation($operationName, 'patchRule'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $securityPoliciesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $securityPolicy Name of the security policy to update. - * @param SecurityPolicyRule $securityPolicyRuleResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type int $priority - * The priority of the rule to patch. - * @type string $updateMask - * Indicates fields to be cleared as part of this request. - * @type bool $validateOnly - * If true, the request will not be committed. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 patchRule($project, $securityPolicy, $securityPolicyRuleResource, array $optionalArgs = []) - { - $request = new PatchRuleSecurityPolicyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setSecurityPolicy($securityPolicy); - $request->setSecurityPolicyRuleResource($securityPolicyRuleResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['security_policy'] = $securityPolicy; - if (isset($optionalArgs['priority'])) { - $request->setPriority($optionalArgs['priority']); - } - - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - 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('PatchRule', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Deletes a rule at the specified priority. - * - * Sample code: - * ``` - * $securityPoliciesClient = new SecurityPoliciesClient(); - * try { - * $project = 'project'; - * $securityPolicy = 'security_policy'; - * $operationResponse = $securityPoliciesClient->removeRule($project, $securityPolicy); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $securityPoliciesClient->removeRule($project, $securityPolicy); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $securityPoliciesClient->resumeOperation($operationName, 'removeRule'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $securityPoliciesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $securityPolicy Name of the security policy to update. - * @param array $optionalArgs { - * Optional. - * - * @type int $priority - * The priority of the rule to remove from the security policy. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 removeRule($project, $securityPolicy, array $optionalArgs = []) - { - $request = new RemoveRuleSecurityPolicyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setSecurityPolicy($securityPolicy); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['security_policy'] = $securityPolicy; - if (isset($optionalArgs['priority'])) { - $request->setPriority($optionalArgs['priority']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('RemoveRule', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Sets the labels on a security policy. To learn more about labels, read the Labeling Resources documentation. - * - * Sample code: - * ``` - * $securityPoliciesClient = new SecurityPoliciesClient(); - * try { - * $globalSetLabelsRequestResource = new GlobalSetLabelsRequest(); - * $project = 'project'; - * $resource = 'resource'; - * $operationResponse = $securityPoliciesClient->setLabels($globalSetLabelsRequestResource, $project, $resource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $securityPoliciesClient->setLabels($globalSetLabelsRequestResource, $project, $resource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $securityPoliciesClient->resumeOperation($operationName, 'setLabels'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $securityPoliciesClient->close(); - * } - * ``` - * - * @param GlobalSetLabelsRequest $globalSetLabelsRequestResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $resource Name or id of the resource for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 setLabels($globalSetLabelsRequestResource, $project, $resource, array $optionalArgs = []) - { - $request = new SetLabelsSecurityPolicyRequest(); - $requestParamHeaders = []; - $request->setGlobalSetLabelsRequestResource($globalSetLabelsRequestResource); - $request->setProject($project); - $request->setResource($resource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['resource'] = $resource; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('SetLabels', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/ServiceAttachmentsGapicClient.php b/Compute/src/V1/Gapic/ServiceAttachmentsGapicClient.php deleted file mode 100644 index e503e067ba9c..000000000000 --- a/Compute/src/V1/Gapic/ServiceAttachmentsGapicClient.php +++ /dev/null @@ -1,872 +0,0 @@ -aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $serviceAttachmentsClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $serviceAttachmentsClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\ServiceAttachmentsClient}. - */ -class ServiceAttachmentsGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.ServiceAttachments'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/service_attachments_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/service_attachments_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/service_attachments_rest_client_config.php', - ], - ], - 'operationsClientClass' => RegionOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an RegionOperationsClient object with the same endpoint as $this. - * - * @return RegionOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetRegionOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteRegionOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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); - } - - /** - * Retrieves the list of all ServiceAttachment resources, regional and global, available to the specified project. To prevent failure, Google recommends that you set the `returnPartialSuccess` parameter to `true`. - * - * Sample code: - * ``` - * $serviceAttachmentsClient = new ServiceAttachmentsClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $serviceAttachmentsClient->aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $serviceAttachmentsClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $serviceAttachmentsClient->close(); - * } - * ``` - * - * @param string $project Name of the project scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type bool $includeAllScopes - * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type int $serviceProjectNumber - * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable 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 aggregatedList($project, array $optionalArgs = []) - { - $request = new AggregatedListServiceAttachmentsRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['includeAllScopes'])) { - $request->setIncludeAllScopes($optionalArgs['includeAllScopes']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - if (isset($optionalArgs['serviceProjectNumber'])) { - $request->setServiceProjectNumber($optionalArgs['serviceProjectNumber']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('AggregatedList', $optionalArgs, ServiceAttachmentAggregatedList::class, $request); - } - - /** - * Deletes the specified ServiceAttachment in the given scope - * - * Sample code: - * ``` - * $serviceAttachmentsClient = new ServiceAttachmentsClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $serviceAttachment = 'service_attachment'; - * $operationResponse = $serviceAttachmentsClient->delete($project, $region, $serviceAttachment); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $serviceAttachmentsClient->delete($project, $region, $serviceAttachment); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $serviceAttachmentsClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $serviceAttachmentsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region of this request. - * @param string $serviceAttachment Name of the ServiceAttachment resource to delete. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($project, $region, $serviceAttachment, array $optionalArgs = []) - { - $request = new DeleteServiceAttachmentRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setServiceAttachment($serviceAttachment); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['service_attachment'] = $serviceAttachment; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns the specified ServiceAttachment resource in the given scope. - * - * Sample code: - * ``` - * $serviceAttachmentsClient = new ServiceAttachmentsClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $serviceAttachment = 'service_attachment'; - * $response = $serviceAttachmentsClient->get($project, $region, $serviceAttachment); - * } finally { - * $serviceAttachmentsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region of this request. - * @param string $serviceAttachment Name of the ServiceAttachment resource to return. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\ServiceAttachment - * - * @throws ApiException if the remote call fails - */ - public function get($project, $region, $serviceAttachment, array $optionalArgs = []) - { - $request = new GetServiceAttachmentRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setServiceAttachment($serviceAttachment); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['service_attachment'] = $serviceAttachment; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', ServiceAttachment::class, $optionalArgs, $request)->wait(); - } - - /** - * Gets the access control policy for a resource. May be empty if no such policy or resource exists. - * - * Sample code: - * ``` - * $serviceAttachmentsClient = new ServiceAttachmentsClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $resource = 'resource'; - * $response = $serviceAttachmentsClient->getIamPolicy($project, $region, $resource); - * } finally { - * $serviceAttachmentsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region The name of the region for this request. - * @param string $resource Name or id of the resource for this request. - * @param array $optionalArgs { - * Optional. - * - * @type int $optionsRequestedPolicyVersion - * Requested IAM Policy version. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function getIamPolicy($project, $region, $resource, array $optionalArgs = []) - { - $request = new GetIamPolicyServiceAttachmentRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setResource($resource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['optionsRequestedPolicyVersion'])) { - $request->setOptionsRequestedPolicyVersion($optionalArgs['optionsRequestedPolicyVersion']); - } - - $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(); - } - - /** - * Creates a ServiceAttachment in the specified project in the given scope using the parameters that are included in the request. - * - * Sample code: - * ``` - * $serviceAttachmentsClient = new ServiceAttachmentsClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $serviceAttachmentResource = new ServiceAttachment(); - * $operationResponse = $serviceAttachmentsClient->insert($project, $region, $serviceAttachmentResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $serviceAttachmentsClient->insert($project, $region, $serviceAttachmentResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $serviceAttachmentsClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $serviceAttachmentsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region of this request. - * @param ServiceAttachment $serviceAttachmentResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 insert($project, $region, $serviceAttachmentResource, array $optionalArgs = []) - { - $request = new InsertServiceAttachmentRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setServiceAttachmentResource($serviceAttachmentResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Lists the ServiceAttachments for a project in the given scope. - * - * Sample code: - * ``` - * $serviceAttachmentsClient = new ServiceAttachmentsClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * // Iterate over pages of elements - * $pagedResponse = $serviceAttachmentsClient->list($project, $region); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $serviceAttachmentsClient->list($project, $region); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $serviceAttachmentsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region of this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, $region, array $optionalArgs = []) - { - $request = new ListServiceAttachmentsRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, ServiceAttachmentList::class, $request); - } - - /** - * Patches the specified ServiceAttachment resource with the data included in the request. This method supports PATCH semantics and uses JSON merge patch format and processing rules. - * - * Sample code: - * ``` - * $serviceAttachmentsClient = new ServiceAttachmentsClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $serviceAttachment = 'service_attachment'; - * $serviceAttachmentResource = new ServiceAttachment(); - * $operationResponse = $serviceAttachmentsClient->patch($project, $region, $serviceAttachment, $serviceAttachmentResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $serviceAttachmentsClient->patch($project, $region, $serviceAttachment, $serviceAttachmentResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $serviceAttachmentsClient->resumeOperation($operationName, 'patch'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $serviceAttachmentsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region The region scoping this request and should conform to RFC1035. - * @param string $serviceAttachment The resource id of the ServiceAttachment to patch. It should conform to RFC1035 resource name or be a string form on an unsigned long number. - * @param ServiceAttachment $serviceAttachmentResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 patch($project, $region, $serviceAttachment, $serviceAttachmentResource, array $optionalArgs = []) - { - $request = new PatchServiceAttachmentRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setServiceAttachment($serviceAttachment); - $request->setServiceAttachmentResource($serviceAttachmentResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['service_attachment'] = $serviceAttachment; - 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('Patch', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Sets the access control policy on the specified resource. Replaces any existing policy. - * - * Sample code: - * ``` - * $serviceAttachmentsClient = new ServiceAttachmentsClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $regionSetPolicyRequestResource = new RegionSetPolicyRequest(); - * $resource = 'resource'; - * $response = $serviceAttachmentsClient->setIamPolicy($project, $region, $regionSetPolicyRequestResource, $resource); - * } finally { - * $serviceAttachmentsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region The name of the region for this request. - * @param RegionSetPolicyRequest $regionSetPolicyRequestResource The body resource for this request - * @param string $resource Name or id of the resource for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function setIamPolicy($project, $region, $regionSetPolicyRequestResource, $resource, array $optionalArgs = []) - { - $request = new SetIamPolicyServiceAttachmentRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setRegionSetPolicyRequestResource($regionSetPolicyRequestResource); - $request->setResource($resource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['resource'] = $resource; - $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 resource. - * - * Sample code: - * ``` - * $serviceAttachmentsClient = new ServiceAttachmentsClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $resource = 'resource'; - * $testPermissionsRequestResource = new TestPermissionsRequest(); - * $response = $serviceAttachmentsClient->testIamPermissions($project, $region, $resource, $testPermissionsRequestResource); - * } finally { - * $serviceAttachmentsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region The name of the region for this request. - * @param string $resource Name or id of the resource for this request. - * @param TestPermissionsRequest $testPermissionsRequestResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\TestPermissionsResponse - * - * @throws ApiException if the remote call fails - */ - public function testIamPermissions($project, $region, $resource, $testPermissionsRequestResource, array $optionalArgs = []) - { - $request = new TestIamPermissionsServiceAttachmentRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setResource($resource); - $request->setTestPermissionsRequestResource($testPermissionsRequestResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['resource'] = $resource; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('TestIamPermissions', TestPermissionsResponse::class, $optionalArgs, $request)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/SnapshotSettingsServiceGapicClient.php b/Compute/src/V1/Gapic/SnapshotSettingsServiceGapicClient.php deleted file mode 100644 index 67196ae79857..000000000000 --- a/Compute/src/V1/Gapic/SnapshotSettingsServiceGapicClient.php +++ /dev/null @@ -1,348 +0,0 @@ -get($project); - * } finally { - * $snapshotSettingsServiceClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\SnapshotSettingsServiceClient}. - */ -class SnapshotSettingsServiceGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.SnapshotSettingsService'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/snapshot_settings_service_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/snapshot_settings_service_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/snapshot_settings_service_rest_client_config.php', - ], - ], - 'operationsClientClass' => GlobalOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an GlobalOperationsClient object with the same endpoint as $this. - * - * @return GlobalOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetGlobalOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteGlobalOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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); - } - - /** - * Get snapshot settings. - * - * Sample code: - * ``` - * $snapshotSettingsServiceClient = new SnapshotSettingsServiceClient(); - * try { - * $project = 'project'; - * $response = $snapshotSettingsServiceClient->get($project); - * } finally { - * $snapshotSettingsServiceClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\SnapshotSettings - * - * @throws ApiException if the remote call fails - */ - public function get($project, array $optionalArgs = []) - { - $request = new GetSnapshotSettingRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', SnapshotSettings::class, $optionalArgs, $request)->wait(); - } - - /** - * Patch snapshot settings. - * - * Sample code: - * ``` - * $snapshotSettingsServiceClient = new SnapshotSettingsServiceClient(); - * try { - * $project = 'project'; - * $snapshotSettingsResource = new SnapshotSettings(); - * $operationResponse = $snapshotSettingsServiceClient->patch($project, $snapshotSettingsResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $snapshotSettingsServiceClient->patch($project, $snapshotSettingsResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $snapshotSettingsServiceClient->resumeOperation($operationName, 'patch'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $snapshotSettingsServiceClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param SnapshotSettings $snapshotSettingsResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 $updateMask - * update_mask indicates fields to be updated as part of this request. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 patch($project, $snapshotSettingsResource, array $optionalArgs = []) - { - $request = new PatchSnapshotSettingRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setSnapshotSettingsResource($snapshotSettingsResource); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('Patch', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/SnapshotsGapicClient.php b/Compute/src/V1/Gapic/SnapshotsGapicClient.php deleted file mode 100644 index 18f7d198b22c..000000000000 --- a/Compute/src/V1/Gapic/SnapshotsGapicClient.php +++ /dev/null @@ -1,748 +0,0 @@ -delete($project, $snapshot); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $snapshotsClient->delete($project, $snapshot); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $snapshotsClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $snapshotsClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\SnapshotsClient}. - */ -class SnapshotsGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.Snapshots'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/snapshots_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/snapshots_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/snapshots_rest_client_config.php', - ], - ], - 'operationsClientClass' => GlobalOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an GlobalOperationsClient object with the same endpoint as $this. - * - * @return GlobalOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetGlobalOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteGlobalOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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 the specified Snapshot resource. Keep in mind that deleting a single snapshot might not necessarily delete all the data on that snapshot. If any data on the snapshot that is marked for deletion is needed for subsequent snapshots, the data will be moved to the next corresponding snapshot. For more information, see Deleting snapshots. - * - * Sample code: - * ``` - * $snapshotsClient = new SnapshotsClient(); - * try { - * $project = 'project'; - * $snapshot = 'snapshot'; - * $operationResponse = $snapshotsClient->delete($project, $snapshot); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $snapshotsClient->delete($project, $snapshot); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $snapshotsClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $snapshotsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $snapshot Name of the Snapshot resource to delete. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($project, $snapshot, array $optionalArgs = []) - { - $request = new DeleteSnapshotRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setSnapshot($snapshot); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['snapshot'] = $snapshot; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns the specified Snapshot resource. - * - * Sample code: - * ``` - * $snapshotsClient = new SnapshotsClient(); - * try { - * $project = 'project'; - * $snapshot = 'snapshot'; - * $response = $snapshotsClient->get($project, $snapshot); - * } finally { - * $snapshotsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $snapshot Name of the Snapshot resource to return. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Snapshot - * - * @throws ApiException if the remote call fails - */ - public function get($project, $snapshot, array $optionalArgs = []) - { - $request = new GetSnapshotRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setSnapshot($snapshot); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['snapshot'] = $snapshot; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', Snapshot::class, $optionalArgs, $request)->wait(); - } - - /** - * Gets the access control policy for a resource. May be empty if no such policy or resource exists. - * - * Sample code: - * ``` - * $snapshotsClient = new SnapshotsClient(); - * try { - * $project = 'project'; - * $resource = 'resource'; - * $response = $snapshotsClient->getIamPolicy($project, $resource); - * } finally { - * $snapshotsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $resource Name or id of the resource for this request. - * @param array $optionalArgs { - * Optional. - * - * @type int $optionsRequestedPolicyVersion - * Requested IAM Policy version. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function getIamPolicy($project, $resource, array $optionalArgs = []) - { - $request = new GetIamPolicySnapshotRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setResource($resource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['optionsRequestedPolicyVersion'])) { - $request->setOptionsRequestedPolicyVersion($optionalArgs['optionsRequestedPolicyVersion']); - } - - $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(); - } - - /** - * Creates a snapshot in the specified project using the data included in the request. For regular snapshot creation, consider using this method instead of disks.createSnapshot, as this method supports more features, such as creating snapshots in a project different from the source disk project. - * - * Sample code: - * ``` - * $snapshotsClient = new SnapshotsClient(); - * try { - * $project = 'project'; - * $snapshotResource = new Snapshot(); - * $operationResponse = $snapshotsClient->insert($project, $snapshotResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $snapshotsClient->insert($project, $snapshotResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $snapshotsClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $snapshotsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param Snapshot $snapshotResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 insert($project, $snapshotResource, array $optionalArgs = []) - { - $request = new InsertSnapshotRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setSnapshotResource($snapshotResource); - $requestParamHeaders['project'] = $project; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Retrieves the list of Snapshot resources contained within the specified project. - * - * Sample code: - * ``` - * $snapshotsClient = new SnapshotsClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $snapshotsClient->list($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $snapshotsClient->list($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $snapshotsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, array $optionalArgs = []) - { - $request = new ListSnapshotsRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, SnapshotList::class, $request); - } - - /** - * Sets the access control policy on the specified resource. Replaces any existing policy. - * - * Sample code: - * ``` - * $snapshotsClient = new SnapshotsClient(); - * try { - * $globalSetPolicyRequestResource = new GlobalSetPolicyRequest(); - * $project = 'project'; - * $resource = 'resource'; - * $response = $snapshotsClient->setIamPolicy($globalSetPolicyRequestResource, $project, $resource); - * } finally { - * $snapshotsClient->close(); - * } - * ``` - * - * @param GlobalSetPolicyRequest $globalSetPolicyRequestResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $resource Name or id of the resource for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function setIamPolicy($globalSetPolicyRequestResource, $project, $resource, array $optionalArgs = []) - { - $request = new SetIamPolicySnapshotRequest(); - $requestParamHeaders = []; - $request->setGlobalSetPolicyRequestResource($globalSetPolicyRequestResource); - $request->setProject($project); - $request->setResource($resource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['resource'] = $resource; - $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(); - } - - /** - * Sets the labels on a snapshot. To learn more about labels, read the Labeling Resources documentation. - * - * Sample code: - * ``` - * $snapshotsClient = new SnapshotsClient(); - * try { - * $globalSetLabelsRequestResource = new GlobalSetLabelsRequest(); - * $project = 'project'; - * $resource = 'resource'; - * $operationResponse = $snapshotsClient->setLabels($globalSetLabelsRequestResource, $project, $resource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $snapshotsClient->setLabels($globalSetLabelsRequestResource, $project, $resource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $snapshotsClient->resumeOperation($operationName, 'setLabels'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $snapshotsClient->close(); - * } - * ``` - * - * @param GlobalSetLabelsRequest $globalSetLabelsRequestResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $resource Name or id of the resource for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 setLabels($globalSetLabelsRequestResource, $project, $resource, array $optionalArgs = []) - { - $request = new SetLabelsSnapshotRequest(); - $requestParamHeaders = []; - $request->setGlobalSetLabelsRequestResource($globalSetLabelsRequestResource); - $request->setProject($project); - $request->setResource($resource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['resource'] = $resource; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('SetLabels', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns permissions that a caller has on the specified resource. - * - * Sample code: - * ``` - * $snapshotsClient = new SnapshotsClient(); - * try { - * $project = 'project'; - * $resource = 'resource'; - * $testPermissionsRequestResource = new TestPermissionsRequest(); - * $response = $snapshotsClient->testIamPermissions($project, $resource, $testPermissionsRequestResource); - * } finally { - * $snapshotsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $resource Name or id of the resource for this request. - * @param TestPermissionsRequest $testPermissionsRequestResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\TestPermissionsResponse - * - * @throws ApiException if the remote call fails - */ - public function testIamPermissions($project, $resource, $testPermissionsRequestResource, array $optionalArgs = []) - { - $request = new TestIamPermissionsSnapshotRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setResource($resource); - $request->setTestPermissionsRequestResource($testPermissionsRequestResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['resource'] = $resource; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('TestIamPermissions', TestPermissionsResponse::class, $optionalArgs, $request)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/SslCertificatesGapicClient.php b/Compute/src/V1/Gapic/SslCertificatesGapicClient.php deleted file mode 100644 index 6830cd88ab2d..000000000000 --- a/Compute/src/V1/Gapic/SslCertificatesGapicClient.php +++ /dev/null @@ -1,615 +0,0 @@ -aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $sslCertificatesClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $sslCertificatesClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\SslCertificatesClient}. - */ -class SslCertificatesGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.SslCertificates'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/ssl_certificates_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/ssl_certificates_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/ssl_certificates_rest_client_config.php', - ], - ], - 'operationsClientClass' => GlobalOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an GlobalOperationsClient object with the same endpoint as $this. - * - * @return GlobalOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetGlobalOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteGlobalOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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); - } - - /** - * Retrieves the list of all SslCertificate resources, regional and global, available to the specified project. To prevent failure, Google recommends that you set the `returnPartialSuccess` parameter to `true`. - * - * Sample code: - * ``` - * $sslCertificatesClient = new SslCertificatesClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $sslCertificatesClient->aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $sslCertificatesClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $sslCertificatesClient->close(); - * } - * ``` - * - * @param string $project Name of the project scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type bool $includeAllScopes - * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type int $serviceProjectNumber - * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable 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 aggregatedList($project, array $optionalArgs = []) - { - $request = new AggregatedListSslCertificatesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['includeAllScopes'])) { - $request->setIncludeAllScopes($optionalArgs['includeAllScopes']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - if (isset($optionalArgs['serviceProjectNumber'])) { - $request->setServiceProjectNumber($optionalArgs['serviceProjectNumber']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('AggregatedList', $optionalArgs, SslCertificateAggregatedList::class, $request); - } - - /** - * Deletes the specified SslCertificate resource. - * - * Sample code: - * ``` - * $sslCertificatesClient = new SslCertificatesClient(); - * try { - * $project = 'project'; - * $sslCertificate = 'ssl_certificate'; - * $operationResponse = $sslCertificatesClient->delete($project, $sslCertificate); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $sslCertificatesClient->delete($project, $sslCertificate); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $sslCertificatesClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $sslCertificatesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $sslCertificate Name of the SslCertificate resource to delete. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($project, $sslCertificate, array $optionalArgs = []) - { - $request = new DeleteSslCertificateRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setSslCertificate($sslCertificate); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['ssl_certificate'] = $sslCertificate; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns the specified SslCertificate resource. - * - * Sample code: - * ``` - * $sslCertificatesClient = new SslCertificatesClient(); - * try { - * $project = 'project'; - * $sslCertificate = 'ssl_certificate'; - * $response = $sslCertificatesClient->get($project, $sslCertificate); - * } finally { - * $sslCertificatesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $sslCertificate Name of the SslCertificate resource to return. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\SslCertificate - * - * @throws ApiException if the remote call fails - */ - public function get($project, $sslCertificate, array $optionalArgs = []) - { - $request = new GetSslCertificateRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setSslCertificate($sslCertificate); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['ssl_certificate'] = $sslCertificate; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', SslCertificate::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates a SslCertificate resource in the specified project using the data included in the request. - * - * Sample code: - * ``` - * $sslCertificatesClient = new SslCertificatesClient(); - * try { - * $project = 'project'; - * $sslCertificateResource = new SslCertificate(); - * $operationResponse = $sslCertificatesClient->insert($project, $sslCertificateResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $sslCertificatesClient->insert($project, $sslCertificateResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $sslCertificatesClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $sslCertificatesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param SslCertificate $sslCertificateResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 insert($project, $sslCertificateResource, array $optionalArgs = []) - { - $request = new InsertSslCertificateRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setSslCertificateResource($sslCertificateResource); - $requestParamHeaders['project'] = $project; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Retrieves the list of SslCertificate resources available to the specified project. - * - * Sample code: - * ``` - * $sslCertificatesClient = new SslCertificatesClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $sslCertificatesClient->list($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $sslCertificatesClient->list($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $sslCertificatesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, array $optionalArgs = []) - { - $request = new ListSslCertificatesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, SslCertificateList::class, $request); - } -} diff --git a/Compute/src/V1/Gapic/SslPoliciesGapicClient.php b/Compute/src/V1/Gapic/SslPoliciesGapicClient.php deleted file mode 100644 index da7636fe1c52..000000000000 --- a/Compute/src/V1/Gapic/SslPoliciesGapicClient.php +++ /dev/null @@ -1,762 +0,0 @@ -aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $sslPoliciesClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $sslPoliciesClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\SslPoliciesClient}. - */ -class SslPoliciesGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.SslPolicies'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/ssl_policies_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/ssl_policies_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/ssl_policies_rest_client_config.php', - ], - ], - 'operationsClientClass' => GlobalOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an GlobalOperationsClient object with the same endpoint as $this. - * - * @return GlobalOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetGlobalOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteGlobalOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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); - } - - /** - * Retrieves the list of all SslPolicy resources, regional and global, available to the specified project. To prevent failure, Google recommends that you set the `returnPartialSuccess` parameter to `true`. - * - * Sample code: - * ``` - * $sslPoliciesClient = new SslPoliciesClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $sslPoliciesClient->aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $sslPoliciesClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $sslPoliciesClient->close(); - * } - * ``` - * - * @param string $project Name of the project scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type bool $includeAllScopes - * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type int $serviceProjectNumber - * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable 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 aggregatedList($project, array $optionalArgs = []) - { - $request = new AggregatedListSslPoliciesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['includeAllScopes'])) { - $request->setIncludeAllScopes($optionalArgs['includeAllScopes']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - if (isset($optionalArgs['serviceProjectNumber'])) { - $request->setServiceProjectNumber($optionalArgs['serviceProjectNumber']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('AggregatedList', $optionalArgs, SslPoliciesAggregatedList::class, $request); - } - - /** - * Deletes the specified SSL policy. The SSL policy resource can be deleted only if it is not in use by any TargetHttpsProxy or TargetSslProxy resources. - * - * Sample code: - * ``` - * $sslPoliciesClient = new SslPoliciesClient(); - * try { - * $project = 'project'; - * $sslPolicy = 'ssl_policy'; - * $operationResponse = $sslPoliciesClient->delete($project, $sslPolicy); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $sslPoliciesClient->delete($project, $sslPolicy); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $sslPoliciesClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $sslPoliciesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $sslPolicy Name of the SSL policy to delete. The name must be 1-63 characters long, and comply with RFC1035. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($project, $sslPolicy, array $optionalArgs = []) - { - $request = new DeleteSslPolicyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setSslPolicy($sslPolicy); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['ssl_policy'] = $sslPolicy; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Lists all of the ordered rules present in a single specified policy. - * - * Sample code: - * ``` - * $sslPoliciesClient = new SslPoliciesClient(); - * try { - * $project = 'project'; - * $sslPolicy = 'ssl_policy'; - * $response = $sslPoliciesClient->get($project, $sslPolicy); - * } finally { - * $sslPoliciesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $sslPolicy Name of the SSL policy to update. The name must be 1-63 characters long, and comply with RFC1035. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\SslPolicy - * - * @throws ApiException if the remote call fails - */ - public function get($project, $sslPolicy, array $optionalArgs = []) - { - $request = new GetSslPolicyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setSslPolicy($sslPolicy); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['ssl_policy'] = $sslPolicy; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', SslPolicy::class, $optionalArgs, $request)->wait(); - } - - /** - * Returns the specified SSL policy resource. - * - * Sample code: - * ``` - * $sslPoliciesClient = new SslPoliciesClient(); - * try { - * $project = 'project'; - * $sslPolicyResource = new SslPolicy(); - * $operationResponse = $sslPoliciesClient->insert($project, $sslPolicyResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $sslPoliciesClient->insert($project, $sslPolicyResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $sslPoliciesClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $sslPoliciesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param SslPolicy $sslPolicyResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 insert($project, $sslPolicyResource, array $optionalArgs = []) - { - $request = new InsertSslPolicyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setSslPolicyResource($sslPolicyResource); - $requestParamHeaders['project'] = $project; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Lists all the SSL policies that have been configured for the specified project. - * - * Sample code: - * ``` - * $sslPoliciesClient = new SslPoliciesClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $sslPoliciesClient->list($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $sslPoliciesClient->list($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $sslPoliciesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, array $optionalArgs = []) - { - $request = new ListSslPoliciesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, SslPoliciesList::class, $request); - } - - /** - * Lists all features that can be specified in the SSL policy when using custom profile. - * - * Sample code: - * ``` - * $sslPoliciesClient = new SslPoliciesClient(); - * try { - * $project = 'project'; - * $response = $sslPoliciesClient->listAvailableFeatures($project); - * } finally { - * $sslPoliciesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @type string $pageToken - * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. - * @type bool $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\SslPoliciesListAvailableFeaturesResponse - * - * @throws ApiException if the remote call fails - */ - public function listAvailableFeatures($project, array $optionalArgs = []) - { - $request = new ListAvailableFeaturesSslPoliciesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('ListAvailableFeatures', SslPoliciesListAvailableFeaturesResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Patches the specified SSL policy with the data included in the request. - * - * Sample code: - * ``` - * $sslPoliciesClient = new SslPoliciesClient(); - * try { - * $project = 'project'; - * $sslPolicy = 'ssl_policy'; - * $sslPolicyResource = new SslPolicy(); - * $operationResponse = $sslPoliciesClient->patch($project, $sslPolicy, $sslPolicyResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $sslPoliciesClient->patch($project, $sslPolicy, $sslPolicyResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $sslPoliciesClient->resumeOperation($operationName, 'patch'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $sslPoliciesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $sslPolicy Name of the SSL policy to update. The name must be 1-63 characters long, and comply with RFC1035. - * @param SslPolicy $sslPolicyResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 patch($project, $sslPolicy, $sslPolicyResource, array $optionalArgs = []) - { - $request = new PatchSslPolicyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setSslPolicy($sslPolicy); - $request->setSslPolicyResource($sslPolicyResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['ssl_policy'] = $sslPolicy; - 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('Patch', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/StoragePoolTypesGapicClient.php b/Compute/src/V1/Gapic/StoragePoolTypesGapicClient.php deleted file mode 100644 index 49784b29bd17..000000000000 --- a/Compute/src/V1/Gapic/StoragePoolTypesGapicClient.php +++ /dev/null @@ -1,422 +0,0 @@ -aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $storagePoolTypesClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $storagePoolTypesClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\StoragePoolTypesClient}. - */ -class StoragePoolTypesGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.StoragePoolTypes'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute.readonly', - 'https://www.googleapis.com/auth/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/storage_pool_types_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/storage_pool_types_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/storage_pool_types_rest_client_config.php', - ], - ], - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * 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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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); - } - - /** - * Retrieves an aggregated list of storage pool types. To prevent failure, Google recommends that you set the `returnPartialSuccess` parameter to `true`. - * - * Sample code: - * ``` - * $storagePoolTypesClient = new StoragePoolTypesClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $storagePoolTypesClient->aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $storagePoolTypesClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $storagePoolTypesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type bool $includeAllScopes - * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type int $serviceProjectNumber - * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable 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 aggregatedList($project, array $optionalArgs = []) - { - $request = new AggregatedListStoragePoolTypesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['includeAllScopes'])) { - $request->setIncludeAllScopes($optionalArgs['includeAllScopes']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - if (isset($optionalArgs['serviceProjectNumber'])) { - $request->setServiceProjectNumber($optionalArgs['serviceProjectNumber']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('AggregatedList', $optionalArgs, StoragePoolTypeAggregatedList::class, $request); - } - - /** - * Returns the specified storage pool type. - * - * Sample code: - * ``` - * $storagePoolTypesClient = new StoragePoolTypesClient(); - * try { - * $project = 'project'; - * $storagePoolType = 'storage_pool_type'; - * $zone = 'zone'; - * $response = $storagePoolTypesClient->get($project, $storagePoolType, $zone); - * } finally { - * $storagePoolTypesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $storagePoolType Name of the storage pool type to return. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\StoragePoolType - * - * @throws ApiException if the remote call fails - */ - public function get($project, $storagePoolType, $zone, array $optionalArgs = []) - { - $request = new GetStoragePoolTypeRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setStoragePoolType($storagePoolType); - $request->setZone($zone); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['storage_pool_type'] = $storagePoolType; - $requestParamHeaders['zone'] = $zone; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', StoragePoolType::class, $optionalArgs, $request)->wait(); - } - - /** - * Retrieves a list of storage pool types available to the specified project. - * - * Sample code: - * ``` - * $storagePoolTypesClient = new StoragePoolTypesClient(); - * try { - * $project = 'project'; - * $zone = 'zone'; - * // Iterate over pages of elements - * $pagedResponse = $storagePoolTypesClient->list($project, $zone); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $storagePoolTypesClient->list($project, $zone); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $storagePoolTypesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, $zone, array $optionalArgs = []) - { - $request = new ListStoragePoolTypesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, StoragePoolTypeList::class, $request); - } -} diff --git a/Compute/src/V1/Gapic/StoragePoolsGapicClient.php b/Compute/src/V1/Gapic/StoragePoolsGapicClient.php deleted file mode 100644 index 9e0b78f99023..000000000000 --- a/Compute/src/V1/Gapic/StoragePoolsGapicClient.php +++ /dev/null @@ -1,942 +0,0 @@ -aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $storagePoolsClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $storagePoolsClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\StoragePoolsClient}. - */ -class StoragePoolsGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.StoragePools'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/storage_pools_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/storage_pools_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/storage_pools_rest_client_config.php', - ], - ], - 'operationsClientClass' => ZoneOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an ZoneOperationsClient object with the same endpoint as $this. - * - * @return ZoneOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getZone', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetZoneOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteZoneOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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); - } - - /** - * Retrieves an aggregated list of storage pools. To prevent failure, Google recommends that you set the `returnPartialSuccess` parameter to `true`. - * - * Sample code: - * ``` - * $storagePoolsClient = new StoragePoolsClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $storagePoolsClient->aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $storagePoolsClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $storagePoolsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type bool $includeAllScopes - * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type int $serviceProjectNumber - * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable 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 aggregatedList($project, array $optionalArgs = []) - { - $request = new AggregatedListStoragePoolsRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['includeAllScopes'])) { - $request->setIncludeAllScopes($optionalArgs['includeAllScopes']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - if (isset($optionalArgs['serviceProjectNumber'])) { - $request->setServiceProjectNumber($optionalArgs['serviceProjectNumber']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('AggregatedList', $optionalArgs, StoragePoolAggregatedList::class, $request); - } - - /** - * Deletes the specified storage pool. Deleting a storagePool removes its data permanently and is irreversible. However, deleting a storagePool does not delete any snapshots previously made from the storagePool. You must separately delete snapshots. - * - * Sample code: - * ``` - * $storagePoolsClient = new StoragePoolsClient(); - * try { - * $project = 'project'; - * $storagePool = 'storage_pool'; - * $zone = 'zone'; - * $operationResponse = $storagePoolsClient->delete($project, $storagePool, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $storagePoolsClient->delete($project, $storagePool, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $storagePoolsClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $storagePoolsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $storagePool Name of the storage pool to delete. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($project, $storagePool, $zone, array $optionalArgs = []) - { - $request = new DeleteStoragePoolRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setStoragePool($storagePool); - $request->setZone($zone); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['storage_pool'] = $storagePool; - $requestParamHeaders['zone'] = $zone; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns a specified storage pool. Gets a list of available storage pools by making a list() request. - * - * Sample code: - * ``` - * $storagePoolsClient = new StoragePoolsClient(); - * try { - * $project = 'project'; - * $storagePool = 'storage_pool'; - * $zone = 'zone'; - * $response = $storagePoolsClient->get($project, $storagePool, $zone); - * } finally { - * $storagePoolsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $storagePool Name of the storage pool to return. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\StoragePool - * - * @throws ApiException if the remote call fails - */ - public function get($project, $storagePool, $zone, array $optionalArgs = []) - { - $request = new GetStoragePoolRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setStoragePool($storagePool); - $request->setZone($zone); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['storage_pool'] = $storagePool; - $requestParamHeaders['zone'] = $zone; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', StoragePool::class, $optionalArgs, $request)->wait(); - } - - /** - * Gets the access control policy for a resource. May be empty if no such policy or resource exists. - * - * Sample code: - * ``` - * $storagePoolsClient = new StoragePoolsClient(); - * try { - * $project = 'project'; - * $resource = 'resource'; - * $zone = 'zone'; - * $response = $storagePoolsClient->getIamPolicy($project, $resource, $zone); - * } finally { - * $storagePoolsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $resource Name or id of the resource for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type int $optionsRequestedPolicyVersion - * Requested IAM Policy version. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function getIamPolicy($project, $resource, $zone, array $optionalArgs = []) - { - $request = new GetIamPolicyStoragePoolRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setResource($resource); - $request->setZone($zone); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['resource'] = $resource; - $requestParamHeaders['zone'] = $zone; - if (isset($optionalArgs['optionsRequestedPolicyVersion'])) { - $request->setOptionsRequestedPolicyVersion($optionalArgs['optionsRequestedPolicyVersion']); - } - - $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(); - } - - /** - * Creates a storage pool in the specified project using the data in the request. - * - * Sample code: - * ``` - * $storagePoolsClient = new StoragePoolsClient(); - * try { - * $project = 'project'; - * $storagePoolResource = new StoragePool(); - * $zone = 'zone'; - * $operationResponse = $storagePoolsClient->insert($project, $storagePoolResource, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $storagePoolsClient->insert($project, $storagePoolResource, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $storagePoolsClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $storagePoolsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param StoragePool $storagePoolResource The body resource for this request - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 insert($project, $storagePoolResource, $zone, array $optionalArgs = []) - { - $request = new InsertStoragePoolRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setStoragePoolResource($storagePoolResource); - $request->setZone($zone); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Retrieves a list of storage pools contained within the specified zone. - * - * Sample code: - * ``` - * $storagePoolsClient = new StoragePoolsClient(); - * try { - * $project = 'project'; - * $zone = 'zone'; - * $response = $storagePoolsClient->list($project, $zone); - * } finally { - * $storagePoolsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @type string $pageToken - * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. - * @type bool $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\StoragePoolList - * - * @throws ApiException if the remote call fails - */ - public function list($project, $zone, array $optionalArgs = []) - { - $request = new ListStoragePoolsRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('List', StoragePoolList::class, $optionalArgs, $request)->wait(); - } - - /** - * Lists the disks in a specified storage pool. - * - * Sample code: - * ``` - * $storagePoolsClient = new StoragePoolsClient(); - * try { - * $project = 'project'; - * $storagePool = 'storage_pool'; - * $zone = 'zone'; - * $response = $storagePoolsClient->listDisks($project, $storagePool, $zone); - * } finally { - * $storagePoolsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $storagePool Name of the storage pool to list disks of. - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @type string $pageToken - * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. - * @type bool $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\StoragePoolListDisks - * - * @throws ApiException if the remote call fails - */ - public function listDisks($project, $storagePool, $zone, array $optionalArgs = []) - { - $request = new ListDisksStoragePoolsRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setStoragePool($storagePool); - $request->setZone($zone); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['storage_pool'] = $storagePool; - $requestParamHeaders['zone'] = $zone; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('ListDisks', StoragePoolListDisks::class, $optionalArgs, $request)->wait(); - } - - /** - * Sets the access control policy on the specified resource. Replaces any existing policy. - * - * Sample code: - * ``` - * $storagePoolsClient = new StoragePoolsClient(); - * try { - * $project = 'project'; - * $resource = 'resource'; - * $zone = 'zone'; - * $zoneSetPolicyRequestResource = new ZoneSetPolicyRequest(); - * $response = $storagePoolsClient->setIamPolicy($project, $resource, $zone, $zoneSetPolicyRequestResource); - * } finally { - * $storagePoolsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $resource Name or id of the resource for this request. - * @param string $zone The name of the zone for this request. - * @param ZoneSetPolicyRequest $zoneSetPolicyRequestResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function setIamPolicy($project, $resource, $zone, $zoneSetPolicyRequestResource, array $optionalArgs = []) - { - $request = new SetIamPolicyStoragePoolRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setResource($resource); - $request->setZone($zone); - $request->setZoneSetPolicyRequestResource($zoneSetPolicyRequestResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['resource'] = $resource; - $requestParamHeaders['zone'] = $zone; - $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 resource. - * - * Sample code: - * ``` - * $storagePoolsClient = new StoragePoolsClient(); - * try { - * $project = 'project'; - * $resource = 'resource'; - * $testPermissionsRequestResource = new TestPermissionsRequest(); - * $zone = 'zone'; - * $response = $storagePoolsClient->testIamPermissions($project, $resource, $testPermissionsRequestResource, $zone); - * } finally { - * $storagePoolsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $resource Name or id of the resource for this request. - * @param TestPermissionsRequest $testPermissionsRequestResource The body resource for this request - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\TestPermissionsResponse - * - * @throws ApiException if the remote call fails - */ - public function testIamPermissions($project, $resource, $testPermissionsRequestResource, $zone, array $optionalArgs = []) - { - $request = new TestIamPermissionsStoragePoolRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setResource($resource); - $request->setTestPermissionsRequestResource($testPermissionsRequestResource); - $request->setZone($zone); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['resource'] = $resource; - $requestParamHeaders['zone'] = $zone; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('TestIamPermissions', TestPermissionsResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Updates the specified storagePool with the data included in the request. The update is performed only on selected fields included as part of update-mask. Only the following fields can be modified: pool_provisioned_capacity_gb, pool_provisioned_iops and pool_provisioned_throughput. - * - * Sample code: - * ``` - * $storagePoolsClient = new StoragePoolsClient(); - * try { - * $project = 'project'; - * $storagePool = 'storage_pool'; - * $storagePoolResource = new StoragePool(); - * $zone = 'zone'; - * $operationResponse = $storagePoolsClient->update($project, $storagePool, $storagePoolResource, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $storagePoolsClient->update($project, $storagePool, $storagePoolResource, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $storagePoolsClient->resumeOperation($operationName, 'update'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $storagePoolsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $storagePool The storagePool name for this request. - * @param StoragePool $storagePoolResource The body resource for this request - * @param string $zone The name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 $updateMask - * update_mask indicates fields to be updated as part of this request. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 update($project, $storagePool, $storagePoolResource, $zone, array $optionalArgs = []) - { - $request = new UpdateStoragePoolRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setStoragePool($storagePool); - $request->setStoragePoolResource($storagePoolResource); - $request->setZone($zone); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['storage_pool'] = $storagePool; - $requestParamHeaders['zone'] = $zone; - if (isset($optionalArgs['requestId'])) { - $request->setRequestId($optionalArgs['requestId']); - } - - if (isset($optionalArgs['updateMask'])) { - $request->setUpdateMask($optionalArgs['updateMask']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('Update', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/SubnetworksGapicClient.php b/Compute/src/V1/Gapic/SubnetworksGapicClient.php deleted file mode 100644 index e45fc87fc13f..000000000000 --- a/Compute/src/V1/Gapic/SubnetworksGapicClient.php +++ /dev/null @@ -1,1132 +0,0 @@ -aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $subnetworksClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $subnetworksClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\SubnetworksClient}. - */ -class SubnetworksGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.Subnetworks'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/subnetworks_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/subnetworks_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/subnetworks_rest_client_config.php', - ], - ], - 'operationsClientClass' => RegionOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an RegionOperationsClient object with the same endpoint as $this. - * - * @return RegionOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetRegionOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteRegionOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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); - } - - /** - * Retrieves an aggregated list of subnetworks. To prevent failure, Google recommends that you set the `returnPartialSuccess` parameter to `true`. - * - * Sample code: - * ``` - * $subnetworksClient = new SubnetworksClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $subnetworksClient->aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $subnetworksClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $subnetworksClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type bool $includeAllScopes - * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type int $serviceProjectNumber - * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable 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 aggregatedList($project, array $optionalArgs = []) - { - $request = new AggregatedListSubnetworksRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['includeAllScopes'])) { - $request->setIncludeAllScopes($optionalArgs['includeAllScopes']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - if (isset($optionalArgs['serviceProjectNumber'])) { - $request->setServiceProjectNumber($optionalArgs['serviceProjectNumber']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('AggregatedList', $optionalArgs, SubnetworkAggregatedList::class, $request); - } - - /** - * Deletes the specified subnetwork. - * - * Sample code: - * ``` - * $subnetworksClient = new SubnetworksClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $subnetwork = 'subnetwork'; - * $operationResponse = $subnetworksClient->delete($project, $region, $subnetwork); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $subnetworksClient->delete($project, $region, $subnetwork); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $subnetworksClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $subnetworksClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param string $subnetwork Name of the Subnetwork resource to delete. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($project, $region, $subnetwork, array $optionalArgs = []) - { - $request = new DeleteSubnetworkRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setSubnetwork($subnetwork); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['subnetwork'] = $subnetwork; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Expands the IP CIDR range of the subnetwork to a specified value. - * - * Sample code: - * ``` - * $subnetworksClient = new SubnetworksClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $subnetwork = 'subnetwork'; - * $subnetworksExpandIpCidrRangeRequestResource = new SubnetworksExpandIpCidrRangeRequest(); - * $operationResponse = $subnetworksClient->expandIpCidrRange($project, $region, $subnetwork, $subnetworksExpandIpCidrRangeRequestResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $subnetworksClient->expandIpCidrRange($project, $region, $subnetwork, $subnetworksExpandIpCidrRangeRequestResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $subnetworksClient->resumeOperation($operationName, 'expandIpCidrRange'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $subnetworksClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param string $subnetwork Name of the Subnetwork resource to update. - * @param SubnetworksExpandIpCidrRangeRequest $subnetworksExpandIpCidrRangeRequestResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 expandIpCidrRange($project, $region, $subnetwork, $subnetworksExpandIpCidrRangeRequestResource, array $optionalArgs = []) - { - $request = new ExpandIpCidrRangeSubnetworkRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setSubnetwork($subnetwork); - $request->setSubnetworksExpandIpCidrRangeRequestResource($subnetworksExpandIpCidrRangeRequestResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['subnetwork'] = $subnetwork; - 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('ExpandIpCidrRange', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns the specified subnetwork. - * - * Sample code: - * ``` - * $subnetworksClient = new SubnetworksClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $subnetwork = 'subnetwork'; - * $response = $subnetworksClient->get($project, $region, $subnetwork); - * } finally { - * $subnetworksClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param string $subnetwork Name of the Subnetwork resource to return. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Subnetwork - * - * @throws ApiException if the remote call fails - */ - public function get($project, $region, $subnetwork, array $optionalArgs = []) - { - $request = new GetSubnetworkRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setSubnetwork($subnetwork); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['subnetwork'] = $subnetwork; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', Subnetwork::class, $optionalArgs, $request)->wait(); - } - - /** - * Gets the access control policy for a resource. May be empty if no such policy or resource exists. - * - * Sample code: - * ``` - * $subnetworksClient = new SubnetworksClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $resource = 'resource'; - * $response = $subnetworksClient->getIamPolicy($project, $region, $resource); - * } finally { - * $subnetworksClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region The name of the region for this request. - * @param string $resource Name or id of the resource for this request. - * @param array $optionalArgs { - * Optional. - * - * @type int $optionsRequestedPolicyVersion - * Requested IAM Policy version. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function getIamPolicy($project, $region, $resource, array $optionalArgs = []) - { - $request = new GetIamPolicySubnetworkRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setResource($resource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['resource'] = $resource; - if (isset($optionalArgs['optionsRequestedPolicyVersion'])) { - $request->setOptionsRequestedPolicyVersion($optionalArgs['optionsRequestedPolicyVersion']); - } - - $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(); - } - - /** - * Creates a subnetwork in the specified project using the data included in the request. - * - * Sample code: - * ``` - * $subnetworksClient = new SubnetworksClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $subnetworkResource = new Subnetwork(); - * $operationResponse = $subnetworksClient->insert($project, $region, $subnetworkResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $subnetworksClient->insert($project, $region, $subnetworkResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $subnetworksClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $subnetworksClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param Subnetwork $subnetworkResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 insert($project, $region, $subnetworkResource, array $optionalArgs = []) - { - $request = new InsertSubnetworkRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setSubnetworkResource($subnetworkResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Retrieves a list of subnetworks available to the specified project. - * - * Sample code: - * ``` - * $subnetworksClient = new SubnetworksClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * // Iterate over pages of elements - * $pagedResponse = $subnetworksClient->list($project, $region); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $subnetworksClient->list($project, $region); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $subnetworksClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, $region, array $optionalArgs = []) - { - $request = new ListSubnetworksRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, SubnetworkList::class, $request); - } - - /** - * Retrieves an aggregated list of all usable subnetworks in the project. - * - * Sample code: - * ``` - * $subnetworksClient = new SubnetworksClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $subnetworksClient->listUsable($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $subnetworksClient->listUsable($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $subnetworksClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type string $serviceProject - * The project id or project number in which the subnetwork is intended to be used. Only applied for Shared VPC. See [Shared VPC documentation](https://cloud.google.com/vpc/docs/shared-vpc/) - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 listUsable($project, array $optionalArgs = []) - { - $request = new ListUsableSubnetworksRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - if (isset($optionalArgs['serviceProject'])) { - $request->setServiceProject($optionalArgs['serviceProject']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('ListUsable', $optionalArgs, UsableSubnetworksAggregatedList::class, $request); - } - - /** - * Patches the specified subnetwork with the data included in the request. Only certain fields can be updated with a patch request as indicated in the field descriptions. You must specify the current fingerprint of the subnetwork resource being patched. - * - * Sample code: - * ``` - * $subnetworksClient = new SubnetworksClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $subnetwork = 'subnetwork'; - * $subnetworkResource = new Subnetwork(); - * $operationResponse = $subnetworksClient->patch($project, $region, $subnetwork, $subnetworkResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $subnetworksClient->patch($project, $region, $subnetwork, $subnetworkResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $subnetworksClient->resumeOperation($operationName, 'patch'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $subnetworksClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param string $subnetwork Name of the Subnetwork resource to patch. - * @param Subnetwork $subnetworkResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type int $drainTimeoutSeconds - * The drain timeout specifies the upper bound in seconds on the amount of time allowed to drain connections from the current ACTIVE subnetwork to the current BACKUP subnetwork. The drain timeout is only applicable when the following conditions are true: - the subnetwork being patched has purpose = INTERNAL_HTTPS_LOAD_BALANCER - the subnetwork being patched has role = BACKUP - the patch request is setting the role to ACTIVE. Note that after this patch operation the roles of the ACTIVE and BACKUP subnetworks will be swapped. - * @type string $requestId - * 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. 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 patch($project, $region, $subnetwork, $subnetworkResource, array $optionalArgs = []) - { - $request = new PatchSubnetworkRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setSubnetwork($subnetwork); - $request->setSubnetworkResource($subnetworkResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['subnetwork'] = $subnetwork; - if (isset($optionalArgs['drainTimeoutSeconds'])) { - $request->setDrainTimeoutSeconds($optionalArgs['drainTimeoutSeconds']); - } - - 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('Patch', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Sets the access control policy on the specified resource. Replaces any existing policy. - * - * Sample code: - * ``` - * $subnetworksClient = new SubnetworksClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $regionSetPolicyRequestResource = new RegionSetPolicyRequest(); - * $resource = 'resource'; - * $response = $subnetworksClient->setIamPolicy($project, $region, $regionSetPolicyRequestResource, $resource); - * } finally { - * $subnetworksClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region The name of the region for this request. - * @param RegionSetPolicyRequest $regionSetPolicyRequestResource The body resource for this request - * @param string $resource Name or id of the resource for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Policy - * - * @throws ApiException if the remote call fails - */ - public function setIamPolicy($project, $region, $regionSetPolicyRequestResource, $resource, array $optionalArgs = []) - { - $request = new SetIamPolicySubnetworkRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setRegionSetPolicyRequestResource($regionSetPolicyRequestResource); - $request->setResource($resource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['resource'] = $resource; - $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(); - } - - /** - * Set whether VMs in this subnet can access Google services without assigning external IP addresses through Private Google Access. - * - * Sample code: - * ``` - * $subnetworksClient = new SubnetworksClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $subnetwork = 'subnetwork'; - * $subnetworksSetPrivateIpGoogleAccessRequestResource = new SubnetworksSetPrivateIpGoogleAccessRequest(); - * $operationResponse = $subnetworksClient->setPrivateIpGoogleAccess($project, $region, $subnetwork, $subnetworksSetPrivateIpGoogleAccessRequestResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $subnetworksClient->setPrivateIpGoogleAccess($project, $region, $subnetwork, $subnetworksSetPrivateIpGoogleAccessRequestResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $subnetworksClient->resumeOperation($operationName, 'setPrivateIpGoogleAccess'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $subnetworksClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param string $subnetwork Name of the Subnetwork resource. - * @param SubnetworksSetPrivateIpGoogleAccessRequest $subnetworksSetPrivateIpGoogleAccessRequestResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 setPrivateIpGoogleAccess($project, $region, $subnetwork, $subnetworksSetPrivateIpGoogleAccessRequestResource, array $optionalArgs = []) - { - $request = new SetPrivateIpGoogleAccessSubnetworkRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setSubnetwork($subnetwork); - $request->setSubnetworksSetPrivateIpGoogleAccessRequestResource($subnetworksSetPrivateIpGoogleAccessRequestResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['subnetwork'] = $subnetwork; - 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('SetPrivateIpGoogleAccess', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns permissions that a caller has on the specified resource. - * - * Sample code: - * ``` - * $subnetworksClient = new SubnetworksClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $resource = 'resource'; - * $testPermissionsRequestResource = new TestPermissionsRequest(); - * $response = $subnetworksClient->testIamPermissions($project, $region, $resource, $testPermissionsRequestResource); - * } finally { - * $subnetworksClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region The name of the region for this request. - * @param string $resource Name or id of the resource for this request. - * @param TestPermissionsRequest $testPermissionsRequestResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\TestPermissionsResponse - * - * @throws ApiException if the remote call fails - */ - public function testIamPermissions($project, $region, $resource, $testPermissionsRequestResource, array $optionalArgs = []) - { - $request = new TestIamPermissionsSubnetworkRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setResource($resource); - $request->setTestPermissionsRequestResource($testPermissionsRequestResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['resource'] = $resource; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('TestIamPermissions', TestPermissionsResponse::class, $optionalArgs, $request)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/TargetGrpcProxiesGapicClient.php b/Compute/src/V1/Gapic/TargetGrpcProxiesGapicClient.php deleted file mode 100644 index 343d45ac5520..000000000000 --- a/Compute/src/V1/Gapic/TargetGrpcProxiesGapicClient.php +++ /dev/null @@ -1,605 +0,0 @@ -delete($project, $targetGrpcProxy); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $targetGrpcProxiesClient->delete($project, $targetGrpcProxy); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $targetGrpcProxiesClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $targetGrpcProxiesClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\TargetGrpcProxiesClient}. - */ -class TargetGrpcProxiesGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.TargetGrpcProxies'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/target_grpc_proxies_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/target_grpc_proxies_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/target_grpc_proxies_rest_client_config.php', - ], - ], - 'operationsClientClass' => GlobalOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an GlobalOperationsClient object with the same endpoint as $this. - * - * @return GlobalOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetGlobalOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteGlobalOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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 the specified TargetGrpcProxy in the given scope - * - * Sample code: - * ``` - * $targetGrpcProxiesClient = new TargetGrpcProxiesClient(); - * try { - * $project = 'project'; - * $targetGrpcProxy = 'target_grpc_proxy'; - * $operationResponse = $targetGrpcProxiesClient->delete($project, $targetGrpcProxy); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $targetGrpcProxiesClient->delete($project, $targetGrpcProxy); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $targetGrpcProxiesClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $targetGrpcProxiesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $targetGrpcProxy Name of the TargetGrpcProxy resource to delete. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($project, $targetGrpcProxy, array $optionalArgs = []) - { - $request = new DeleteTargetGrpcProxyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setTargetGrpcProxy($targetGrpcProxy); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['target_grpc_proxy'] = $targetGrpcProxy; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns the specified TargetGrpcProxy resource in the given scope. - * - * Sample code: - * ``` - * $targetGrpcProxiesClient = new TargetGrpcProxiesClient(); - * try { - * $project = 'project'; - * $targetGrpcProxy = 'target_grpc_proxy'; - * $response = $targetGrpcProxiesClient->get($project, $targetGrpcProxy); - * } finally { - * $targetGrpcProxiesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $targetGrpcProxy Name of the TargetGrpcProxy resource to return. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\TargetGrpcProxy - * - * @throws ApiException if the remote call fails - */ - public function get($project, $targetGrpcProxy, array $optionalArgs = []) - { - $request = new GetTargetGrpcProxyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setTargetGrpcProxy($targetGrpcProxy); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['target_grpc_proxy'] = $targetGrpcProxy; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', TargetGrpcProxy::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates a TargetGrpcProxy in the specified project in the given scope using the parameters that are included in the request. - * - * Sample code: - * ``` - * $targetGrpcProxiesClient = new TargetGrpcProxiesClient(); - * try { - * $project = 'project'; - * $targetGrpcProxyResource = new TargetGrpcProxy(); - * $operationResponse = $targetGrpcProxiesClient->insert($project, $targetGrpcProxyResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $targetGrpcProxiesClient->insert($project, $targetGrpcProxyResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $targetGrpcProxiesClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $targetGrpcProxiesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param TargetGrpcProxy $targetGrpcProxyResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 insert($project, $targetGrpcProxyResource, array $optionalArgs = []) - { - $request = new InsertTargetGrpcProxyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setTargetGrpcProxyResource($targetGrpcProxyResource); - $requestParamHeaders['project'] = $project; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Lists the TargetGrpcProxies for a project in the given scope. - * - * Sample code: - * ``` - * $targetGrpcProxiesClient = new TargetGrpcProxiesClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $targetGrpcProxiesClient->list($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $targetGrpcProxiesClient->list($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $targetGrpcProxiesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, array $optionalArgs = []) - { - $request = new ListTargetGrpcProxiesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, TargetGrpcProxyList::class, $request); - } - - /** - * Patches the specified TargetGrpcProxy resource with the data included in the request. This method supports PATCH semantics and uses JSON merge patch format and processing rules. - * - * Sample code: - * ``` - * $targetGrpcProxiesClient = new TargetGrpcProxiesClient(); - * try { - * $project = 'project'; - * $targetGrpcProxy = 'target_grpc_proxy'; - * $targetGrpcProxyResource = new TargetGrpcProxy(); - * $operationResponse = $targetGrpcProxiesClient->patch($project, $targetGrpcProxy, $targetGrpcProxyResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $targetGrpcProxiesClient->patch($project, $targetGrpcProxy, $targetGrpcProxyResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $targetGrpcProxiesClient->resumeOperation($operationName, 'patch'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $targetGrpcProxiesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $targetGrpcProxy Name of the TargetGrpcProxy resource to patch. - * @param TargetGrpcProxy $targetGrpcProxyResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 patch($project, $targetGrpcProxy, $targetGrpcProxyResource, array $optionalArgs = []) - { - $request = new PatchTargetGrpcProxyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setTargetGrpcProxy($targetGrpcProxy); - $request->setTargetGrpcProxyResource($targetGrpcProxyResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['target_grpc_proxy'] = $targetGrpcProxy; - 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('Patch', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/TargetHttpProxiesGapicClient.php b/Compute/src/V1/Gapic/TargetHttpProxiesGapicClient.php deleted file mode 100644 index aa610ad143e9..000000000000 --- a/Compute/src/V1/Gapic/TargetHttpProxiesGapicClient.php +++ /dev/null @@ -1,768 +0,0 @@ -aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $targetHttpProxiesClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $targetHttpProxiesClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\TargetHttpProxiesClient}. - */ -class TargetHttpProxiesGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.TargetHttpProxies'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/target_http_proxies_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/target_http_proxies_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/target_http_proxies_rest_client_config.php', - ], - ], - 'operationsClientClass' => GlobalOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an GlobalOperationsClient object with the same endpoint as $this. - * - * @return GlobalOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetGlobalOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteGlobalOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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); - } - - /** - * Retrieves the list of all TargetHttpProxy resources, regional and global, available to the specified project. To prevent failure, Google recommends that you set the `returnPartialSuccess` parameter to `true`. - * - * Sample code: - * ``` - * $targetHttpProxiesClient = new TargetHttpProxiesClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $targetHttpProxiesClient->aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $targetHttpProxiesClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $targetHttpProxiesClient->close(); - * } - * ``` - * - * @param string $project Name of the project scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type bool $includeAllScopes - * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type int $serviceProjectNumber - * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable 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 aggregatedList($project, array $optionalArgs = []) - { - $request = new AggregatedListTargetHttpProxiesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['includeAllScopes'])) { - $request->setIncludeAllScopes($optionalArgs['includeAllScopes']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - if (isset($optionalArgs['serviceProjectNumber'])) { - $request->setServiceProjectNumber($optionalArgs['serviceProjectNumber']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('AggregatedList', $optionalArgs, TargetHttpProxyAggregatedList::class, $request); - } - - /** - * Deletes the specified TargetHttpProxy resource. - * - * Sample code: - * ``` - * $targetHttpProxiesClient = new TargetHttpProxiesClient(); - * try { - * $project = 'project'; - * $targetHttpProxy = 'target_http_proxy'; - * $operationResponse = $targetHttpProxiesClient->delete($project, $targetHttpProxy); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $targetHttpProxiesClient->delete($project, $targetHttpProxy); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $targetHttpProxiesClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $targetHttpProxiesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $targetHttpProxy Name of the TargetHttpProxy resource to delete. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($project, $targetHttpProxy, array $optionalArgs = []) - { - $request = new DeleteTargetHttpProxyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setTargetHttpProxy($targetHttpProxy); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['target_http_proxy'] = $targetHttpProxy; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns the specified TargetHttpProxy resource. - * - * Sample code: - * ``` - * $targetHttpProxiesClient = new TargetHttpProxiesClient(); - * try { - * $project = 'project'; - * $targetHttpProxy = 'target_http_proxy'; - * $response = $targetHttpProxiesClient->get($project, $targetHttpProxy); - * } finally { - * $targetHttpProxiesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $targetHttpProxy Name of the TargetHttpProxy resource to return. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\TargetHttpProxy - * - * @throws ApiException if the remote call fails - */ - public function get($project, $targetHttpProxy, array $optionalArgs = []) - { - $request = new GetTargetHttpProxyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setTargetHttpProxy($targetHttpProxy); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['target_http_proxy'] = $targetHttpProxy; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', TargetHttpProxy::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates a TargetHttpProxy resource in the specified project using the data included in the request. - * - * Sample code: - * ``` - * $targetHttpProxiesClient = new TargetHttpProxiesClient(); - * try { - * $project = 'project'; - * $targetHttpProxyResource = new TargetHttpProxy(); - * $operationResponse = $targetHttpProxiesClient->insert($project, $targetHttpProxyResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $targetHttpProxiesClient->insert($project, $targetHttpProxyResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $targetHttpProxiesClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $targetHttpProxiesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param TargetHttpProxy $targetHttpProxyResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 insert($project, $targetHttpProxyResource, array $optionalArgs = []) - { - $request = new InsertTargetHttpProxyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setTargetHttpProxyResource($targetHttpProxyResource); - $requestParamHeaders['project'] = $project; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Retrieves the list of TargetHttpProxy resources available to the specified project. - * - * Sample code: - * ``` - * $targetHttpProxiesClient = new TargetHttpProxiesClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $targetHttpProxiesClient->list($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $targetHttpProxiesClient->list($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $targetHttpProxiesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, array $optionalArgs = []) - { - $request = new ListTargetHttpProxiesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, TargetHttpProxyList::class, $request); - } - - /** - * Patches the specified TargetHttpProxy resource with the data included in the request. This method supports PATCH semantics and uses JSON merge patch format and processing rules. - * - * Sample code: - * ``` - * $targetHttpProxiesClient = new TargetHttpProxiesClient(); - * try { - * $project = 'project'; - * $targetHttpProxy = 'target_http_proxy'; - * $targetHttpProxyResource = new TargetHttpProxy(); - * $operationResponse = $targetHttpProxiesClient->patch($project, $targetHttpProxy, $targetHttpProxyResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $targetHttpProxiesClient->patch($project, $targetHttpProxy, $targetHttpProxyResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $targetHttpProxiesClient->resumeOperation($operationName, 'patch'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $targetHttpProxiesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $targetHttpProxy Name of the TargetHttpProxy resource to patch. - * @param TargetHttpProxy $targetHttpProxyResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 patch($project, $targetHttpProxy, $targetHttpProxyResource, array $optionalArgs = []) - { - $request = new PatchTargetHttpProxyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setTargetHttpProxy($targetHttpProxy); - $request->setTargetHttpProxyResource($targetHttpProxyResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['target_http_proxy'] = $targetHttpProxy; - 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('Patch', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Changes the URL map for TargetHttpProxy. - * - * Sample code: - * ``` - * $targetHttpProxiesClient = new TargetHttpProxiesClient(); - * try { - * $project = 'project'; - * $targetHttpProxy = 'target_http_proxy'; - * $urlMapReferenceResource = new UrlMapReference(); - * $operationResponse = $targetHttpProxiesClient->setUrlMap($project, $targetHttpProxy, $urlMapReferenceResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $targetHttpProxiesClient->setUrlMap($project, $targetHttpProxy, $urlMapReferenceResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $targetHttpProxiesClient->resumeOperation($operationName, 'setUrlMap'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $targetHttpProxiesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $targetHttpProxy Name of the TargetHttpProxy to set a URL map for. - * @param UrlMapReference $urlMapReferenceResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 setUrlMap($project, $targetHttpProxy, $urlMapReferenceResource, array $optionalArgs = []) - { - $request = new SetUrlMapTargetHttpProxyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setTargetHttpProxy($targetHttpProxy); - $request->setUrlMapReferenceResource($urlMapReferenceResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['target_http_proxy'] = $targetHttpProxy; - 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('SetUrlMap', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/TargetHttpsProxiesGapicClient.php b/Compute/src/V1/Gapic/TargetHttpsProxiesGapicClient.php deleted file mode 100644 index 6617725e820c..000000000000 --- a/Compute/src/V1/Gapic/TargetHttpsProxiesGapicClient.php +++ /dev/null @@ -1,1076 +0,0 @@ -aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $targetHttpsProxiesClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $targetHttpsProxiesClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\TargetHttpsProxiesClient}. - */ -class TargetHttpsProxiesGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.TargetHttpsProxies'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/target_https_proxies_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/target_https_proxies_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/target_https_proxies_rest_client_config.php', - ], - ], - 'operationsClientClass' => GlobalOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an GlobalOperationsClient object with the same endpoint as $this. - * - * @return GlobalOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetGlobalOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteGlobalOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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); - } - - /** - * Retrieves the list of all TargetHttpsProxy resources, regional and global, available to the specified project. To prevent failure, Google recommends that you set the `returnPartialSuccess` parameter to `true`. - * - * Sample code: - * ``` - * $targetHttpsProxiesClient = new TargetHttpsProxiesClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $targetHttpsProxiesClient->aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $targetHttpsProxiesClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $targetHttpsProxiesClient->close(); - * } - * ``` - * - * @param string $project Name of the project scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type bool $includeAllScopes - * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type int $serviceProjectNumber - * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable 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 aggregatedList($project, array $optionalArgs = []) - { - $request = new AggregatedListTargetHttpsProxiesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['includeAllScopes'])) { - $request->setIncludeAllScopes($optionalArgs['includeAllScopes']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - if (isset($optionalArgs['serviceProjectNumber'])) { - $request->setServiceProjectNumber($optionalArgs['serviceProjectNumber']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('AggregatedList', $optionalArgs, TargetHttpsProxyAggregatedList::class, $request); - } - - /** - * Deletes the specified TargetHttpsProxy resource. - * - * Sample code: - * ``` - * $targetHttpsProxiesClient = new TargetHttpsProxiesClient(); - * try { - * $project = 'project'; - * $targetHttpsProxy = 'target_https_proxy'; - * $operationResponse = $targetHttpsProxiesClient->delete($project, $targetHttpsProxy); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $targetHttpsProxiesClient->delete($project, $targetHttpsProxy); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $targetHttpsProxiesClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $targetHttpsProxiesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $targetHttpsProxy Name of the TargetHttpsProxy resource to delete. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($project, $targetHttpsProxy, array $optionalArgs = []) - { - $request = new DeleteTargetHttpsProxyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setTargetHttpsProxy($targetHttpsProxy); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['target_https_proxy'] = $targetHttpsProxy; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns the specified TargetHttpsProxy resource. - * - * Sample code: - * ``` - * $targetHttpsProxiesClient = new TargetHttpsProxiesClient(); - * try { - * $project = 'project'; - * $targetHttpsProxy = 'target_https_proxy'; - * $response = $targetHttpsProxiesClient->get($project, $targetHttpsProxy); - * } finally { - * $targetHttpsProxiesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $targetHttpsProxy Name of the TargetHttpsProxy resource to return. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\TargetHttpsProxy - * - * @throws ApiException if the remote call fails - */ - public function get($project, $targetHttpsProxy, array $optionalArgs = []) - { - $request = new GetTargetHttpsProxyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setTargetHttpsProxy($targetHttpsProxy); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['target_https_proxy'] = $targetHttpsProxy; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', TargetHttpsProxy::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates a TargetHttpsProxy resource in the specified project using the data included in the request. - * - * Sample code: - * ``` - * $targetHttpsProxiesClient = new TargetHttpsProxiesClient(); - * try { - * $project = 'project'; - * $targetHttpsProxyResource = new TargetHttpsProxy(); - * $operationResponse = $targetHttpsProxiesClient->insert($project, $targetHttpsProxyResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $targetHttpsProxiesClient->insert($project, $targetHttpsProxyResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $targetHttpsProxiesClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $targetHttpsProxiesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param TargetHttpsProxy $targetHttpsProxyResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 insert($project, $targetHttpsProxyResource, array $optionalArgs = []) - { - $request = new InsertTargetHttpsProxyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setTargetHttpsProxyResource($targetHttpsProxyResource); - $requestParamHeaders['project'] = $project; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Retrieves the list of TargetHttpsProxy resources available to the specified project. - * - * Sample code: - * ``` - * $targetHttpsProxiesClient = new TargetHttpsProxiesClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $targetHttpsProxiesClient->list($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $targetHttpsProxiesClient->list($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $targetHttpsProxiesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, array $optionalArgs = []) - { - $request = new ListTargetHttpsProxiesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, TargetHttpsProxyList::class, $request); - } - - /** - * Patches the specified TargetHttpsProxy resource with the data included in the request. This method supports PATCH semantics and uses JSON merge patch format and processing rules. - * - * Sample code: - * ``` - * $targetHttpsProxiesClient = new TargetHttpsProxiesClient(); - * try { - * $project = 'project'; - * $targetHttpsProxy = 'target_https_proxy'; - * $targetHttpsProxyResource = new TargetHttpsProxy(); - * $operationResponse = $targetHttpsProxiesClient->patch($project, $targetHttpsProxy, $targetHttpsProxyResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $targetHttpsProxiesClient->patch($project, $targetHttpsProxy, $targetHttpsProxyResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $targetHttpsProxiesClient->resumeOperation($operationName, 'patch'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $targetHttpsProxiesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $targetHttpsProxy Name of the TargetHttpsProxy resource to patch. - * @param TargetHttpsProxy $targetHttpsProxyResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 patch($project, $targetHttpsProxy, $targetHttpsProxyResource, array $optionalArgs = []) - { - $request = new PatchTargetHttpsProxyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setTargetHttpsProxy($targetHttpsProxy); - $request->setTargetHttpsProxyResource($targetHttpsProxyResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['target_https_proxy'] = $targetHttpsProxy; - 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('Patch', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Changes the Certificate Map for TargetHttpsProxy. - * - * Sample code: - * ``` - * $targetHttpsProxiesClient = new TargetHttpsProxiesClient(); - * try { - * $project = 'project'; - * $targetHttpsProxiesSetCertificateMapRequestResource = new TargetHttpsProxiesSetCertificateMapRequest(); - * $targetHttpsProxy = 'target_https_proxy'; - * $operationResponse = $targetHttpsProxiesClient->setCertificateMap($project, $targetHttpsProxiesSetCertificateMapRequestResource, $targetHttpsProxy); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $targetHttpsProxiesClient->setCertificateMap($project, $targetHttpsProxiesSetCertificateMapRequestResource, $targetHttpsProxy); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $targetHttpsProxiesClient->resumeOperation($operationName, 'setCertificateMap'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $targetHttpsProxiesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param TargetHttpsProxiesSetCertificateMapRequest $targetHttpsProxiesSetCertificateMapRequestResource The body resource for this request - * @param string $targetHttpsProxy Name of the TargetHttpsProxy resource whose CertificateMap is to be set. The name must be 1-63 characters long, and comply with RFC1035. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 setCertificateMap($project, $targetHttpsProxiesSetCertificateMapRequestResource, $targetHttpsProxy, array $optionalArgs = []) - { - $request = new SetCertificateMapTargetHttpsProxyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setTargetHttpsProxiesSetCertificateMapRequestResource($targetHttpsProxiesSetCertificateMapRequestResource); - $request->setTargetHttpsProxy($targetHttpsProxy); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['target_https_proxy'] = $targetHttpsProxy; - 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('SetCertificateMap', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Sets the QUIC override policy for TargetHttpsProxy. - * - * Sample code: - * ``` - * $targetHttpsProxiesClient = new TargetHttpsProxiesClient(); - * try { - * $project = 'project'; - * $targetHttpsProxiesSetQuicOverrideRequestResource = new TargetHttpsProxiesSetQuicOverrideRequest(); - * $targetHttpsProxy = 'target_https_proxy'; - * $operationResponse = $targetHttpsProxiesClient->setQuicOverride($project, $targetHttpsProxiesSetQuicOverrideRequestResource, $targetHttpsProxy); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $targetHttpsProxiesClient->setQuicOverride($project, $targetHttpsProxiesSetQuicOverrideRequestResource, $targetHttpsProxy); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $targetHttpsProxiesClient->resumeOperation($operationName, 'setQuicOverride'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $targetHttpsProxiesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param TargetHttpsProxiesSetQuicOverrideRequest $targetHttpsProxiesSetQuicOverrideRequestResource The body resource for this request - * @param string $targetHttpsProxy Name of the TargetHttpsProxy resource to set the QUIC override policy for. The name should conform to RFC1035. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 setQuicOverride($project, $targetHttpsProxiesSetQuicOverrideRequestResource, $targetHttpsProxy, array $optionalArgs = []) - { - $request = new SetQuicOverrideTargetHttpsProxyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setTargetHttpsProxiesSetQuicOverrideRequestResource($targetHttpsProxiesSetQuicOverrideRequestResource); - $request->setTargetHttpsProxy($targetHttpsProxy); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['target_https_proxy'] = $targetHttpsProxy; - 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('SetQuicOverride', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Replaces SslCertificates for TargetHttpsProxy. - * - * Sample code: - * ``` - * $targetHttpsProxiesClient = new TargetHttpsProxiesClient(); - * try { - * $project = 'project'; - * $targetHttpsProxiesSetSslCertificatesRequestResource = new TargetHttpsProxiesSetSslCertificatesRequest(); - * $targetHttpsProxy = 'target_https_proxy'; - * $operationResponse = $targetHttpsProxiesClient->setSslCertificates($project, $targetHttpsProxiesSetSslCertificatesRequestResource, $targetHttpsProxy); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $targetHttpsProxiesClient->setSslCertificates($project, $targetHttpsProxiesSetSslCertificatesRequestResource, $targetHttpsProxy); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $targetHttpsProxiesClient->resumeOperation($operationName, 'setSslCertificates'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $targetHttpsProxiesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param TargetHttpsProxiesSetSslCertificatesRequest $targetHttpsProxiesSetSslCertificatesRequestResource The body resource for this request - * @param string $targetHttpsProxy Name of the TargetHttpsProxy resource to set an SslCertificates resource for. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 setSslCertificates($project, $targetHttpsProxiesSetSslCertificatesRequestResource, $targetHttpsProxy, array $optionalArgs = []) - { - $request = new SetSslCertificatesTargetHttpsProxyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setTargetHttpsProxiesSetSslCertificatesRequestResource($targetHttpsProxiesSetSslCertificatesRequestResource); - $request->setTargetHttpsProxy($targetHttpsProxy); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['target_https_proxy'] = $targetHttpsProxy; - 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('SetSslCertificates', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Sets the SSL policy for TargetHttpsProxy. The SSL policy specifies the server-side support for SSL features. This affects connections between clients and the HTTPS proxy load balancer. They do not affect the connection between the load balancer and the backends. - * - * Sample code: - * ``` - * $targetHttpsProxiesClient = new TargetHttpsProxiesClient(); - * try { - * $project = 'project'; - * $sslPolicyReferenceResource = new SslPolicyReference(); - * $targetHttpsProxy = 'target_https_proxy'; - * $operationResponse = $targetHttpsProxiesClient->setSslPolicy($project, $sslPolicyReferenceResource, $targetHttpsProxy); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $targetHttpsProxiesClient->setSslPolicy($project, $sslPolicyReferenceResource, $targetHttpsProxy); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $targetHttpsProxiesClient->resumeOperation($operationName, 'setSslPolicy'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $targetHttpsProxiesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param SslPolicyReference $sslPolicyReferenceResource The body resource for this request - * @param string $targetHttpsProxy Name of the TargetHttpsProxy resource whose SSL policy is to be set. The name must be 1-63 characters long, and comply with RFC1035. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 setSslPolicy($project, $sslPolicyReferenceResource, $targetHttpsProxy, array $optionalArgs = []) - { - $request = new SetSslPolicyTargetHttpsProxyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setSslPolicyReferenceResource($sslPolicyReferenceResource); - $request->setTargetHttpsProxy($targetHttpsProxy); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['target_https_proxy'] = $targetHttpsProxy; - 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('SetSslPolicy', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Changes the URL map for TargetHttpsProxy. - * - * Sample code: - * ``` - * $targetHttpsProxiesClient = new TargetHttpsProxiesClient(); - * try { - * $project = 'project'; - * $targetHttpsProxy = 'target_https_proxy'; - * $urlMapReferenceResource = new UrlMapReference(); - * $operationResponse = $targetHttpsProxiesClient->setUrlMap($project, $targetHttpsProxy, $urlMapReferenceResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $targetHttpsProxiesClient->setUrlMap($project, $targetHttpsProxy, $urlMapReferenceResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $targetHttpsProxiesClient->resumeOperation($operationName, 'setUrlMap'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $targetHttpsProxiesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $targetHttpsProxy Name of the TargetHttpsProxy resource whose URL map is to be set. - * @param UrlMapReference $urlMapReferenceResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 setUrlMap($project, $targetHttpsProxy, $urlMapReferenceResource, array $optionalArgs = []) - { - $request = new SetUrlMapTargetHttpsProxyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setTargetHttpsProxy($targetHttpsProxy); - $request->setUrlMapReferenceResource($urlMapReferenceResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['target_https_proxy'] = $targetHttpsProxy; - 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('SetUrlMap', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/TargetInstancesGapicClient.php b/Compute/src/V1/Gapic/TargetInstancesGapicClient.php deleted file mode 100644 index 7c57d1419c4f..000000000000 --- a/Compute/src/V1/Gapic/TargetInstancesGapicClient.php +++ /dev/null @@ -1,713 +0,0 @@ -aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $targetInstancesClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $targetInstancesClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\TargetInstancesClient}. - */ -class TargetInstancesGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.TargetInstances'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/target_instances_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/target_instances_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/target_instances_rest_client_config.php', - ], - ], - 'operationsClientClass' => ZoneOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an ZoneOperationsClient object with the same endpoint as $this. - * - * @return ZoneOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getZone', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetZoneOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteZoneOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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); - } - - /** - * Retrieves an aggregated list of target instances. To prevent failure, Google recommends that you set the `returnPartialSuccess` parameter to `true`. - * - * Sample code: - * ``` - * $targetInstancesClient = new TargetInstancesClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $targetInstancesClient->aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $targetInstancesClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $targetInstancesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type bool $includeAllScopes - * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type int $serviceProjectNumber - * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable 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 aggregatedList($project, array $optionalArgs = []) - { - $request = new AggregatedListTargetInstancesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['includeAllScopes'])) { - $request->setIncludeAllScopes($optionalArgs['includeAllScopes']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - if (isset($optionalArgs['serviceProjectNumber'])) { - $request->setServiceProjectNumber($optionalArgs['serviceProjectNumber']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('AggregatedList', $optionalArgs, TargetInstanceAggregatedList::class, $request); - } - - /** - * Deletes the specified TargetInstance resource. - * - * Sample code: - * ``` - * $targetInstancesClient = new TargetInstancesClient(); - * try { - * $project = 'project'; - * $targetInstance = 'target_instance'; - * $zone = 'zone'; - * $operationResponse = $targetInstancesClient->delete($project, $targetInstance, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $targetInstancesClient->delete($project, $targetInstance, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $targetInstancesClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $targetInstancesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $targetInstance Name of the TargetInstance resource to delete. - * @param string $zone Name of the zone scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($project, $targetInstance, $zone, array $optionalArgs = []) - { - $request = new DeleteTargetInstanceRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setTargetInstance($targetInstance); - $request->setZone($zone); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['target_instance'] = $targetInstance; - $requestParamHeaders['zone'] = $zone; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns the specified TargetInstance resource. - * - * Sample code: - * ``` - * $targetInstancesClient = new TargetInstancesClient(); - * try { - * $project = 'project'; - * $targetInstance = 'target_instance'; - * $zone = 'zone'; - * $response = $targetInstancesClient->get($project, $targetInstance, $zone); - * } finally { - * $targetInstancesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $targetInstance Name of the TargetInstance resource to return. - * @param string $zone Name of the zone scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\TargetInstance - * - * @throws ApiException if the remote call fails - */ - public function get($project, $targetInstance, $zone, array $optionalArgs = []) - { - $request = new GetTargetInstanceRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setTargetInstance($targetInstance); - $request->setZone($zone); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['target_instance'] = $targetInstance; - $requestParamHeaders['zone'] = $zone; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', TargetInstance::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates a TargetInstance resource in the specified project and zone using the data included in the request. - * - * Sample code: - * ``` - * $targetInstancesClient = new TargetInstancesClient(); - * try { - * $project = 'project'; - * $targetInstanceResource = new TargetInstance(); - * $zone = 'zone'; - * $operationResponse = $targetInstancesClient->insert($project, $targetInstanceResource, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $targetInstancesClient->insert($project, $targetInstanceResource, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $targetInstancesClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $targetInstancesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param TargetInstance $targetInstanceResource The body resource for this request - * @param string $zone Name of the zone scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 insert($project, $targetInstanceResource, $zone, array $optionalArgs = []) - { - $request = new InsertTargetInstanceRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setTargetInstanceResource($targetInstanceResource); - $request->setZone($zone); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Retrieves a list of TargetInstance resources available to the specified project and zone. - * - * Sample code: - * ``` - * $targetInstancesClient = new TargetInstancesClient(); - * try { - * $project = 'project'; - * $zone = 'zone'; - * // Iterate over pages of elements - * $pagedResponse = $targetInstancesClient->list($project, $zone); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $targetInstancesClient->list($project, $zone); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $targetInstancesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $zone Name of the zone scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, $zone, array $optionalArgs = []) - { - $request = new ListTargetInstancesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, TargetInstanceList::class, $request); - } - - /** - * Sets the Google Cloud Armor security policy for the specified target instance. For more information, see Google Cloud Armor Overview - * - * Sample code: - * ``` - * $targetInstancesClient = new TargetInstancesClient(); - * try { - * $project = 'project'; - * $securityPolicyReferenceResource = new SecurityPolicyReference(); - * $targetInstance = 'target_instance'; - * $zone = 'zone'; - * $operationResponse = $targetInstancesClient->setSecurityPolicy($project, $securityPolicyReferenceResource, $targetInstance, $zone); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $targetInstancesClient->setSecurityPolicy($project, $securityPolicyReferenceResource, $targetInstance, $zone); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $targetInstancesClient->resumeOperation($operationName, 'setSecurityPolicy'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $targetInstancesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param SecurityPolicyReference $securityPolicyReferenceResource The body resource for this request - * @param string $targetInstance Name of the TargetInstance resource to which the security policy should be set. The name should conform to RFC1035. - * @param string $zone Name of the zone scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 setSecurityPolicy($project, $securityPolicyReferenceResource, $targetInstance, $zone, array $optionalArgs = []) - { - $request = new SetSecurityPolicyTargetInstanceRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setSecurityPolicyReferenceResource($securityPolicyReferenceResource); - $request->setTargetInstance($targetInstance); - $request->setZone($zone); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['target_instance'] = $targetInstance; - $requestParamHeaders['zone'] = $zone; - 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('SetSecurityPolicy', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/TargetPoolsGapicClient.php b/Compute/src/V1/Gapic/TargetPoolsGapicClient.php deleted file mode 100644 index a4ccc5de71dc..000000000000 --- a/Compute/src/V1/Gapic/TargetPoolsGapicClient.php +++ /dev/null @@ -1,1191 +0,0 @@ -addHealthCheck($project, $region, $targetPool, $targetPoolsAddHealthCheckRequestResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $targetPoolsClient->addHealthCheck($project, $region, $targetPool, $targetPoolsAddHealthCheckRequestResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $targetPoolsClient->resumeOperation($operationName, 'addHealthCheck'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $targetPoolsClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\TargetPoolsClient}. - */ -class TargetPoolsGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.TargetPools'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/target_pools_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/target_pools_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/target_pools_rest_client_config.php', - ], - ], - 'operationsClientClass' => RegionOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an RegionOperationsClient object with the same endpoint as $this. - * - * @return RegionOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetRegionOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteRegionOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method for the - * supported options. - * @type callable $clientCertSource - * A callable which returns the client cert as a string. This can be used to - * provide a certificate and private key to the transport layer for mTLS. - * } - * - * @throws ValidationException - */ - public function __construct(array $options = []) - { - $clientOptions = $this->buildClientOptions($options); - $this->setClientOptions($clientOptions); - $this->operationsClient = $this->createOperationsClient($clientOptions); - } - - /** - * Adds health check URLs to a target pool. - * - * Sample code: - * ``` - * $targetPoolsClient = new TargetPoolsClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $targetPool = 'target_pool'; - * $targetPoolsAddHealthCheckRequestResource = new TargetPoolsAddHealthCheckRequest(); - * $operationResponse = $targetPoolsClient->addHealthCheck($project, $region, $targetPool, $targetPoolsAddHealthCheckRequestResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $targetPoolsClient->addHealthCheck($project, $region, $targetPool, $targetPoolsAddHealthCheckRequestResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $targetPoolsClient->resumeOperation($operationName, 'addHealthCheck'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $targetPoolsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param string $targetPool Name of the target pool to add a health check to. - * @param TargetPoolsAddHealthCheckRequest $targetPoolsAddHealthCheckRequestResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 addHealthCheck($project, $region, $targetPool, $targetPoolsAddHealthCheckRequestResource, array $optionalArgs = []) - { - $request = new AddHealthCheckTargetPoolRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setTargetPool($targetPool); - $request->setTargetPoolsAddHealthCheckRequestResource($targetPoolsAddHealthCheckRequestResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['target_pool'] = $targetPool; - 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('AddHealthCheck', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Adds an instance to a target pool. - * - * Sample code: - * ``` - * $targetPoolsClient = new TargetPoolsClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $targetPool = 'target_pool'; - * $targetPoolsAddInstanceRequestResource = new TargetPoolsAddInstanceRequest(); - * $operationResponse = $targetPoolsClient->addInstance($project, $region, $targetPool, $targetPoolsAddInstanceRequestResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $targetPoolsClient->addInstance($project, $region, $targetPool, $targetPoolsAddInstanceRequestResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $targetPoolsClient->resumeOperation($operationName, 'addInstance'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $targetPoolsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param string $targetPool Name of the TargetPool resource to add instances to. - * @param TargetPoolsAddInstanceRequest $targetPoolsAddInstanceRequestResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 addInstance($project, $region, $targetPool, $targetPoolsAddInstanceRequestResource, array $optionalArgs = []) - { - $request = new AddInstanceTargetPoolRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setTargetPool($targetPool); - $request->setTargetPoolsAddInstanceRequestResource($targetPoolsAddInstanceRequestResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['target_pool'] = $targetPool; - 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('AddInstance', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Retrieves an aggregated list of target pools. To prevent failure, Google recommends that you set the `returnPartialSuccess` parameter to `true`. - * - * Sample code: - * ``` - * $targetPoolsClient = new TargetPoolsClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $targetPoolsClient->aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $targetPoolsClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $targetPoolsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type bool $includeAllScopes - * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type int $serviceProjectNumber - * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable 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 aggregatedList($project, array $optionalArgs = []) - { - $request = new AggregatedListTargetPoolsRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['includeAllScopes'])) { - $request->setIncludeAllScopes($optionalArgs['includeAllScopes']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - if (isset($optionalArgs['serviceProjectNumber'])) { - $request->setServiceProjectNumber($optionalArgs['serviceProjectNumber']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('AggregatedList', $optionalArgs, TargetPoolAggregatedList::class, $request); - } - - /** - * Deletes the specified target pool. - * - * Sample code: - * ``` - * $targetPoolsClient = new TargetPoolsClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $targetPool = 'target_pool'; - * $operationResponse = $targetPoolsClient->delete($project, $region, $targetPool); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $targetPoolsClient->delete($project, $region, $targetPool); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $targetPoolsClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $targetPoolsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param string $targetPool Name of the TargetPool resource to delete. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($project, $region, $targetPool, array $optionalArgs = []) - { - $request = new DeleteTargetPoolRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setTargetPool($targetPool); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['target_pool'] = $targetPool; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns the specified target pool. - * - * Sample code: - * ``` - * $targetPoolsClient = new TargetPoolsClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $targetPool = 'target_pool'; - * $response = $targetPoolsClient->get($project, $region, $targetPool); - * } finally { - * $targetPoolsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param string $targetPool Name of the TargetPool resource to return. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\TargetPool - * - * @throws ApiException if the remote call fails - */ - public function get($project, $region, $targetPool, array $optionalArgs = []) - { - $request = new GetTargetPoolRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setTargetPool($targetPool); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['target_pool'] = $targetPool; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', TargetPool::class, $optionalArgs, $request)->wait(); - } - - /** - * Gets the most recent health check results for each IP for the instance that is referenced by the given target pool. - * - * Sample code: - * ``` - * $targetPoolsClient = new TargetPoolsClient(); - * try { - * $instanceReferenceResource = new InstanceReference(); - * $project = 'project'; - * $region = 'region'; - * $targetPool = 'target_pool'; - * $response = $targetPoolsClient->getHealth($instanceReferenceResource, $project, $region, $targetPool); - * } finally { - * $targetPoolsClient->close(); - * } - * ``` - * - * @param InstanceReference $instanceReferenceResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param string $targetPool Name of the TargetPool resource to which the queried instance belongs. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\TargetPoolInstanceHealth - * - * @throws ApiException if the remote call fails - */ - public function getHealth($instanceReferenceResource, $project, $region, $targetPool, array $optionalArgs = []) - { - $request = new GetHealthTargetPoolRequest(); - $requestParamHeaders = []; - $request->setInstanceReferenceResource($instanceReferenceResource); - $request->setProject($project); - $request->setRegion($region); - $request->setTargetPool($targetPool); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['target_pool'] = $targetPool; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetHealth', TargetPoolInstanceHealth::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates a target pool in the specified project and region using the data included in the request. - * - * Sample code: - * ``` - * $targetPoolsClient = new TargetPoolsClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $targetPoolResource = new TargetPool(); - * $operationResponse = $targetPoolsClient->insert($project, $region, $targetPoolResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $targetPoolsClient->insert($project, $region, $targetPoolResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $targetPoolsClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $targetPoolsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param TargetPool $targetPoolResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 insert($project, $region, $targetPoolResource, array $optionalArgs = []) - { - $request = new InsertTargetPoolRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setTargetPoolResource($targetPoolResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Retrieves a list of target pools available to the specified project and region. - * - * Sample code: - * ``` - * $targetPoolsClient = new TargetPoolsClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * // Iterate over pages of elements - * $pagedResponse = $targetPoolsClient->list($project, $region); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $targetPoolsClient->list($project, $region); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $targetPoolsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, $region, array $optionalArgs = []) - { - $request = new ListTargetPoolsRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, TargetPoolList::class, $request); - } - - /** - * Removes health check URL from a target pool. - * - * Sample code: - * ``` - * $targetPoolsClient = new TargetPoolsClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $targetPool = 'target_pool'; - * $targetPoolsRemoveHealthCheckRequestResource = new TargetPoolsRemoveHealthCheckRequest(); - * $operationResponse = $targetPoolsClient->removeHealthCheck($project, $region, $targetPool, $targetPoolsRemoveHealthCheckRequestResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $targetPoolsClient->removeHealthCheck($project, $region, $targetPool, $targetPoolsRemoveHealthCheckRequestResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $targetPoolsClient->resumeOperation($operationName, 'removeHealthCheck'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $targetPoolsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region for this request. - * @param string $targetPool Name of the target pool to remove health checks from. - * @param TargetPoolsRemoveHealthCheckRequest $targetPoolsRemoveHealthCheckRequestResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 removeHealthCheck($project, $region, $targetPool, $targetPoolsRemoveHealthCheckRequestResource, array $optionalArgs = []) - { - $request = new RemoveHealthCheckTargetPoolRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setTargetPool($targetPool); - $request->setTargetPoolsRemoveHealthCheckRequestResource($targetPoolsRemoveHealthCheckRequestResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['target_pool'] = $targetPool; - 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('RemoveHealthCheck', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Removes instance URL from a target pool. - * - * Sample code: - * ``` - * $targetPoolsClient = new TargetPoolsClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $targetPool = 'target_pool'; - * $targetPoolsRemoveInstanceRequestResource = new TargetPoolsRemoveInstanceRequest(); - * $operationResponse = $targetPoolsClient->removeInstance($project, $region, $targetPool, $targetPoolsRemoveInstanceRequestResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $targetPoolsClient->removeInstance($project, $region, $targetPool, $targetPoolsRemoveInstanceRequestResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $targetPoolsClient->resumeOperation($operationName, 'removeInstance'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $targetPoolsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param string $targetPool Name of the TargetPool resource to remove instances from. - * @param TargetPoolsRemoveInstanceRequest $targetPoolsRemoveInstanceRequestResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 removeInstance($project, $region, $targetPool, $targetPoolsRemoveInstanceRequestResource, array $optionalArgs = []) - { - $request = new RemoveInstanceTargetPoolRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setTargetPool($targetPool); - $request->setTargetPoolsRemoveInstanceRequestResource($targetPoolsRemoveInstanceRequestResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['target_pool'] = $targetPool; - 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('RemoveInstance', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Changes a backup target pool's configurations. - * - * Sample code: - * ``` - * $targetPoolsClient = new TargetPoolsClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $targetPool = 'target_pool'; - * $targetReferenceResource = new TargetReference(); - * $operationResponse = $targetPoolsClient->setBackup($project, $region, $targetPool, $targetReferenceResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $targetPoolsClient->setBackup($project, $region, $targetPool, $targetReferenceResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $targetPoolsClient->resumeOperation($operationName, 'setBackup'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $targetPoolsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param string $targetPool Name of the TargetPool resource to set a backup pool for. - * @param TargetReference $targetReferenceResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type float $failoverRatio - * New failoverRatio value for the target pool. - * @type string $requestId - * 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. 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 setBackup($project, $region, $targetPool, $targetReferenceResource, array $optionalArgs = []) - { - $request = new SetBackupTargetPoolRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setTargetPool($targetPool); - $request->setTargetReferenceResource($targetReferenceResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['target_pool'] = $targetPool; - if (isset($optionalArgs['failoverRatio'])) { - $request->setFailoverRatio($optionalArgs['failoverRatio']); - } - - 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('SetBackup', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Sets the Google Cloud Armor security policy for the specified target pool. For more information, see Google Cloud Armor Overview - * - * Sample code: - * ``` - * $targetPoolsClient = new TargetPoolsClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $securityPolicyReferenceResource = new SecurityPolicyReference(); - * $targetPool = 'target_pool'; - * $operationResponse = $targetPoolsClient->setSecurityPolicy($project, $region, $securityPolicyReferenceResource, $targetPool); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $targetPoolsClient->setSecurityPolicy($project, $region, $securityPolicyReferenceResource, $targetPool); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $targetPoolsClient->resumeOperation($operationName, 'setSecurityPolicy'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $targetPoolsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region scoping this request. - * @param SecurityPolicyReference $securityPolicyReferenceResource The body resource for this request - * @param string $targetPool Name of the TargetPool resource to which the security policy should be set. The name should conform to RFC1035. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 setSecurityPolicy($project, $region, $securityPolicyReferenceResource, $targetPool, array $optionalArgs = []) - { - $request = new SetSecurityPolicyTargetPoolRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setSecurityPolicyReferenceResource($securityPolicyReferenceResource); - $request->setTargetPool($targetPool); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['target_pool'] = $targetPool; - 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('SetSecurityPolicy', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/TargetSslProxiesGapicClient.php b/Compute/src/V1/Gapic/TargetSslProxiesGapicClient.php deleted file mode 100644 index 1c4ab27ed15d..000000000000 --- a/Compute/src/V1/Gapic/TargetSslProxiesGapicClient.php +++ /dev/null @@ -1,914 +0,0 @@ -delete($project, $targetSslProxy); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $targetSslProxiesClient->delete($project, $targetSslProxy); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $targetSslProxiesClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $targetSslProxiesClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\TargetSslProxiesClient}. - */ -class TargetSslProxiesGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.TargetSslProxies'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/target_ssl_proxies_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/target_ssl_proxies_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/target_ssl_proxies_rest_client_config.php', - ], - ], - 'operationsClientClass' => GlobalOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an GlobalOperationsClient object with the same endpoint as $this. - * - * @return GlobalOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetGlobalOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteGlobalOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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 the specified TargetSslProxy resource. - * - * Sample code: - * ``` - * $targetSslProxiesClient = new TargetSslProxiesClient(); - * try { - * $project = 'project'; - * $targetSslProxy = 'target_ssl_proxy'; - * $operationResponse = $targetSslProxiesClient->delete($project, $targetSslProxy); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $targetSslProxiesClient->delete($project, $targetSslProxy); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $targetSslProxiesClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $targetSslProxiesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $targetSslProxy Name of the TargetSslProxy resource to delete. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($project, $targetSslProxy, array $optionalArgs = []) - { - $request = new DeleteTargetSslProxyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setTargetSslProxy($targetSslProxy); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['target_ssl_proxy'] = $targetSslProxy; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns the specified TargetSslProxy resource. - * - * Sample code: - * ``` - * $targetSslProxiesClient = new TargetSslProxiesClient(); - * try { - * $project = 'project'; - * $targetSslProxy = 'target_ssl_proxy'; - * $response = $targetSslProxiesClient->get($project, $targetSslProxy); - * } finally { - * $targetSslProxiesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $targetSslProxy Name of the TargetSslProxy resource to return. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\TargetSslProxy - * - * @throws ApiException if the remote call fails - */ - public function get($project, $targetSslProxy, array $optionalArgs = []) - { - $request = new GetTargetSslProxyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setTargetSslProxy($targetSslProxy); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['target_ssl_proxy'] = $targetSslProxy; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', TargetSslProxy::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates a TargetSslProxy resource in the specified project using the data included in the request. - * - * Sample code: - * ``` - * $targetSslProxiesClient = new TargetSslProxiesClient(); - * try { - * $project = 'project'; - * $targetSslProxyResource = new TargetSslProxy(); - * $operationResponse = $targetSslProxiesClient->insert($project, $targetSslProxyResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $targetSslProxiesClient->insert($project, $targetSslProxyResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $targetSslProxiesClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $targetSslProxiesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param TargetSslProxy $targetSslProxyResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 insert($project, $targetSslProxyResource, array $optionalArgs = []) - { - $request = new InsertTargetSslProxyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setTargetSslProxyResource($targetSslProxyResource); - $requestParamHeaders['project'] = $project; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Retrieves the list of TargetSslProxy resources available to the specified project. - * - * Sample code: - * ``` - * $targetSslProxiesClient = new TargetSslProxiesClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $targetSslProxiesClient->list($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $targetSslProxiesClient->list($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $targetSslProxiesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, array $optionalArgs = []) - { - $request = new ListTargetSslProxiesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, TargetSslProxyList::class, $request); - } - - /** - * Changes the BackendService for TargetSslProxy. - * - * Sample code: - * ``` - * $targetSslProxiesClient = new TargetSslProxiesClient(); - * try { - * $project = 'project'; - * $targetSslProxiesSetBackendServiceRequestResource = new TargetSslProxiesSetBackendServiceRequest(); - * $targetSslProxy = 'target_ssl_proxy'; - * $operationResponse = $targetSslProxiesClient->setBackendService($project, $targetSslProxiesSetBackendServiceRequestResource, $targetSslProxy); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $targetSslProxiesClient->setBackendService($project, $targetSslProxiesSetBackendServiceRequestResource, $targetSslProxy); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $targetSslProxiesClient->resumeOperation($operationName, 'setBackendService'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $targetSslProxiesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param TargetSslProxiesSetBackendServiceRequest $targetSslProxiesSetBackendServiceRequestResource The body resource for this request - * @param string $targetSslProxy Name of the TargetSslProxy resource whose BackendService resource is to be set. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 setBackendService($project, $targetSslProxiesSetBackendServiceRequestResource, $targetSslProxy, array $optionalArgs = []) - { - $request = new SetBackendServiceTargetSslProxyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setTargetSslProxiesSetBackendServiceRequestResource($targetSslProxiesSetBackendServiceRequestResource); - $request->setTargetSslProxy($targetSslProxy); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['target_ssl_proxy'] = $targetSslProxy; - 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('SetBackendService', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Changes the Certificate Map for TargetSslProxy. - * - * Sample code: - * ``` - * $targetSslProxiesClient = new TargetSslProxiesClient(); - * try { - * $project = 'project'; - * $targetSslProxiesSetCertificateMapRequestResource = new TargetSslProxiesSetCertificateMapRequest(); - * $targetSslProxy = 'target_ssl_proxy'; - * $operationResponse = $targetSslProxiesClient->setCertificateMap($project, $targetSslProxiesSetCertificateMapRequestResource, $targetSslProxy); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $targetSslProxiesClient->setCertificateMap($project, $targetSslProxiesSetCertificateMapRequestResource, $targetSslProxy); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $targetSslProxiesClient->resumeOperation($operationName, 'setCertificateMap'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $targetSslProxiesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param TargetSslProxiesSetCertificateMapRequest $targetSslProxiesSetCertificateMapRequestResource The body resource for this request - * @param string $targetSslProxy Name of the TargetSslProxy resource whose CertificateMap is to be set. The name must be 1-63 characters long, and comply with RFC1035. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 setCertificateMap($project, $targetSslProxiesSetCertificateMapRequestResource, $targetSslProxy, array $optionalArgs = []) - { - $request = new SetCertificateMapTargetSslProxyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setTargetSslProxiesSetCertificateMapRequestResource($targetSslProxiesSetCertificateMapRequestResource); - $request->setTargetSslProxy($targetSslProxy); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['target_ssl_proxy'] = $targetSslProxy; - 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('SetCertificateMap', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Changes the ProxyHeaderType for TargetSslProxy. - * - * Sample code: - * ``` - * $targetSslProxiesClient = new TargetSslProxiesClient(); - * try { - * $project = 'project'; - * $targetSslProxiesSetProxyHeaderRequestResource = new TargetSslProxiesSetProxyHeaderRequest(); - * $targetSslProxy = 'target_ssl_proxy'; - * $operationResponse = $targetSslProxiesClient->setProxyHeader($project, $targetSslProxiesSetProxyHeaderRequestResource, $targetSslProxy); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $targetSslProxiesClient->setProxyHeader($project, $targetSslProxiesSetProxyHeaderRequestResource, $targetSslProxy); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $targetSslProxiesClient->resumeOperation($operationName, 'setProxyHeader'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $targetSslProxiesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param TargetSslProxiesSetProxyHeaderRequest $targetSslProxiesSetProxyHeaderRequestResource The body resource for this request - * @param string $targetSslProxy Name of the TargetSslProxy resource whose ProxyHeader is to be set. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 setProxyHeader($project, $targetSslProxiesSetProxyHeaderRequestResource, $targetSslProxy, array $optionalArgs = []) - { - $request = new SetProxyHeaderTargetSslProxyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setTargetSslProxiesSetProxyHeaderRequestResource($targetSslProxiesSetProxyHeaderRequestResource); - $request->setTargetSslProxy($targetSslProxy); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['target_ssl_proxy'] = $targetSslProxy; - 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('SetProxyHeader', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Changes SslCertificates for TargetSslProxy. - * - * Sample code: - * ``` - * $targetSslProxiesClient = new TargetSslProxiesClient(); - * try { - * $project = 'project'; - * $targetSslProxiesSetSslCertificatesRequestResource = new TargetSslProxiesSetSslCertificatesRequest(); - * $targetSslProxy = 'target_ssl_proxy'; - * $operationResponse = $targetSslProxiesClient->setSslCertificates($project, $targetSslProxiesSetSslCertificatesRequestResource, $targetSslProxy); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $targetSslProxiesClient->setSslCertificates($project, $targetSslProxiesSetSslCertificatesRequestResource, $targetSslProxy); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $targetSslProxiesClient->resumeOperation($operationName, 'setSslCertificates'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $targetSslProxiesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param TargetSslProxiesSetSslCertificatesRequest $targetSslProxiesSetSslCertificatesRequestResource The body resource for this request - * @param string $targetSslProxy Name of the TargetSslProxy resource whose SslCertificate resource is to be set. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 setSslCertificates($project, $targetSslProxiesSetSslCertificatesRequestResource, $targetSslProxy, array $optionalArgs = []) - { - $request = new SetSslCertificatesTargetSslProxyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setTargetSslProxiesSetSslCertificatesRequestResource($targetSslProxiesSetSslCertificatesRequestResource); - $request->setTargetSslProxy($targetSslProxy); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['target_ssl_proxy'] = $targetSslProxy; - 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('SetSslCertificates', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Sets the SSL policy for TargetSslProxy. The SSL policy specifies the server-side support for SSL features. This affects connections between clients and the load balancer. They do not affect the connection between the load balancer and the backends. - * - * Sample code: - * ``` - * $targetSslProxiesClient = new TargetSslProxiesClient(); - * try { - * $project = 'project'; - * $sslPolicyReferenceResource = new SslPolicyReference(); - * $targetSslProxy = 'target_ssl_proxy'; - * $operationResponse = $targetSslProxiesClient->setSslPolicy($project, $sslPolicyReferenceResource, $targetSslProxy); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $targetSslProxiesClient->setSslPolicy($project, $sslPolicyReferenceResource, $targetSslProxy); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $targetSslProxiesClient->resumeOperation($operationName, 'setSslPolicy'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $targetSslProxiesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param SslPolicyReference $sslPolicyReferenceResource The body resource for this request - * @param string $targetSslProxy Name of the TargetSslProxy resource whose SSL policy is to be set. The name must be 1-63 characters long, and comply with RFC1035. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 setSslPolicy($project, $sslPolicyReferenceResource, $targetSslProxy, array $optionalArgs = []) - { - $request = new SetSslPolicyTargetSslProxyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setSslPolicyReferenceResource($sslPolicyReferenceResource); - $request->setTargetSslProxy($targetSslProxy); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['target_ssl_proxy'] = $targetSslProxy; - 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('SetSslPolicy', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/TargetTcpProxiesGapicClient.php b/Compute/src/V1/Gapic/TargetTcpProxiesGapicClient.php deleted file mode 100644 index b2e76f34ec01..000000000000 --- a/Compute/src/V1/Gapic/TargetTcpProxiesGapicClient.php +++ /dev/null @@ -1,769 +0,0 @@ -aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $targetTcpProxiesClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $targetTcpProxiesClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\TargetTcpProxiesClient}. - */ -class TargetTcpProxiesGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.TargetTcpProxies'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/target_tcp_proxies_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/target_tcp_proxies_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/target_tcp_proxies_rest_client_config.php', - ], - ], - 'operationsClientClass' => GlobalOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an GlobalOperationsClient object with the same endpoint as $this. - * - * @return GlobalOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetGlobalOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteGlobalOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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); - } - - /** - * Retrieves the list of all TargetTcpProxy resources, regional and global, available to the specified project. To prevent failure, Google recommends that you set the `returnPartialSuccess` parameter to `true`. - * - * Sample code: - * ``` - * $targetTcpProxiesClient = new TargetTcpProxiesClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $targetTcpProxiesClient->aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $targetTcpProxiesClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $targetTcpProxiesClient->close(); - * } - * ``` - * - * @param string $project Name of the project scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type bool $includeAllScopes - * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type int $serviceProjectNumber - * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable 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 aggregatedList($project, array $optionalArgs = []) - { - $request = new AggregatedListTargetTcpProxiesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['includeAllScopes'])) { - $request->setIncludeAllScopes($optionalArgs['includeAllScopes']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - if (isset($optionalArgs['serviceProjectNumber'])) { - $request->setServiceProjectNumber($optionalArgs['serviceProjectNumber']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('AggregatedList', $optionalArgs, TargetTcpProxyAggregatedList::class, $request); - } - - /** - * Deletes the specified TargetTcpProxy resource. - * - * Sample code: - * ``` - * $targetTcpProxiesClient = new TargetTcpProxiesClient(); - * try { - * $project = 'project'; - * $targetTcpProxy = 'target_tcp_proxy'; - * $operationResponse = $targetTcpProxiesClient->delete($project, $targetTcpProxy); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $targetTcpProxiesClient->delete($project, $targetTcpProxy); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $targetTcpProxiesClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $targetTcpProxiesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $targetTcpProxy Name of the TargetTcpProxy resource to delete. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($project, $targetTcpProxy, array $optionalArgs = []) - { - $request = new DeleteTargetTcpProxyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setTargetTcpProxy($targetTcpProxy); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['target_tcp_proxy'] = $targetTcpProxy; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns the specified TargetTcpProxy resource. - * - * Sample code: - * ``` - * $targetTcpProxiesClient = new TargetTcpProxiesClient(); - * try { - * $project = 'project'; - * $targetTcpProxy = 'target_tcp_proxy'; - * $response = $targetTcpProxiesClient->get($project, $targetTcpProxy); - * } finally { - * $targetTcpProxiesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $targetTcpProxy Name of the TargetTcpProxy resource to return. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\TargetTcpProxy - * - * @throws ApiException if the remote call fails - */ - public function get($project, $targetTcpProxy, array $optionalArgs = []) - { - $request = new GetTargetTcpProxyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setTargetTcpProxy($targetTcpProxy); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['target_tcp_proxy'] = $targetTcpProxy; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', TargetTcpProxy::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates a TargetTcpProxy resource in the specified project using the data included in the request. - * - * Sample code: - * ``` - * $targetTcpProxiesClient = new TargetTcpProxiesClient(); - * try { - * $project = 'project'; - * $targetTcpProxyResource = new TargetTcpProxy(); - * $operationResponse = $targetTcpProxiesClient->insert($project, $targetTcpProxyResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $targetTcpProxiesClient->insert($project, $targetTcpProxyResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $targetTcpProxiesClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $targetTcpProxiesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param TargetTcpProxy $targetTcpProxyResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 insert($project, $targetTcpProxyResource, array $optionalArgs = []) - { - $request = new InsertTargetTcpProxyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setTargetTcpProxyResource($targetTcpProxyResource); - $requestParamHeaders['project'] = $project; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Retrieves the list of TargetTcpProxy resources available to the specified project. - * - * Sample code: - * ``` - * $targetTcpProxiesClient = new TargetTcpProxiesClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $targetTcpProxiesClient->list($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $targetTcpProxiesClient->list($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $targetTcpProxiesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, array $optionalArgs = []) - { - $request = new ListTargetTcpProxiesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, TargetTcpProxyList::class, $request); - } - - /** - * Changes the BackendService for TargetTcpProxy. - * - * Sample code: - * ``` - * $targetTcpProxiesClient = new TargetTcpProxiesClient(); - * try { - * $project = 'project'; - * $targetTcpProxiesSetBackendServiceRequestResource = new TargetTcpProxiesSetBackendServiceRequest(); - * $targetTcpProxy = 'target_tcp_proxy'; - * $operationResponse = $targetTcpProxiesClient->setBackendService($project, $targetTcpProxiesSetBackendServiceRequestResource, $targetTcpProxy); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $targetTcpProxiesClient->setBackendService($project, $targetTcpProxiesSetBackendServiceRequestResource, $targetTcpProxy); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $targetTcpProxiesClient->resumeOperation($operationName, 'setBackendService'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $targetTcpProxiesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param TargetTcpProxiesSetBackendServiceRequest $targetTcpProxiesSetBackendServiceRequestResource The body resource for this request - * @param string $targetTcpProxy Name of the TargetTcpProxy resource whose BackendService resource is to be set. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 setBackendService($project, $targetTcpProxiesSetBackendServiceRequestResource, $targetTcpProxy, array $optionalArgs = []) - { - $request = new SetBackendServiceTargetTcpProxyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setTargetTcpProxiesSetBackendServiceRequestResource($targetTcpProxiesSetBackendServiceRequestResource); - $request->setTargetTcpProxy($targetTcpProxy); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['target_tcp_proxy'] = $targetTcpProxy; - 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('SetBackendService', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Changes the ProxyHeaderType for TargetTcpProxy. - * - * Sample code: - * ``` - * $targetTcpProxiesClient = new TargetTcpProxiesClient(); - * try { - * $project = 'project'; - * $targetTcpProxiesSetProxyHeaderRequestResource = new TargetTcpProxiesSetProxyHeaderRequest(); - * $targetTcpProxy = 'target_tcp_proxy'; - * $operationResponse = $targetTcpProxiesClient->setProxyHeader($project, $targetTcpProxiesSetProxyHeaderRequestResource, $targetTcpProxy); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $targetTcpProxiesClient->setProxyHeader($project, $targetTcpProxiesSetProxyHeaderRequestResource, $targetTcpProxy); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $targetTcpProxiesClient->resumeOperation($operationName, 'setProxyHeader'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $targetTcpProxiesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param TargetTcpProxiesSetProxyHeaderRequest $targetTcpProxiesSetProxyHeaderRequestResource The body resource for this request - * @param string $targetTcpProxy Name of the TargetTcpProxy resource whose ProxyHeader is to be set. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 setProxyHeader($project, $targetTcpProxiesSetProxyHeaderRequestResource, $targetTcpProxy, array $optionalArgs = []) - { - $request = new SetProxyHeaderTargetTcpProxyRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setTargetTcpProxiesSetProxyHeaderRequestResource($targetTcpProxiesSetProxyHeaderRequestResource); - $request->setTargetTcpProxy($targetTcpProxy); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['target_tcp_proxy'] = $targetTcpProxy; - 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('SetProxyHeader', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/TargetVpnGatewaysGapicClient.php b/Compute/src/V1/Gapic/TargetVpnGatewaysGapicClient.php deleted file mode 100644 index 1d44d6ca2788..000000000000 --- a/Compute/src/V1/Gapic/TargetVpnGatewaysGapicClient.php +++ /dev/null @@ -1,713 +0,0 @@ -aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $targetVpnGatewaysClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $targetVpnGatewaysClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\TargetVpnGatewaysClient}. - */ -class TargetVpnGatewaysGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.TargetVpnGateways'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/target_vpn_gateways_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/target_vpn_gateways_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/target_vpn_gateways_rest_client_config.php', - ], - ], - 'operationsClientClass' => RegionOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an RegionOperationsClient object with the same endpoint as $this. - * - * @return RegionOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetRegionOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteRegionOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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); - } - - /** - * Retrieves an aggregated list of target VPN gateways. To prevent failure, Google recommends that you set the `returnPartialSuccess` parameter to `true`. - * - * Sample code: - * ``` - * $targetVpnGatewaysClient = new TargetVpnGatewaysClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $targetVpnGatewaysClient->aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $targetVpnGatewaysClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $targetVpnGatewaysClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type bool $includeAllScopes - * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type int $serviceProjectNumber - * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable 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 aggregatedList($project, array $optionalArgs = []) - { - $request = new AggregatedListTargetVpnGatewaysRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['includeAllScopes'])) { - $request->setIncludeAllScopes($optionalArgs['includeAllScopes']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - if (isset($optionalArgs['serviceProjectNumber'])) { - $request->setServiceProjectNumber($optionalArgs['serviceProjectNumber']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('AggregatedList', $optionalArgs, TargetVpnGatewayAggregatedList::class, $request); - } - - /** - * Deletes the specified target VPN gateway. - * - * Sample code: - * ``` - * $targetVpnGatewaysClient = new TargetVpnGatewaysClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $targetVpnGateway = 'target_vpn_gateway'; - * $operationResponse = $targetVpnGatewaysClient->delete($project, $region, $targetVpnGateway); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $targetVpnGatewaysClient->delete($project, $region, $targetVpnGateway); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $targetVpnGatewaysClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $targetVpnGatewaysClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region for this request. - * @param string $targetVpnGateway Name of the target VPN gateway to delete. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($project, $region, $targetVpnGateway, array $optionalArgs = []) - { - $request = new DeleteTargetVpnGatewayRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setTargetVpnGateway($targetVpnGateway); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['target_vpn_gateway'] = $targetVpnGateway; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns the specified target VPN gateway. - * - * Sample code: - * ``` - * $targetVpnGatewaysClient = new TargetVpnGatewaysClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $targetVpnGateway = 'target_vpn_gateway'; - * $response = $targetVpnGatewaysClient->get($project, $region, $targetVpnGateway); - * } finally { - * $targetVpnGatewaysClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region for this request. - * @param string $targetVpnGateway Name of the target VPN gateway to return. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\TargetVpnGateway - * - * @throws ApiException if the remote call fails - */ - public function get($project, $region, $targetVpnGateway, array $optionalArgs = []) - { - $request = new GetTargetVpnGatewayRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setTargetVpnGateway($targetVpnGateway); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['target_vpn_gateway'] = $targetVpnGateway; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', TargetVpnGateway::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates a target VPN gateway in the specified project and region using the data included in the request. - * - * Sample code: - * ``` - * $targetVpnGatewaysClient = new TargetVpnGatewaysClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $targetVpnGatewayResource = new TargetVpnGateway(); - * $operationResponse = $targetVpnGatewaysClient->insert($project, $region, $targetVpnGatewayResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $targetVpnGatewaysClient->insert($project, $region, $targetVpnGatewayResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $targetVpnGatewaysClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $targetVpnGatewaysClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region for this request. - * @param TargetVpnGateway $targetVpnGatewayResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 insert($project, $region, $targetVpnGatewayResource, array $optionalArgs = []) - { - $request = new InsertTargetVpnGatewayRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setTargetVpnGatewayResource($targetVpnGatewayResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Retrieves a list of target VPN gateways available to the specified project and region. - * - * Sample code: - * ``` - * $targetVpnGatewaysClient = new TargetVpnGatewaysClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * // Iterate over pages of elements - * $pagedResponse = $targetVpnGatewaysClient->list($project, $region); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $targetVpnGatewaysClient->list($project, $region); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $targetVpnGatewaysClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, $region, array $optionalArgs = []) - { - $request = new ListTargetVpnGatewaysRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, TargetVpnGatewayList::class, $request); - } - - /** - * Sets the labels on a TargetVpnGateway. To learn more about labels, read the Labeling Resources documentation. - * - * Sample code: - * ``` - * $targetVpnGatewaysClient = new TargetVpnGatewaysClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $regionSetLabelsRequestResource = new RegionSetLabelsRequest(); - * $resource = 'resource'; - * $operationResponse = $targetVpnGatewaysClient->setLabels($project, $region, $regionSetLabelsRequestResource, $resource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $targetVpnGatewaysClient->setLabels($project, $region, $regionSetLabelsRequestResource, $resource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $targetVpnGatewaysClient->resumeOperation($operationName, 'setLabels'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $targetVpnGatewaysClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region The region for this request. - * @param RegionSetLabelsRequest $regionSetLabelsRequestResource The body resource for this request - * @param string $resource Name or id of the resource for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 setLabels($project, $region, $regionSetLabelsRequestResource, $resource, array $optionalArgs = []) - { - $request = new SetLabelsTargetVpnGatewayRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setRegionSetLabelsRequestResource($regionSetLabelsRequestResource); - $request->setResource($resource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['resource'] = $resource; - 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('SetLabels', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/UrlMapsGapicClient.php b/Compute/src/V1/Gapic/UrlMapsGapicClient.php deleted file mode 100644 index 6ae3a001a96d..000000000000 --- a/Compute/src/V1/Gapic/UrlMapsGapicClient.php +++ /dev/null @@ -1,893 +0,0 @@ -aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $urlMapsClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $urlMapsClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\UrlMapsClient}. - */ -class UrlMapsGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.UrlMaps'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/url_maps_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/url_maps_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/url_maps_rest_client_config.php', - ], - ], - 'operationsClientClass' => GlobalOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an GlobalOperationsClient object with the same endpoint as $this. - * - * @return GlobalOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetGlobalOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteGlobalOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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); - } - - /** - * Retrieves the list of all UrlMap resources, regional and global, available to the specified project. To prevent failure, Google recommends that you set the `returnPartialSuccess` parameter to `true`. - * - * Sample code: - * ``` - * $urlMapsClient = new UrlMapsClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $urlMapsClient->aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $urlMapsClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $urlMapsClient->close(); - * } - * ``` - * - * @param string $project Name of the project scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type bool $includeAllScopes - * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type int $serviceProjectNumber - * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable 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 aggregatedList($project, array $optionalArgs = []) - { - $request = new AggregatedListUrlMapsRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['includeAllScopes'])) { - $request->setIncludeAllScopes($optionalArgs['includeAllScopes']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - if (isset($optionalArgs['serviceProjectNumber'])) { - $request->setServiceProjectNumber($optionalArgs['serviceProjectNumber']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('AggregatedList', $optionalArgs, UrlMapsAggregatedList::class, $request); - } - - /** - * Deletes the specified UrlMap resource. - * - * Sample code: - * ``` - * $urlMapsClient = new UrlMapsClient(); - * try { - * $project = 'project'; - * $urlMap = 'url_map'; - * $operationResponse = $urlMapsClient->delete($project, $urlMap); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $urlMapsClient->delete($project, $urlMap); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $urlMapsClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $urlMapsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $urlMap Name of the UrlMap resource to delete. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($project, $urlMap, array $optionalArgs = []) - { - $request = new DeleteUrlMapRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setUrlMap($urlMap); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['url_map'] = $urlMap; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns the specified UrlMap resource. - * - * Sample code: - * ``` - * $urlMapsClient = new UrlMapsClient(); - * try { - * $project = 'project'; - * $urlMap = 'url_map'; - * $response = $urlMapsClient->get($project, $urlMap); - * } finally { - * $urlMapsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $urlMap Name of the UrlMap resource to return. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\UrlMap - * - * @throws ApiException if the remote call fails - */ - public function get($project, $urlMap, array $optionalArgs = []) - { - $request = new GetUrlMapRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setUrlMap($urlMap); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['url_map'] = $urlMap; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', UrlMap::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates a UrlMap resource in the specified project using the data included in the request. - * - * Sample code: - * ``` - * $urlMapsClient = new UrlMapsClient(); - * try { - * $project = 'project'; - * $urlMapResource = new UrlMap(); - * $operationResponse = $urlMapsClient->insert($project, $urlMapResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $urlMapsClient->insert($project, $urlMapResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $urlMapsClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $urlMapsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param UrlMap $urlMapResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 insert($project, $urlMapResource, array $optionalArgs = []) - { - $request = new InsertUrlMapRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setUrlMapResource($urlMapResource); - $requestParamHeaders['project'] = $project; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Initiates a cache invalidation operation, invalidating the specified path, scoped to the specified UrlMap. For more information, see [Invalidating cached content](https://cloud.google.com/cdn/docs/invalidating-cached-content). - * - * Sample code: - * ``` - * $urlMapsClient = new UrlMapsClient(); - * try { - * $cacheInvalidationRuleResource = new CacheInvalidationRule(); - * $project = 'project'; - * $urlMap = 'url_map'; - * $operationResponse = $urlMapsClient->invalidateCache($cacheInvalidationRuleResource, $project, $urlMap); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $urlMapsClient->invalidateCache($cacheInvalidationRuleResource, $project, $urlMap); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $urlMapsClient->resumeOperation($operationName, 'invalidateCache'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $urlMapsClient->close(); - * } - * ``` - * - * @param CacheInvalidationRule $cacheInvalidationRuleResource The body resource for this request - * @param string $project Project ID for this request. - * @param string $urlMap Name of the UrlMap scoping this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 invalidateCache($cacheInvalidationRuleResource, $project, $urlMap, array $optionalArgs = []) - { - $request = new InvalidateCacheUrlMapRequest(); - $requestParamHeaders = []; - $request->setCacheInvalidationRuleResource($cacheInvalidationRuleResource); - $request->setProject($project); - $request->setUrlMap($urlMap); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['url_map'] = $urlMap; - 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('InvalidateCache', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Retrieves the list of UrlMap resources available to the specified project. - * - * Sample code: - * ``` - * $urlMapsClient = new UrlMapsClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $urlMapsClient->list($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $urlMapsClient->list($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $urlMapsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, array $optionalArgs = []) - { - $request = new ListUrlMapsRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, UrlMapList::class, $request); - } - - /** - * Patches the specified UrlMap resource with the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. - * - * Sample code: - * ``` - * $urlMapsClient = new UrlMapsClient(); - * try { - * $project = 'project'; - * $urlMap = 'url_map'; - * $urlMapResource = new UrlMap(); - * $operationResponse = $urlMapsClient->patch($project, $urlMap, $urlMapResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $urlMapsClient->patch($project, $urlMap, $urlMapResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $urlMapsClient->resumeOperation($operationName, 'patch'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $urlMapsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $urlMap Name of the UrlMap resource to patch. - * @param UrlMap $urlMapResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 patch($project, $urlMap, $urlMapResource, array $optionalArgs = []) - { - $request = new PatchUrlMapRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setUrlMap($urlMap); - $request->setUrlMapResource($urlMapResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['url_map'] = $urlMap; - 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('Patch', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Updates the specified UrlMap resource with the data included in the request. - * - * Sample code: - * ``` - * $urlMapsClient = new UrlMapsClient(); - * try { - * $project = 'project'; - * $urlMap = 'url_map'; - * $urlMapResource = new UrlMap(); - * $operationResponse = $urlMapsClient->update($project, $urlMap, $urlMapResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $urlMapsClient->update($project, $urlMap, $urlMapResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $urlMapsClient->resumeOperation($operationName, 'update'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $urlMapsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $urlMap Name of the UrlMap resource to update. - * @param UrlMap $urlMapResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 update($project, $urlMap, $urlMapResource, array $optionalArgs = []) - { - $request = new UpdateUrlMapRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setUrlMap($urlMap); - $request->setUrlMapResource($urlMapResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['url_map'] = $urlMap; - 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('Update', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Runs static validation for the UrlMap. In particular, the tests of the provided UrlMap will be run. Calling this method does NOT create the UrlMap. - * - * Sample code: - * ``` - * $urlMapsClient = new UrlMapsClient(); - * try { - * $project = 'project'; - * $urlMap = 'url_map'; - * $urlMapsValidateRequestResource = new UrlMapsValidateRequest(); - * $response = $urlMapsClient->validate($project, $urlMap, $urlMapsValidateRequestResource); - * } finally { - * $urlMapsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $urlMap Name of the UrlMap resource to be validated as. - * @param UrlMapsValidateRequest $urlMapsValidateRequestResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\UrlMapsValidateResponse - * - * @throws ApiException if the remote call fails - */ - public function validate($project, $urlMap, $urlMapsValidateRequestResource, array $optionalArgs = []) - { - $request = new ValidateUrlMapRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setUrlMap($urlMap); - $request->setUrlMapsValidateRequestResource($urlMapsValidateRequestResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['url_map'] = $urlMap; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Validate', UrlMapsValidateResponse::class, $optionalArgs, $request)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/VpnGatewaysGapicClient.php b/Compute/src/V1/Gapic/VpnGatewaysGapicClient.php deleted file mode 100644 index 94b7c418f9af..000000000000 --- a/Compute/src/V1/Gapic/VpnGatewaysGapicClient.php +++ /dev/null @@ -1,815 +0,0 @@ -aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $vpnGatewaysClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $vpnGatewaysClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\VpnGatewaysClient}. - */ -class VpnGatewaysGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.VpnGateways'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/vpn_gateways_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/vpn_gateways_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/vpn_gateways_rest_client_config.php', - ], - ], - 'operationsClientClass' => RegionOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an RegionOperationsClient object with the same endpoint as $this. - * - * @return RegionOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetRegionOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteRegionOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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); - } - - /** - * Retrieves an aggregated list of VPN gateways. To prevent failure, Google recommends that you set the `returnPartialSuccess` parameter to `true`. - * - * Sample code: - * ``` - * $vpnGatewaysClient = new VpnGatewaysClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $vpnGatewaysClient->aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $vpnGatewaysClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $vpnGatewaysClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type bool $includeAllScopes - * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type int $serviceProjectNumber - * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable 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 aggregatedList($project, array $optionalArgs = []) - { - $request = new AggregatedListVpnGatewaysRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['includeAllScopes'])) { - $request->setIncludeAllScopes($optionalArgs['includeAllScopes']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - if (isset($optionalArgs['serviceProjectNumber'])) { - $request->setServiceProjectNumber($optionalArgs['serviceProjectNumber']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('AggregatedList', $optionalArgs, VpnGatewayAggregatedList::class, $request); - } - - /** - * Deletes the specified VPN gateway. - * - * Sample code: - * ``` - * $vpnGatewaysClient = new VpnGatewaysClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $vpnGateway = 'vpn_gateway'; - * $operationResponse = $vpnGatewaysClient->delete($project, $region, $vpnGateway); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $vpnGatewaysClient->delete($project, $region, $vpnGateway); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vpnGatewaysClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vpnGatewaysClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region for this request. - * @param string $vpnGateway Name of the VPN gateway to delete. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($project, $region, $vpnGateway, array $optionalArgs = []) - { - $request = new DeleteVpnGatewayRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setVpnGateway($vpnGateway); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['vpn_gateway'] = $vpnGateway; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns the specified VPN gateway. - * - * Sample code: - * ``` - * $vpnGatewaysClient = new VpnGatewaysClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $vpnGateway = 'vpn_gateway'; - * $response = $vpnGatewaysClient->get($project, $region, $vpnGateway); - * } finally { - * $vpnGatewaysClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region for this request. - * @param string $vpnGateway Name of the VPN gateway to return. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\VpnGateway - * - * @throws ApiException if the remote call fails - */ - public function get($project, $region, $vpnGateway, array $optionalArgs = []) - { - $request = new GetVpnGatewayRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setVpnGateway($vpnGateway); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['vpn_gateway'] = $vpnGateway; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', VpnGateway::class, $optionalArgs, $request)->wait(); - } - - /** - * Returns the status for the specified VPN gateway. - * - * Sample code: - * ``` - * $vpnGatewaysClient = new VpnGatewaysClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $vpnGateway = 'vpn_gateway'; - * $response = $vpnGatewaysClient->getStatus($project, $region, $vpnGateway); - * } finally { - * $vpnGatewaysClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region for this request. - * @param string $vpnGateway Name of the VPN gateway to return. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\VpnGatewaysGetStatusResponse - * - * @throws ApiException if the remote call fails - */ - public function getStatus($project, $region, $vpnGateway, array $optionalArgs = []) - { - $request = new GetStatusVpnGatewayRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setVpnGateway($vpnGateway); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['vpn_gateway'] = $vpnGateway; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetStatus', VpnGatewaysGetStatusResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates a VPN gateway in the specified project and region using the data included in the request. - * - * Sample code: - * ``` - * $vpnGatewaysClient = new VpnGatewaysClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $vpnGatewayResource = new VpnGateway(); - * $operationResponse = $vpnGatewaysClient->insert($project, $region, $vpnGatewayResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $vpnGatewaysClient->insert($project, $region, $vpnGatewayResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vpnGatewaysClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vpnGatewaysClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region for this request. - * @param VpnGateway $vpnGatewayResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 insert($project, $region, $vpnGatewayResource, array $optionalArgs = []) - { - $request = new InsertVpnGatewayRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setVpnGatewayResource($vpnGatewayResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Retrieves a list of VPN gateways available to the specified project and region. - * - * Sample code: - * ``` - * $vpnGatewaysClient = new VpnGatewaysClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * // Iterate over pages of elements - * $pagedResponse = $vpnGatewaysClient->list($project, $region); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $vpnGatewaysClient->list($project, $region); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $vpnGatewaysClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, $region, array $optionalArgs = []) - { - $request = new ListVpnGatewaysRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, VpnGatewayList::class, $request); - } - - /** - * Sets the labels on a VpnGateway. To learn more about labels, read the Labeling Resources documentation. - * - * Sample code: - * ``` - * $vpnGatewaysClient = new VpnGatewaysClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $regionSetLabelsRequestResource = new RegionSetLabelsRequest(); - * $resource = 'resource'; - * $operationResponse = $vpnGatewaysClient->setLabels($project, $region, $regionSetLabelsRequestResource, $resource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $vpnGatewaysClient->setLabels($project, $region, $regionSetLabelsRequestResource, $resource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vpnGatewaysClient->resumeOperation($operationName, 'setLabels'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vpnGatewaysClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region The region for this request. - * @param RegionSetLabelsRequest $regionSetLabelsRequestResource The body resource for this request - * @param string $resource Name or id of the resource for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 setLabels($project, $region, $regionSetLabelsRequestResource, $resource, array $optionalArgs = []) - { - $request = new SetLabelsVpnGatewayRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setRegionSetLabelsRequestResource($regionSetLabelsRequestResource); - $request->setResource($resource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['resource'] = $resource; - 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('SetLabels', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns permissions that a caller has on the specified resource. - * - * Sample code: - * ``` - * $vpnGatewaysClient = new VpnGatewaysClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $resource = 'resource'; - * $testPermissionsRequestResource = new TestPermissionsRequest(); - * $response = $vpnGatewaysClient->testIamPermissions($project, $region, $resource, $testPermissionsRequestResource); - * } finally { - * $vpnGatewaysClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region The name of the region for this request. - * @param string $resource Name or id of the resource for this request. - * @param TestPermissionsRequest $testPermissionsRequestResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\TestPermissionsResponse - * - * @throws ApiException if the remote call fails - */ - public function testIamPermissions($project, $region, $resource, $testPermissionsRequestResource, array $optionalArgs = []) - { - $request = new TestIamPermissionsVpnGatewayRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setResource($resource); - $request->setTestPermissionsRequestResource($testPermissionsRequestResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['resource'] = $resource; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('TestIamPermissions', TestPermissionsResponse::class, $optionalArgs, $request)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/VpnTunnelsGapicClient.php b/Compute/src/V1/Gapic/VpnTunnelsGapicClient.php deleted file mode 100644 index 51f56846d73c..000000000000 --- a/Compute/src/V1/Gapic/VpnTunnelsGapicClient.php +++ /dev/null @@ -1,713 +0,0 @@ -aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $vpnTunnelsClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $vpnTunnelsClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\VpnTunnelsClient}. - */ -class VpnTunnelsGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.VpnTunnels'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private $operationsClient; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/vpn_tunnels_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/vpn_tunnels_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/vpn_tunnels_rest_client_config.php', - ], - ], - 'operationsClientClass' => RegionOperationsClient::class, - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * Return an RegionOperationsClient object with the same endpoint as $this. - * - * @return RegionOperationsClient - */ - public function getOperationsClient() - { - return $this->operationsClient; - } - - /** Return the default longrunning operation descriptor config. */ - private function getDefaultOperationDescriptor() - { - return [ - 'additionalArgumentMethods' => [ - 'getProject', - 'getRegion', - ], - 'getOperationMethod' => 'get', - 'cancelOperationMethod' => null, - 'deleteOperationMethod' => 'delete', - 'operationErrorCodeMethod' => 'getHttpErrorStatusCode', - 'operationErrorMessageMethod' => 'getHttpErrorMessage', - 'operationNameMethod' => 'getName', - 'operationStatusMethod' => 'getStatus', - 'operationStatusDoneValue' => \Google\Cloud\Compute\V1\Operation\Status::DONE, - 'getOperationRequest' => '\Google\Cloud\Compute\V1\GetRegionOperationRequest', - 'cancelOperationRequest' => null, - 'deleteOperationRequest' => '\Google\Cloud\Compute\V1\DeleteRegionOperationRequest', - ]; - } - - /** - * 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'] : $this->getDefaultOperationDescriptor(); - $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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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); - } - - /** - * Retrieves an aggregated list of VPN tunnels. To prevent failure, Google recommends that you set the `returnPartialSuccess` parameter to `true`. - * - * Sample code: - * ``` - * $vpnTunnelsClient = new VpnTunnelsClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $vpnTunnelsClient->aggregatedList($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $key => $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $vpnTunnelsClient->aggregatedList($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $vpnTunnelsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type bool $includeAllScopes - * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type int $serviceProjectNumber - * The Shared VPC service project id or service project number for which aggregated list request is invoked for subnetworks list-usable 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 aggregatedList($project, array $optionalArgs = []) - { - $request = new AggregatedListVpnTunnelsRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['includeAllScopes'])) { - $request->setIncludeAllScopes($optionalArgs['includeAllScopes']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - if (isset($optionalArgs['serviceProjectNumber'])) { - $request->setServiceProjectNumber($optionalArgs['serviceProjectNumber']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('AggregatedList', $optionalArgs, VpnTunnelAggregatedList::class, $request); - } - - /** - * Deletes the specified VpnTunnel resource. - * - * Sample code: - * ``` - * $vpnTunnelsClient = new VpnTunnelsClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $vpnTunnel = 'vpn_tunnel'; - * $operationResponse = $vpnTunnelsClient->delete($project, $region, $vpnTunnel); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $vpnTunnelsClient->delete($project, $region, $vpnTunnel); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vpnTunnelsClient->resumeOperation($operationName, 'delete'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vpnTunnelsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region for this request. - * @param string $vpnTunnel Name of the VpnTunnel resource to delete. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 delete($project, $region, $vpnTunnel, array $optionalArgs = []) - { - $request = new DeleteVpnTunnelRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setVpnTunnel($vpnTunnel); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['vpn_tunnel'] = $vpnTunnel; - 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('Delete', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Returns the specified VpnTunnel resource. - * - * Sample code: - * ``` - * $vpnTunnelsClient = new VpnTunnelsClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $vpnTunnel = 'vpn_tunnel'; - * $response = $vpnTunnelsClient->get($project, $region, $vpnTunnel); - * } finally { - * $vpnTunnelsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region for this request. - * @param string $vpnTunnel Name of the VpnTunnel resource to return. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\VpnTunnel - * - * @throws ApiException if the remote call fails - */ - public function get($project, $region, $vpnTunnel, array $optionalArgs = []) - { - $request = new GetVpnTunnelRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setVpnTunnel($vpnTunnel); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['vpn_tunnel'] = $vpnTunnel; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', VpnTunnel::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates a VpnTunnel resource in the specified project and region using the data included in the request. - * - * Sample code: - * ``` - * $vpnTunnelsClient = new VpnTunnelsClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $vpnTunnelResource = new VpnTunnel(); - * $operationResponse = $vpnTunnelsClient->insert($project, $region, $vpnTunnelResource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $vpnTunnelsClient->insert($project, $region, $vpnTunnelResource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vpnTunnelsClient->resumeOperation($operationName, 'insert'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vpnTunnelsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region for this request. - * @param VpnTunnel $vpnTunnelResource The body resource for this request - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 insert($project, $region, $vpnTunnelResource, array $optionalArgs = []) - { - $request = new InsertVpnTunnelRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setVpnTunnelResource($vpnTunnelResource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - 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('Insert', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } - - /** - * Retrieves a list of VpnTunnel resources contained in the specified project and region. - * - * Sample code: - * ``` - * $vpnTunnelsClient = new VpnTunnelsClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * // Iterate over pages of elements - * $pagedResponse = $vpnTunnelsClient->list($project, $region); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $vpnTunnelsClient->list($project, $region); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $vpnTunnelsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region Name of the region for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, $region, array $optionalArgs = []) - { - $request = new ListVpnTunnelsRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, VpnTunnelList::class, $request); - } - - /** - * Sets the labels on a VpnTunnel. To learn more about labels, read the Labeling Resources documentation. - * - * Sample code: - * ``` - * $vpnTunnelsClient = new VpnTunnelsClient(); - * try { - * $project = 'project'; - * $region = 'region'; - * $regionSetLabelsRequestResource = new RegionSetLabelsRequest(); - * $resource = 'resource'; - * $operationResponse = $vpnTunnelsClient->setLabels($project, $region, $regionSetLabelsRequestResource, $resource); - * $operationResponse->pollUntilComplete(); - * if ($operationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $operationResponse->getError(); - * // handleError($error) - * } - * // Alternatively: - * // start the operation, keep the operation name, and resume later - * $operationResponse = $vpnTunnelsClient->setLabels($project, $region, $regionSetLabelsRequestResource, $resource); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $vpnTunnelsClient->resumeOperation($operationName, 'setLabels'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // if creating/modifying, retrieve the target resource - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $vpnTunnelsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $region The region for this request. - * @param RegionSetLabelsRequest $regionSetLabelsRequestResource The body resource for this request - * @param string $resource Name or id of the resource for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $requestId - * 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. 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 setLabels($project, $region, $regionSetLabelsRequestResource, $resource, array $optionalArgs = []) - { - $request = new SetLabelsVpnTunnelRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setRegion($region); - $request->setRegionSetLabelsRequestResource($regionSetLabelsRequestResource); - $request->setResource($resource); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['region'] = $region; - $requestParamHeaders['resource'] = $resource; - 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('SetLabels', $optionalArgs, $request, $this->getOperationsClient(), null, Operation::class)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/ZoneOperationsGapicClient.php b/Compute/src/V1/Gapic/ZoneOperationsGapicClient.php deleted file mode 100644 index e437a84c6c4c..000000000000 --- a/Compute/src/V1/Gapic/ZoneOperationsGapicClient.php +++ /dev/null @@ -1,410 +0,0 @@ -delete($operation, $project, $zone); - * } finally { - * $zoneOperationsClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\ZoneOperationsClient}. - */ -class ZoneOperationsGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.ZoneOperations'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/zone_operations_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/zone_operations_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/zone_operations_rest_client_config.php', - ], - ], - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * 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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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); - } - - /** - * Deletes the specified zone-specific Operations resource. - * - * Sample code: - * ``` - * $zoneOperationsClient = new ZoneOperationsClient(); - * try { - * $operation = 'operation'; - * $project = 'project'; - * $zone = 'zone'; - * $response = $zoneOperationsClient->delete($operation, $project, $zone); - * } finally { - * $zoneOperationsClient->close(); - * } - * ``` - * - * @param string $operation Name of the Operations resource to delete, or its unique numeric identifier. - * @param string $project Project ID for this request. - * @param string $zone Name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\DeleteZoneOperationResponse - * - * @throws ApiException if the remote call fails - */ - public function delete($operation, $project, $zone, array $optionalArgs = []) - { - $request = new DeleteZoneOperationRequest(); - $requestParamHeaders = []; - $request->setOperation($operation); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['operation'] = $operation; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Delete', DeleteZoneOperationResponse::class, $optionalArgs, $request)->wait(); - } - - /** - * Retrieves the specified zone-specific Operations resource. - * - * Sample code: - * ``` - * $zoneOperationsClient = new ZoneOperationsClient(); - * try { - * $operation = 'operation'; - * $project = 'project'; - * $zone = 'zone'; - * $response = $zoneOperationsClient->get($operation, $project, $zone); - * } finally { - * $zoneOperationsClient->close(); - * } - * ``` - * - * @param string $operation Name of the Operations resource to return, or its unique numeric identifier. - * @param string $project Project ID for this request. - * @param string $zone Name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Operation - * - * @throws ApiException if the remote call fails - */ - public function get($operation, $project, $zone, array $optionalArgs = []) - { - $request = new GetZoneOperationRequest(); - $requestParamHeaders = []; - $request->setOperation($operation); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['operation'] = $operation; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', Operation::class, $optionalArgs, $request)->wait(); - } - - /** - * Retrieves a list of Operation resources contained within the specified zone. - * - * Sample code: - * ``` - * $zoneOperationsClient = new ZoneOperationsClient(); - * try { - * $project = 'project'; - * $zone = 'zone'; - * // Iterate over pages of elements - * $pagedResponse = $zoneOperationsClient->list($project, $zone); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $zoneOperationsClient->list($project, $zone); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $zoneOperationsClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $zone Name of the zone for request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, $zone, array $optionalArgs = []) - { - $request = new ListZoneOperationsRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, OperationList::class, $request); - } - - /** - * Waits for the specified Operation resource to return as `DONE` or for the request to approach the 2 minute deadline, and retrieves the specified Operation resource. This method waits for no more than the 2 minutes and then returns the current state of the operation, which might be `DONE` or still in progress. This method is called on a best-effort basis. Specifically: - In uncommon cases, when the server is overloaded, the request might return before the default deadline is reached, or might return after zero seconds. - If the default deadline is reached, there is no guarantee that the operation is actually done when the method returns. Be prepared to retry if the operation is not `DONE`. - * - * Sample code: - * ``` - * $zoneOperationsClient = new ZoneOperationsClient(); - * try { - * $operation = 'operation'; - * $project = 'project'; - * $zone = 'zone'; - * $response = $zoneOperationsClient->wait($operation, $project, $zone); - * } finally { - * $zoneOperationsClient->close(); - * } - * ``` - * - * @param string $operation Name of the Operations resource to return, or its unique numeric identifier. - * @param string $project Project ID for this request. - * @param string $zone Name of the zone for this request. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Operation - * - * @throws ApiException if the remote call fails - */ - public function wait($operation, $project, $zone, array $optionalArgs = []) - { - $request = new WaitZoneOperationRequest(); - $requestParamHeaders = []; - $request->setOperation($operation); - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['operation'] = $operation; - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Wait', Operation::class, $optionalArgs, $request)->wait(); - } -} diff --git a/Compute/src/V1/Gapic/ZonesGapicClient.php b/Compute/src/V1/Gapic/ZonesGapicClient.php deleted file mode 100644 index 8796de64cd9f..000000000000 --- a/Compute/src/V1/Gapic/ZonesGapicClient.php +++ /dev/null @@ -1,305 +0,0 @@ -get($project, $zone); - * } finally { - * $zonesClient->close(); - * } - * ``` - * - * @deprecated Please use the new service client {@see \Google\Cloud\Compute\V1\Client\ZonesClient}. - */ -class ZonesGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.compute.v1.Zones'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'compute.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'compute.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/compute.readonly', - 'https://www.googleapis.com/auth/compute', - 'https://www.googleapis.com/auth/cloud-platform', - ]; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/zones_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/zones_descriptor_config.php', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - 'useJwtAccessWithScope' => false, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/zones_rest_client_config.php', - ], - ], - ]; - } - - /** Implements GapicClientTrait::defaultTransport. */ - private static function defaultTransport() - { - return 'rest'; - } - - /** Implements GapicClientTrait::supportedTransports. */ - private static function supportedTransports() - { - return [ - 'rest', - ]; - } - - /** - * 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 'compute.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. At the moment, supports only - * `rest`. *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 = [ - * 'rest' => [...], - * ]; - * See the {@see \Google\ApiCore\Transport\RestTransport::build()} method 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); - } - - /** - * Returns the specified Zone resource. - * - * Sample code: - * ``` - * $zonesClient = new ZonesClient(); - * try { - * $project = 'project'; - * $zone = 'zone'; - * $response = $zonesClient->get($project, $zone); - * } finally { - * $zonesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param string $zone Name of the zone resource to return. - * @param array $optionalArgs { - * Optional. - * - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an - * associative array of retry settings parameters. See the documentation on - * {@see RetrySettings} for example usage. - * } - * - * @return \Google\Cloud\Compute\V1\Zone - * - * @throws ApiException if the remote call fails - */ - public function get($project, $zone, array $optionalArgs = []) - { - $request = new GetZoneRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $request->setZone($zone); - $requestParamHeaders['project'] = $project; - $requestParamHeaders['zone'] = $zone; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('Get', Zone::class, $optionalArgs, $request)->wait(); - } - - /** - * Retrieves the list of Zone resources available to the specified project. - * - * Sample code: - * ``` - * $zonesClient = new ZonesClient(); - * try { - * $project = 'project'; - * // Iterate over pages of elements - * $pagedResponse = $zonesClient->list($project); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $zonesClient->list($project); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $zonesClient->close(); - * } - * ``` - * - * @param string $project Project ID for this request. - * @param array $optionalArgs { - * Optional. - * - * @type string $filter - * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. - * @type int $maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @type string $orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @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 $returnPartialSuccess - * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can be 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 list($project, array $optionalArgs = []) - { - $request = new ListZonesRequest(); - $requestParamHeaders = []; - $request->setProject($project); - $requestParamHeaders['project'] = $project; - if (isset($optionalArgs['filter'])) { - $request->setFilter($optionalArgs['filter']); - } - - if (isset($optionalArgs['maxResults'])) { - $request->setMaxResults($optionalArgs['maxResults']); - } - - if (isset($optionalArgs['orderBy'])) { - $request->setOrderBy($optionalArgs['orderBy']); - } - - if (isset($optionalArgs['pageToken'])) { - $request->setPageToken($optionalArgs['pageToken']); - } - - if (isset($optionalArgs['returnPartialSuccess'])) { - $request->setReturnPartialSuccess($optionalArgs['returnPartialSuccess']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('List', $optionalArgs, ZoneList::class, $request); - } -} diff --git a/Compute/src/V1/GetAcceleratorTypeRequest.php b/Compute/src/V1/GetAcceleratorTypeRequest.php index e624b3254533..f9fc64171d9e 100644 --- a/Compute/src/V1/GetAcceleratorTypeRequest.php +++ b/Compute/src/V1/GetAcceleratorTypeRequest.php @@ -20,19 +20,19 @@ class GetAcceleratorTypeRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string accelerator_type = 138031246 [(.google.api.field_behavior) = REQUIRED]; */ - private $accelerator_type = ''; + protected $accelerator_type = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetAddressRequest.php b/Compute/src/V1/GetAddressRequest.php index d05b697c91b1..ef94ed037d88 100644 --- a/Compute/src/V1/GetAddressRequest.php +++ b/Compute/src/V1/GetAddressRequest.php @@ -20,19 +20,19 @@ class GetAddressRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string address = 462920692 [(.google.api.field_behavior) = REQUIRED]; */ - private $address = ''; + protected $address = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetAssociationFirewallPolicyRequest.php b/Compute/src/V1/GetAssociationFirewallPolicyRequest.php index e9d56e039625..8cd26a2fc4f7 100644 --- a/Compute/src/V1/GetAssociationFirewallPolicyRequest.php +++ b/Compute/src/V1/GetAssociationFirewallPolicyRequest.php @@ -20,13 +20,13 @@ class GetAssociationFirewallPolicyRequest extends \Google\Protobuf\Internal\Mess * * Generated from protobuf field string firewall_policy = 498173265 [(.google.api.field_behavior) = REQUIRED]; */ - private $firewall_policy = ''; + protected $firewall_policy = ''; /** * The name of the association to get from the firewall policy. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * @param string $firewallPolicy Name of the firewall policy to which the queried rule belongs. diff --git a/Compute/src/V1/GetAssociationNetworkFirewallPolicyRequest.php b/Compute/src/V1/GetAssociationNetworkFirewallPolicyRequest.php index fd5cdf599239..a92e7a5b8c9e 100644 --- a/Compute/src/V1/GetAssociationNetworkFirewallPolicyRequest.php +++ b/Compute/src/V1/GetAssociationNetworkFirewallPolicyRequest.php @@ -20,19 +20,19 @@ class GetAssociationNetworkFirewallPolicyRequest extends \Google\Protobuf\Intern * * Generated from protobuf field string firewall_policy = 498173265 [(.google.api.field_behavior) = REQUIRED]; */ - private $firewall_policy = ''; + protected $firewall_policy = ''; /** * The name of the association to get from the firewall policy. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetAssociationRegionNetworkFirewallPolicyRequest.php b/Compute/src/V1/GetAssociationRegionNetworkFirewallPolicyRequest.php index bb4ea398950a..fdc72cd7038a 100644 --- a/Compute/src/V1/GetAssociationRegionNetworkFirewallPolicyRequest.php +++ b/Compute/src/V1/GetAssociationRegionNetworkFirewallPolicyRequest.php @@ -20,25 +20,25 @@ class GetAssociationRegionNetworkFirewallPolicyRequest extends \Google\Protobuf\ * * Generated from protobuf field string firewall_policy = 498173265 [(.google.api.field_behavior) = REQUIRED]; */ - private $firewall_policy = ''; + protected $firewall_policy = ''; /** * The name of the association to get from the firewall policy. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetAutoscalerRequest.php b/Compute/src/V1/GetAutoscalerRequest.php index 94925e51ba9e..5d4cacd45ae4 100644 --- a/Compute/src/V1/GetAutoscalerRequest.php +++ b/Compute/src/V1/GetAutoscalerRequest.php @@ -20,19 +20,19 @@ class GetAutoscalerRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string autoscaler = 517258967 [(.google.api.field_behavior) = REQUIRED]; */ - private $autoscaler = ''; + protected $autoscaler = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetBackendBucketRequest.php b/Compute/src/V1/GetBackendBucketRequest.php index a0a3a7eaadee..86938d583ac8 100644 --- a/Compute/src/V1/GetBackendBucketRequest.php +++ b/Compute/src/V1/GetBackendBucketRequest.php @@ -20,13 +20,13 @@ class GetBackendBucketRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string backend_bucket = 91714037 [(.google.api.field_behavior) = REQUIRED]; */ - private $backend_bucket = ''; + protected $backend_bucket = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetBackendServiceRequest.php b/Compute/src/V1/GetBackendServiceRequest.php index 85be4f860620..4a2bc31dc033 100644 --- a/Compute/src/V1/GetBackendServiceRequest.php +++ b/Compute/src/V1/GetBackendServiceRequest.php @@ -20,13 +20,13 @@ class GetBackendServiceRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string backend_service = 306946058 [(.google.api.field_behavior) = REQUIRED]; */ - private $backend_service = ''; + protected $backend_service = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetDiagnosticsInterconnectRequest.php b/Compute/src/V1/GetDiagnosticsInterconnectRequest.php index e26c9de9b46f..b74c59308e5e 100644 --- a/Compute/src/V1/GetDiagnosticsInterconnectRequest.php +++ b/Compute/src/V1/GetDiagnosticsInterconnectRequest.php @@ -20,13 +20,13 @@ class GetDiagnosticsInterconnectRequest extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field string interconnect = 224601230 [(.google.api.field_behavior) = REQUIRED]; */ - private $interconnect = ''; + protected $interconnect = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetDiskRequest.php b/Compute/src/V1/GetDiskRequest.php index a7fea4589ca0..dd85398dfc0e 100644 --- a/Compute/src/V1/GetDiskRequest.php +++ b/Compute/src/V1/GetDiskRequest.php @@ -20,19 +20,19 @@ class GetDiskRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string disk = 3083677 [(.google.api.field_behavior) = REQUIRED]; */ - private $disk = ''; + protected $disk = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetDiskTypeRequest.php b/Compute/src/V1/GetDiskTypeRequest.php index 2fdb7b18930c..7a20732c799b 100644 --- a/Compute/src/V1/GetDiskTypeRequest.php +++ b/Compute/src/V1/GetDiskTypeRequest.php @@ -20,19 +20,19 @@ class GetDiskTypeRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string disk_type = 93009052 [(.google.api.field_behavior) = REQUIRED]; */ - private $disk_type = ''; + protected $disk_type = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetEffectiveFirewallsInstanceRequest.php b/Compute/src/V1/GetEffectiveFirewallsInstanceRequest.php index 850eaeb4e5fd..a28cf82df162 100644 --- a/Compute/src/V1/GetEffectiveFirewallsInstanceRequest.php +++ b/Compute/src/V1/GetEffectiveFirewallsInstanceRequest.php @@ -20,25 +20,25 @@ class GetEffectiveFirewallsInstanceRequest extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field string instance = 18257045 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance = ''; + protected $instance = ''; /** * The name of the network interface to get the effective firewalls. * * Generated from protobuf field string network_interface = 365387880 [(.google.api.field_behavior) = REQUIRED]; */ - private $network_interface = ''; + protected $network_interface = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetEffectiveFirewallsNetworkRequest.php b/Compute/src/V1/GetEffectiveFirewallsNetworkRequest.php index 7565f8e2e09f..cb855b425d1a 100644 --- a/Compute/src/V1/GetEffectiveFirewallsNetworkRequest.php +++ b/Compute/src/V1/GetEffectiveFirewallsNetworkRequest.php @@ -20,13 +20,13 @@ class GetEffectiveFirewallsNetworkRequest extends \Google\Protobuf\Internal\Mess * * Generated from protobuf field string network = 232872494 [(.google.api.field_behavior) = REQUIRED]; */ - private $network = ''; + protected $network = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetEffectiveFirewallsRegionNetworkFirewallPolicyRequest.php b/Compute/src/V1/GetEffectiveFirewallsRegionNetworkFirewallPolicyRequest.php index 8059ae99a1df..326279575976 100644 --- a/Compute/src/V1/GetEffectiveFirewallsRegionNetworkFirewallPolicyRequest.php +++ b/Compute/src/V1/GetEffectiveFirewallsRegionNetworkFirewallPolicyRequest.php @@ -20,19 +20,19 @@ class GetEffectiveFirewallsRegionNetworkFirewallPolicyRequest extends \Google\Pr * * Generated from protobuf field string network = 232872494 [(.google.api.field_behavior) = REQUIRED]; */ - private $network = ''; + protected $network = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetExternalVpnGatewayRequest.php b/Compute/src/V1/GetExternalVpnGatewayRequest.php index 3b71325b5fe7..bdf85e869e9f 100644 --- a/Compute/src/V1/GetExternalVpnGatewayRequest.php +++ b/Compute/src/V1/GetExternalVpnGatewayRequest.php @@ -20,13 +20,13 @@ class GetExternalVpnGatewayRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string external_vpn_gateway = 109898629 [(.google.api.field_behavior) = REQUIRED]; */ - private $external_vpn_gateway = ''; + protected $external_vpn_gateway = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetFirewallPolicyRequest.php b/Compute/src/V1/GetFirewallPolicyRequest.php index 00e167cba24f..feb0e2003105 100644 --- a/Compute/src/V1/GetFirewallPolicyRequest.php +++ b/Compute/src/V1/GetFirewallPolicyRequest.php @@ -20,7 +20,7 @@ class GetFirewallPolicyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string firewall_policy = 498173265 [(.google.api.field_behavior) = REQUIRED]; */ - private $firewall_policy = ''; + protected $firewall_policy = ''; /** * @param string $firewallPolicy Name of the firewall policy to get. diff --git a/Compute/src/V1/GetFirewallRequest.php b/Compute/src/V1/GetFirewallRequest.php index 02deb746d145..3b14d810540d 100644 --- a/Compute/src/V1/GetFirewallRequest.php +++ b/Compute/src/V1/GetFirewallRequest.php @@ -20,13 +20,13 @@ class GetFirewallRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string firewall = 511016192 [(.google.api.field_behavior) = REQUIRED]; */ - private $firewall = ''; + protected $firewall = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetForwardingRuleRequest.php b/Compute/src/V1/GetForwardingRuleRequest.php index b428af67d6fd..9d39c759a6d3 100644 --- a/Compute/src/V1/GetForwardingRuleRequest.php +++ b/Compute/src/V1/GetForwardingRuleRequest.php @@ -20,19 +20,19 @@ class GetForwardingRuleRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string forwarding_rule = 269964030 [(.google.api.field_behavior) = REQUIRED]; */ - private $forwarding_rule = ''; + protected $forwarding_rule = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetFromFamilyImageRequest.php b/Compute/src/V1/GetFromFamilyImageRequest.php index 567996618960..8459666d0dba 100644 --- a/Compute/src/V1/GetFromFamilyImageRequest.php +++ b/Compute/src/V1/GetFromFamilyImageRequest.php @@ -20,13 +20,13 @@ class GetFromFamilyImageRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string family = 328751972 [(.google.api.field_behavior) = REQUIRED]; */ - private $family = ''; + protected $family = ''; /** * The image project that the image belongs to. For example, to get a CentOS image, specify centos-cloud as the image project. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * @param string $project The image project that the image belongs to. For example, to get a CentOS image, specify centos-cloud as the image project. diff --git a/Compute/src/V1/GetGlobalAddressRequest.php b/Compute/src/V1/GetGlobalAddressRequest.php index c9c201e4a96b..a5fa1e6ca07e 100644 --- a/Compute/src/V1/GetGlobalAddressRequest.php +++ b/Compute/src/V1/GetGlobalAddressRequest.php @@ -20,13 +20,13 @@ class GetGlobalAddressRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string address = 462920692 [(.google.api.field_behavior) = REQUIRED]; */ - private $address = ''; + protected $address = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetGlobalForwardingRuleRequest.php b/Compute/src/V1/GetGlobalForwardingRuleRequest.php index 355c34d1a350..2cfa6246a5d8 100644 --- a/Compute/src/V1/GetGlobalForwardingRuleRequest.php +++ b/Compute/src/V1/GetGlobalForwardingRuleRequest.php @@ -20,13 +20,13 @@ class GetGlobalForwardingRuleRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string forwarding_rule = 269964030 [(.google.api.field_behavior) = REQUIRED]; */ - private $forwarding_rule = ''; + protected $forwarding_rule = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetGlobalNetworkEndpointGroupRequest.php b/Compute/src/V1/GetGlobalNetworkEndpointGroupRequest.php index e940dfece953..06846c22f458 100644 --- a/Compute/src/V1/GetGlobalNetworkEndpointGroupRequest.php +++ b/Compute/src/V1/GetGlobalNetworkEndpointGroupRequest.php @@ -20,13 +20,13 @@ class GetGlobalNetworkEndpointGroupRequest extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field string network_endpoint_group = 433907078 [(.google.api.field_behavior) = REQUIRED]; */ - private $network_endpoint_group = ''; + protected $network_endpoint_group = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetGlobalOperationRequest.php b/Compute/src/V1/GetGlobalOperationRequest.php index a42a0fd6a3f2..58fdf66c8f37 100644 --- a/Compute/src/V1/GetGlobalOperationRequest.php +++ b/Compute/src/V1/GetGlobalOperationRequest.php @@ -20,13 +20,13 @@ class GetGlobalOperationRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string operation = 52090215 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_response_field) = "name"]; */ - private $operation = ''; + protected $operation = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetGlobalOrganizationOperationRequest.php b/Compute/src/V1/GetGlobalOrganizationOperationRequest.php index b11b07cc7339..d431efe1223f 100644 --- a/Compute/src/V1/GetGlobalOrganizationOperationRequest.php +++ b/Compute/src/V1/GetGlobalOrganizationOperationRequest.php @@ -20,13 +20,13 @@ class GetGlobalOrganizationOperationRequest extends \Google\Protobuf\Internal\Me * * Generated from protobuf field string operation = 52090215 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_response_field) = "name"]; */ - private $operation = ''; + protected $operation = ''; /** * Parent ID for this request. Not used. Parent is derived from resource_id. * * Generated from protobuf field optional string parent_id = 459714768; */ - private $parent_id = null; + protected $parent_id = null; /** * @param string $operation Name of the Operations resource to return. Parent is derived from this field. diff --git a/Compute/src/V1/GetGlobalPublicDelegatedPrefixeRequest.php b/Compute/src/V1/GetGlobalPublicDelegatedPrefixeRequest.php index f697b8a87300..ccac629248ac 100644 --- a/Compute/src/V1/GetGlobalPublicDelegatedPrefixeRequest.php +++ b/Compute/src/V1/GetGlobalPublicDelegatedPrefixeRequest.php @@ -20,13 +20,13 @@ class GetGlobalPublicDelegatedPrefixeRequest extends \Google\Protobuf\Internal\M * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the PublicDelegatedPrefix resource to return. * * Generated from protobuf field string public_delegated_prefix = 204238440 [(.google.api.field_behavior) = REQUIRED]; */ - private $public_delegated_prefix = ''; + protected $public_delegated_prefix = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetGuestAttributesInstanceRequest.php b/Compute/src/V1/GetGuestAttributesInstanceRequest.php index fb78ccfae095..844557b4027c 100644 --- a/Compute/src/V1/GetGuestAttributesInstanceRequest.php +++ b/Compute/src/V1/GetGuestAttributesInstanceRequest.php @@ -20,31 +20,31 @@ class GetGuestAttributesInstanceRequest extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field string instance = 18257045 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance = ''; + protected $instance = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Specifies the guest attributes path to be queried. * * Generated from protobuf field optional string query_path = 368591164; */ - private $query_path = null; + protected $query_path = null; /** * Specifies the key for the guest attributes entry. * * Generated from protobuf field optional string variable_key = 164364828; */ - private $variable_key = null; + protected $variable_key = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetHealthBackendServiceRequest.php b/Compute/src/V1/GetHealthBackendServiceRequest.php index f5c3c6fea4f9..9ada0a24c276 100644 --- a/Compute/src/V1/GetHealthBackendServiceRequest.php +++ b/Compute/src/V1/GetHealthBackendServiceRequest.php @@ -20,17 +20,17 @@ class GetHealthBackendServiceRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string backend_service = 306946058 [(.google.api.field_behavior) = REQUIRED]; */ - private $backend_service = ''; + protected $backend_service = ''; /** * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.ResourceGroupReference resource_group_reference_resource = 112951123 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource_group_reference_resource = null; + protected $resource_group_reference_resource = null; /** * @param string $project diff --git a/Compute/src/V1/GetHealthCheckRequest.php b/Compute/src/V1/GetHealthCheckRequest.php index cc37f8a9c72e..71eb4a6d375b 100644 --- a/Compute/src/V1/GetHealthCheckRequest.php +++ b/Compute/src/V1/GetHealthCheckRequest.php @@ -20,13 +20,13 @@ class GetHealthCheckRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string health_check = 308876645 [(.google.api.field_behavior) = REQUIRED]; */ - private $health_check = ''; + protected $health_check = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetHealthRegionBackendServiceRequest.php b/Compute/src/V1/GetHealthRegionBackendServiceRequest.php index 7495b43208c3..7e72c2b493c1 100644 --- a/Compute/src/V1/GetHealthRegionBackendServiceRequest.php +++ b/Compute/src/V1/GetHealthRegionBackendServiceRequest.php @@ -20,23 +20,23 @@ class GetHealthRegionBackendServiceRequest extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field string backend_service = 306946058 [(.google.api.field_behavior) = REQUIRED]; */ - private $backend_service = ''; + protected $backend_service = ''; /** * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.ResourceGroupReference resource_group_reference_resource = 112951123 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource_group_reference_resource = null; + protected $resource_group_reference_resource = null; /** * @param string $project diff --git a/Compute/src/V1/GetHealthTargetPoolRequest.php b/Compute/src/V1/GetHealthTargetPoolRequest.php index 55bfeefa6c1b..14c8ff05c1e5 100644 --- a/Compute/src/V1/GetHealthTargetPoolRequest.php +++ b/Compute/src/V1/GetHealthTargetPoolRequest.php @@ -20,25 +20,25 @@ class GetHealthTargetPoolRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.compute.v1.InstanceReference instance_reference_resource = 292926060 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_reference_resource = null; + protected $instance_reference_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Name of the TargetPool resource to which the queried instance belongs. * * Generated from protobuf field string target_pool = 62796298 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_pool = ''; + protected $target_pool = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetIamPolicyBackendBucketRequest.php b/Compute/src/V1/GetIamPolicyBackendBucketRequest.php index c023090e8c8d..5a732995411c 100644 --- a/Compute/src/V1/GetIamPolicyBackendBucketRequest.php +++ b/Compute/src/V1/GetIamPolicyBackendBucketRequest.php @@ -20,19 +20,19 @@ class GetIamPolicyBackendBucketRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int32 options_requested_policy_version = 499220029; */ - private $options_requested_policy_version = null; + protected $options_requested_policy_version = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetIamPolicyBackendServiceRequest.php b/Compute/src/V1/GetIamPolicyBackendServiceRequest.php index acbe1afd4676..9663916f3530 100644 --- a/Compute/src/V1/GetIamPolicyBackendServiceRequest.php +++ b/Compute/src/V1/GetIamPolicyBackendServiceRequest.php @@ -20,19 +20,19 @@ class GetIamPolicyBackendServiceRequest extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field optional int32 options_requested_policy_version = 499220029; */ - private $options_requested_policy_version = null; + protected $options_requested_policy_version = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetIamPolicyDiskRequest.php b/Compute/src/V1/GetIamPolicyDiskRequest.php index 665ada9d3ef9..3105fed16fae 100644 --- a/Compute/src/V1/GetIamPolicyDiskRequest.php +++ b/Compute/src/V1/GetIamPolicyDiskRequest.php @@ -20,25 +20,25 @@ class GetIamPolicyDiskRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int32 options_requested_policy_version = 499220029; */ - private $options_requested_policy_version = null; + protected $options_requested_policy_version = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetIamPolicyFirewallPolicyRequest.php b/Compute/src/V1/GetIamPolicyFirewallPolicyRequest.php index 4e88376bd69a..2d6d72424986 100644 --- a/Compute/src/V1/GetIamPolicyFirewallPolicyRequest.php +++ b/Compute/src/V1/GetIamPolicyFirewallPolicyRequest.php @@ -20,13 +20,13 @@ class GetIamPolicyFirewallPolicyRequest extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field optional int32 options_requested_policy_version = 499220029; */ - private $options_requested_policy_version = null; + protected $options_requested_policy_version = null; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * @param string $resource Name or id of the resource for this request. diff --git a/Compute/src/V1/GetIamPolicyImageRequest.php b/Compute/src/V1/GetIamPolicyImageRequest.php index 8640f437342b..ff73f525ede8 100644 --- a/Compute/src/V1/GetIamPolicyImageRequest.php +++ b/Compute/src/V1/GetIamPolicyImageRequest.php @@ -20,19 +20,19 @@ class GetIamPolicyImageRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int32 options_requested_policy_version = 499220029; */ - private $options_requested_policy_version = null; + protected $options_requested_policy_version = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetIamPolicyInstanceRequest.php b/Compute/src/V1/GetIamPolicyInstanceRequest.php index 2e6489f364b8..59f4918cd4ad 100644 --- a/Compute/src/V1/GetIamPolicyInstanceRequest.php +++ b/Compute/src/V1/GetIamPolicyInstanceRequest.php @@ -20,25 +20,25 @@ class GetIamPolicyInstanceRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int32 options_requested_policy_version = 499220029; */ - private $options_requested_policy_version = null; + protected $options_requested_policy_version = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetIamPolicyInstanceTemplateRequest.php b/Compute/src/V1/GetIamPolicyInstanceTemplateRequest.php index c6d7bb325f0c..cf8b04d11174 100644 --- a/Compute/src/V1/GetIamPolicyInstanceTemplateRequest.php +++ b/Compute/src/V1/GetIamPolicyInstanceTemplateRequest.php @@ -20,19 +20,19 @@ class GetIamPolicyInstanceTemplateRequest extends \Google\Protobuf\Internal\Mess * * Generated from protobuf field optional int32 options_requested_policy_version = 499220029; */ - private $options_requested_policy_version = null; + protected $options_requested_policy_version = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetIamPolicyInstantSnapshotRequest.php b/Compute/src/V1/GetIamPolicyInstantSnapshotRequest.php index 8e89de11b1a7..54737f8f2530 100644 --- a/Compute/src/V1/GetIamPolicyInstantSnapshotRequest.php +++ b/Compute/src/V1/GetIamPolicyInstantSnapshotRequest.php @@ -20,25 +20,25 @@ class GetIamPolicyInstantSnapshotRequest extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field optional int32 options_requested_policy_version = 499220029; */ - private $options_requested_policy_version = null; + protected $options_requested_policy_version = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetIamPolicyInterconnectAttachmentGroupRequest.php b/Compute/src/V1/GetIamPolicyInterconnectAttachmentGroupRequest.php index 95d517ff6eee..ea62fa827d7e 100644 --- a/Compute/src/V1/GetIamPolicyInterconnectAttachmentGroupRequest.php +++ b/Compute/src/V1/GetIamPolicyInterconnectAttachmentGroupRequest.php @@ -20,19 +20,19 @@ class GetIamPolicyInterconnectAttachmentGroupRequest extends \Google\Protobuf\In * * Generated from protobuf field optional int32 options_requested_policy_version = 499220029; */ - private $options_requested_policy_version = null; + protected $options_requested_policy_version = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetIamPolicyInterconnectGroupRequest.php b/Compute/src/V1/GetIamPolicyInterconnectGroupRequest.php index ce15dcdd11d3..69f0d331f159 100644 --- a/Compute/src/V1/GetIamPolicyInterconnectGroupRequest.php +++ b/Compute/src/V1/GetIamPolicyInterconnectGroupRequest.php @@ -20,19 +20,19 @@ class GetIamPolicyInterconnectGroupRequest extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field optional int32 options_requested_policy_version = 499220029; */ - private $options_requested_policy_version = null; + protected $options_requested_policy_version = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetIamPolicyLicenseRequest.php b/Compute/src/V1/GetIamPolicyLicenseRequest.php index aa63de9b6ae9..b82eb83c15cb 100644 --- a/Compute/src/V1/GetIamPolicyLicenseRequest.php +++ b/Compute/src/V1/GetIamPolicyLicenseRequest.php @@ -20,19 +20,19 @@ class GetIamPolicyLicenseRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int32 options_requested_policy_version = 499220029; */ - private $options_requested_policy_version = null; + protected $options_requested_policy_version = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetIamPolicyMachineImageRequest.php b/Compute/src/V1/GetIamPolicyMachineImageRequest.php index 63555afb8728..6cbaff12c5ca 100644 --- a/Compute/src/V1/GetIamPolicyMachineImageRequest.php +++ b/Compute/src/V1/GetIamPolicyMachineImageRequest.php @@ -20,19 +20,19 @@ class GetIamPolicyMachineImageRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int32 options_requested_policy_version = 499220029; */ - private $options_requested_policy_version = null; + protected $options_requested_policy_version = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetIamPolicyNetworkAttachmentRequest.php b/Compute/src/V1/GetIamPolicyNetworkAttachmentRequest.php index 7669ef04936b..6ce1031997e2 100644 --- a/Compute/src/V1/GetIamPolicyNetworkAttachmentRequest.php +++ b/Compute/src/V1/GetIamPolicyNetworkAttachmentRequest.php @@ -20,25 +20,25 @@ class GetIamPolicyNetworkAttachmentRequest extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field optional int32 options_requested_policy_version = 499220029; */ - private $options_requested_policy_version = null; + protected $options_requested_policy_version = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * The name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetIamPolicyNetworkFirewallPolicyRequest.php b/Compute/src/V1/GetIamPolicyNetworkFirewallPolicyRequest.php index 63c648aefe07..a3a1ed9e46e5 100644 --- a/Compute/src/V1/GetIamPolicyNetworkFirewallPolicyRequest.php +++ b/Compute/src/V1/GetIamPolicyNetworkFirewallPolicyRequest.php @@ -20,19 +20,19 @@ class GetIamPolicyNetworkFirewallPolicyRequest extends \Google\Protobuf\Internal * * Generated from protobuf field optional int32 options_requested_policy_version = 499220029; */ - private $options_requested_policy_version = null; + protected $options_requested_policy_version = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetIamPolicyNodeGroupRequest.php b/Compute/src/V1/GetIamPolicyNodeGroupRequest.php index 243f613d1ad8..dc6ddb820b07 100644 --- a/Compute/src/V1/GetIamPolicyNodeGroupRequest.php +++ b/Compute/src/V1/GetIamPolicyNodeGroupRequest.php @@ -20,25 +20,25 @@ class GetIamPolicyNodeGroupRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int32 options_requested_policy_version = 499220029; */ - private $options_requested_policy_version = null; + protected $options_requested_policy_version = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetIamPolicyNodeTemplateRequest.php b/Compute/src/V1/GetIamPolicyNodeTemplateRequest.php index 3f3f6dd6747c..83ada4e433a2 100644 --- a/Compute/src/V1/GetIamPolicyNodeTemplateRequest.php +++ b/Compute/src/V1/GetIamPolicyNodeTemplateRequest.php @@ -20,25 +20,25 @@ class GetIamPolicyNodeTemplateRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int32 options_requested_policy_version = 499220029; */ - private $options_requested_policy_version = null; + protected $options_requested_policy_version = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * The name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetIamPolicyRegionBackendServiceRequest.php b/Compute/src/V1/GetIamPolicyRegionBackendServiceRequest.php index e0ed0601d36c..4e69b23ca09f 100644 --- a/Compute/src/V1/GetIamPolicyRegionBackendServiceRequest.php +++ b/Compute/src/V1/GetIamPolicyRegionBackendServiceRequest.php @@ -20,25 +20,25 @@ class GetIamPolicyRegionBackendServiceRequest extends \Google\Protobuf\Internal\ * * Generated from protobuf field optional int32 options_requested_policy_version = 499220029; */ - private $options_requested_policy_version = null; + protected $options_requested_policy_version = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * The name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetIamPolicyRegionDiskRequest.php b/Compute/src/V1/GetIamPolicyRegionDiskRequest.php index 53e2813dddfd..73bc1719662f 100644 --- a/Compute/src/V1/GetIamPolicyRegionDiskRequest.php +++ b/Compute/src/V1/GetIamPolicyRegionDiskRequest.php @@ -20,25 +20,25 @@ class GetIamPolicyRegionDiskRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int32 options_requested_policy_version = 499220029; */ - private $options_requested_policy_version = null; + protected $options_requested_policy_version = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * The name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetIamPolicyRegionInstantSnapshotRequest.php b/Compute/src/V1/GetIamPolicyRegionInstantSnapshotRequest.php index 2474f6d25c29..50977b203751 100644 --- a/Compute/src/V1/GetIamPolicyRegionInstantSnapshotRequest.php +++ b/Compute/src/V1/GetIamPolicyRegionInstantSnapshotRequest.php @@ -20,25 +20,25 @@ class GetIamPolicyRegionInstantSnapshotRequest extends \Google\Protobuf\Internal * * Generated from protobuf field optional int32 options_requested_policy_version = 499220029; */ - private $options_requested_policy_version = null; + protected $options_requested_policy_version = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * The name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetIamPolicyRegionNetworkFirewallPolicyRequest.php b/Compute/src/V1/GetIamPolicyRegionNetworkFirewallPolicyRequest.php index fb7904d188ff..6cbe482c0ec4 100644 --- a/Compute/src/V1/GetIamPolicyRegionNetworkFirewallPolicyRequest.php +++ b/Compute/src/V1/GetIamPolicyRegionNetworkFirewallPolicyRequest.php @@ -20,25 +20,25 @@ class GetIamPolicyRegionNetworkFirewallPolicyRequest extends \Google\Protobuf\In * * Generated from protobuf field optional int32 options_requested_policy_version = 499220029; */ - private $options_requested_policy_version = null; + protected $options_requested_policy_version = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * The name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetIamPolicyReservationRequest.php b/Compute/src/V1/GetIamPolicyReservationRequest.php index 81fe19162357..7d873cb76f0c 100644 --- a/Compute/src/V1/GetIamPolicyReservationRequest.php +++ b/Compute/src/V1/GetIamPolicyReservationRequest.php @@ -20,25 +20,25 @@ class GetIamPolicyReservationRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int32 options_requested_policy_version = 499220029; */ - private $options_requested_policy_version = null; + protected $options_requested_policy_version = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetIamPolicyResourcePolicyRequest.php b/Compute/src/V1/GetIamPolicyResourcePolicyRequest.php index 5d57d7e3d8e5..0311c8287366 100644 --- a/Compute/src/V1/GetIamPolicyResourcePolicyRequest.php +++ b/Compute/src/V1/GetIamPolicyResourcePolicyRequest.php @@ -20,25 +20,25 @@ class GetIamPolicyResourcePolicyRequest extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field optional int32 options_requested_policy_version = 499220029; */ - private $options_requested_policy_version = null; + protected $options_requested_policy_version = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * The name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetIamPolicyServiceAttachmentRequest.php b/Compute/src/V1/GetIamPolicyServiceAttachmentRequest.php index 4fa0eb6b5e70..2ee486e75c6e 100644 --- a/Compute/src/V1/GetIamPolicyServiceAttachmentRequest.php +++ b/Compute/src/V1/GetIamPolicyServiceAttachmentRequest.php @@ -20,25 +20,25 @@ class GetIamPolicyServiceAttachmentRequest extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field optional int32 options_requested_policy_version = 499220029; */ - private $options_requested_policy_version = null; + protected $options_requested_policy_version = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * The name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetIamPolicySnapshotRequest.php b/Compute/src/V1/GetIamPolicySnapshotRequest.php index 849094be8c80..aaca3b1264cd 100644 --- a/Compute/src/V1/GetIamPolicySnapshotRequest.php +++ b/Compute/src/V1/GetIamPolicySnapshotRequest.php @@ -20,19 +20,19 @@ class GetIamPolicySnapshotRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int32 options_requested_policy_version = 499220029; */ - private $options_requested_policy_version = null; + protected $options_requested_policy_version = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetIamPolicyStoragePoolRequest.php b/Compute/src/V1/GetIamPolicyStoragePoolRequest.php index 0b6619547082..e2bf700ff734 100644 --- a/Compute/src/V1/GetIamPolicyStoragePoolRequest.php +++ b/Compute/src/V1/GetIamPolicyStoragePoolRequest.php @@ -20,25 +20,25 @@ class GetIamPolicyStoragePoolRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int32 options_requested_policy_version = 499220029; */ - private $options_requested_policy_version = null; + protected $options_requested_policy_version = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetIamPolicySubnetworkRequest.php b/Compute/src/V1/GetIamPolicySubnetworkRequest.php index ba417ad08b47..ae79017d7598 100644 --- a/Compute/src/V1/GetIamPolicySubnetworkRequest.php +++ b/Compute/src/V1/GetIamPolicySubnetworkRequest.php @@ -20,25 +20,25 @@ class GetIamPolicySubnetworkRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int32 options_requested_policy_version = 499220029; */ - private $options_requested_policy_version = null; + protected $options_requested_policy_version = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * The name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetImageFamilyViewRequest.php b/Compute/src/V1/GetImageFamilyViewRequest.php index 26a31aeab617..5dd7979e2478 100644 --- a/Compute/src/V1/GetImageFamilyViewRequest.php +++ b/Compute/src/V1/GetImageFamilyViewRequest.php @@ -20,19 +20,19 @@ class GetImageFamilyViewRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string family = 328751972 [(.google.api.field_behavior) = REQUIRED]; */ - private $family = ''; + protected $family = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetImageRequest.php b/Compute/src/V1/GetImageRequest.php index 5af3a5743425..11607a0b003b 100644 --- a/Compute/src/V1/GetImageRequest.php +++ b/Compute/src/V1/GetImageRequest.php @@ -20,13 +20,13 @@ class GetImageRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string image = 100313435 [(.google.api.field_behavior) = REQUIRED]; */ - private $image = ''; + protected $image = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetInstanceGroupManagerRequest.php b/Compute/src/V1/GetInstanceGroupManagerRequest.php index c99d3b4a21ac..c7df32c4971a 100644 --- a/Compute/src/V1/GetInstanceGroupManagerRequest.php +++ b/Compute/src/V1/GetInstanceGroupManagerRequest.php @@ -20,19 +20,19 @@ class GetInstanceGroupManagerRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string instance_group_manager = 249363395 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group_manager = ''; + protected $instance_group_manager = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * The name of the zone where the managed instance group is located. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetInstanceGroupManagerResizeRequestRequest.php b/Compute/src/V1/GetInstanceGroupManagerResizeRequestRequest.php index 402e36907611..58418bdf9cd7 100644 --- a/Compute/src/V1/GetInstanceGroupManagerResizeRequestRequest.php +++ b/Compute/src/V1/GetInstanceGroupManagerResizeRequestRequest.php @@ -20,25 +20,25 @@ class GetInstanceGroupManagerResizeRequestRequest extends \Google\Protobuf\Inter * * Generated from protobuf field string instance_group_manager = 249363395 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group_manager = ''; + protected $instance_group_manager = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * The name of the resize request. Name should conform to RFC1035 or be a resource ID. * * Generated from protobuf field string resize_request = 216941060 [(.google.api.field_behavior) = REQUIRED]; */ - private $resize_request = ''; + protected $resize_request = ''; /** * Name of the href="/compute/docs/regions-zones/#available">zone scoping this request. Name should conform to RFC1035. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetInstanceGroupRequest.php b/Compute/src/V1/GetInstanceGroupRequest.php index c8188722062d..034c9fefa6ba 100644 --- a/Compute/src/V1/GetInstanceGroupRequest.php +++ b/Compute/src/V1/GetInstanceGroupRequest.php @@ -20,19 +20,19 @@ class GetInstanceGroupRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string instance_group = 81095253 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group = ''; + protected $instance_group = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * The name of the zone where the instance group is located. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetInstanceRequest.php b/Compute/src/V1/GetInstanceRequest.php index 54f7957f0b9c..0f63cc098ae0 100644 --- a/Compute/src/V1/GetInstanceRequest.php +++ b/Compute/src/V1/GetInstanceRequest.php @@ -20,19 +20,19 @@ class GetInstanceRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string instance = 18257045 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance = ''; + protected $instance = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetInstanceSettingRequest.php b/Compute/src/V1/GetInstanceSettingRequest.php index 4f90a4e5317d..af21a76b9218 100644 --- a/Compute/src/V1/GetInstanceSettingRequest.php +++ b/Compute/src/V1/GetInstanceSettingRequest.php @@ -20,13 +20,13 @@ class GetInstanceSettingRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetInstanceTemplateRequest.php b/Compute/src/V1/GetInstanceTemplateRequest.php index a092a76fbe0e..dfa61412ce2b 100644 --- a/Compute/src/V1/GetInstanceTemplateRequest.php +++ b/Compute/src/V1/GetInstanceTemplateRequest.php @@ -20,13 +20,13 @@ class GetInstanceTemplateRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string instance_template = 309248228 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_template = ''; + protected $instance_template = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetInstantSnapshotRequest.php b/Compute/src/V1/GetInstantSnapshotRequest.php index 9d9447bf945a..b40a8f86c11c 100644 --- a/Compute/src/V1/GetInstantSnapshotRequest.php +++ b/Compute/src/V1/GetInstantSnapshotRequest.php @@ -20,19 +20,19 @@ class GetInstantSnapshotRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string instant_snapshot = 391638626 [(.google.api.field_behavior) = REQUIRED]; */ - private $instant_snapshot = ''; + protected $instant_snapshot = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetInterconnectAttachmentGroupRequest.php b/Compute/src/V1/GetInterconnectAttachmentGroupRequest.php index c6bceaab6411..80dc52f4b8cb 100644 --- a/Compute/src/V1/GetInterconnectAttachmentGroupRequest.php +++ b/Compute/src/V1/GetInterconnectAttachmentGroupRequest.php @@ -20,13 +20,13 @@ class GetInterconnectAttachmentGroupRequest extends \Google\Protobuf\Internal\Me * * Generated from protobuf field string interconnect_attachment_group = 75905012 [(.google.api.field_behavior) = REQUIRED]; */ - private $interconnect_attachment_group = ''; + protected $interconnect_attachment_group = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetInterconnectAttachmentRequest.php b/Compute/src/V1/GetInterconnectAttachmentRequest.php index 3018eba29b39..64e38e2fb8a2 100644 --- a/Compute/src/V1/GetInterconnectAttachmentRequest.php +++ b/Compute/src/V1/GetInterconnectAttachmentRequest.php @@ -20,19 +20,19 @@ class GetInterconnectAttachmentRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string interconnect_attachment = 308135284 [(.google.api.field_behavior) = REQUIRED]; */ - private $interconnect_attachment = ''; + protected $interconnect_attachment = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetInterconnectGroupRequest.php b/Compute/src/V1/GetInterconnectGroupRequest.php index 9241b38a228a..bb88896a0c31 100644 --- a/Compute/src/V1/GetInterconnectGroupRequest.php +++ b/Compute/src/V1/GetInterconnectGroupRequest.php @@ -20,13 +20,13 @@ class GetInterconnectGroupRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string interconnect_group = 388651918 [(.google.api.field_behavior) = REQUIRED]; */ - private $interconnect_group = ''; + protected $interconnect_group = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetInterconnectLocationRequest.php b/Compute/src/V1/GetInterconnectLocationRequest.php index bd1f261aae72..8a7b83eede63 100644 --- a/Compute/src/V1/GetInterconnectLocationRequest.php +++ b/Compute/src/V1/GetInterconnectLocationRequest.php @@ -20,13 +20,13 @@ class GetInterconnectLocationRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string interconnect_location = 492235846 [(.google.api.field_behavior) = REQUIRED]; */ - private $interconnect_location = ''; + protected $interconnect_location = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetInterconnectRemoteLocationRequest.php b/Compute/src/V1/GetInterconnectRemoteLocationRequest.php index 56c28ec20eb6..793336c9bccd 100644 --- a/Compute/src/V1/GetInterconnectRemoteLocationRequest.php +++ b/Compute/src/V1/GetInterconnectRemoteLocationRequest.php @@ -20,13 +20,13 @@ class GetInterconnectRemoteLocationRequest extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field string interconnect_remote_location = 290153949 [(.google.api.field_behavior) = REQUIRED]; */ - private $interconnect_remote_location = ''; + protected $interconnect_remote_location = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetInterconnectRequest.php b/Compute/src/V1/GetInterconnectRequest.php index 05c67a3f53c6..6e966d5d5c56 100644 --- a/Compute/src/V1/GetInterconnectRequest.php +++ b/Compute/src/V1/GetInterconnectRequest.php @@ -20,13 +20,13 @@ class GetInterconnectRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string interconnect = 224601230 [(.google.api.field_behavior) = REQUIRED]; */ - private $interconnect = ''; + protected $interconnect = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetLicenseCodeRequest.php b/Compute/src/V1/GetLicenseCodeRequest.php index ac139a943188..4e641f4ce531 100644 --- a/Compute/src/V1/GetLicenseCodeRequest.php +++ b/Compute/src/V1/GetLicenseCodeRequest.php @@ -20,13 +20,13 @@ class GetLicenseCodeRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string license_code = 1467179 [(.google.api.field_behavior) = REQUIRED]; */ - private $license_code = ''; + protected $license_code = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetLicenseRequest.php b/Compute/src/V1/GetLicenseRequest.php index 61a4b5474606..bdc31ef1e7ca 100644 --- a/Compute/src/V1/GetLicenseRequest.php +++ b/Compute/src/V1/GetLicenseRequest.php @@ -20,13 +20,13 @@ class GetLicenseRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string license = 166757441 [(.google.api.field_behavior) = REQUIRED]; */ - private $license = ''; + protected $license = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetMachineImageRequest.php b/Compute/src/V1/GetMachineImageRequest.php index a98fa25776c5..53a504f2de67 100644 --- a/Compute/src/V1/GetMachineImageRequest.php +++ b/Compute/src/V1/GetMachineImageRequest.php @@ -20,13 +20,13 @@ class GetMachineImageRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string machine_image = 69189475 [(.google.api.field_behavior) = REQUIRED]; */ - private $machine_image = ''; + protected $machine_image = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetMachineTypeRequest.php b/Compute/src/V1/GetMachineTypeRequest.php index c506f42b1a4f..f16dcc7cb835 100644 --- a/Compute/src/V1/GetMachineTypeRequest.php +++ b/Compute/src/V1/GetMachineTypeRequest.php @@ -20,19 +20,19 @@ class GetMachineTypeRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string machine_type = 227711026 [(.google.api.field_behavior) = REQUIRED]; */ - private $machine_type = ''; + protected $machine_type = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetMacsecConfigInterconnectRequest.php b/Compute/src/V1/GetMacsecConfigInterconnectRequest.php index c26b2bc0cc35..30cb87cae7b8 100644 --- a/Compute/src/V1/GetMacsecConfigInterconnectRequest.php +++ b/Compute/src/V1/GetMacsecConfigInterconnectRequest.php @@ -20,13 +20,13 @@ class GetMacsecConfigInterconnectRequest extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field string interconnect = 224601230 [(.google.api.field_behavior) = REQUIRED]; */ - private $interconnect = ''; + protected $interconnect = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetNatIpInfoRouterRequest.php b/Compute/src/V1/GetNatIpInfoRouterRequest.php index 5c18565dfb3e..abd2653c6bd0 100644 --- a/Compute/src/V1/GetNatIpInfoRouterRequest.php +++ b/Compute/src/V1/GetNatIpInfoRouterRequest.php @@ -20,25 +20,25 @@ class GetNatIpInfoRouterRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string nat_name = 425596649; */ - private $nat_name = null; + protected $nat_name = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Name of the Router resource to query for Nat IP information. The name should conform to RFC1035. * * Generated from protobuf field string router = 148608841 [(.google.api.field_behavior) = REQUIRED]; */ - private $router = ''; + protected $router = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetNatMappingInfoRoutersRequest.php b/Compute/src/V1/GetNatMappingInfoRoutersRequest.php index 92de1e2b655d..3418cc0a5fef 100644 --- a/Compute/src/V1/GetNatMappingInfoRoutersRequest.php +++ b/Compute/src/V1/GetNatMappingInfoRoutersRequest.php @@ -20,55 +20,55 @@ class GetNatMappingInfoRoutersRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Name of the nat service to filter the Nat Mapping information. If it is omitted, all nats for this router will be returned. Name should conform to RFC1035. * * Generated from protobuf field optional string nat_name = 425596649; */ - private $nat_name = null; + protected $nat_name = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * Name of the Router resource to query for Nat Mapping information of VM endpoints. * * Generated from protobuf field string router = 148608841 [(.google.api.field_behavior) = REQUIRED]; */ - private $router = ''; + protected $router = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetNetworkAttachmentRequest.php b/Compute/src/V1/GetNetworkAttachmentRequest.php index 966765ea4d60..6722bf1f9231 100644 --- a/Compute/src/V1/GetNetworkAttachmentRequest.php +++ b/Compute/src/V1/GetNetworkAttachmentRequest.php @@ -20,19 +20,19 @@ class GetNetworkAttachmentRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string network_attachment = 224644052 [(.google.api.field_behavior) = REQUIRED]; */ - private $network_attachment = ''; + protected $network_attachment = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region of this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetNetworkEdgeSecurityServiceRequest.php b/Compute/src/V1/GetNetworkEdgeSecurityServiceRequest.php index ea6ba4622ae3..5982ce0f16d2 100644 --- a/Compute/src/V1/GetNetworkEdgeSecurityServiceRequest.php +++ b/Compute/src/V1/GetNetworkEdgeSecurityServiceRequest.php @@ -20,19 +20,19 @@ class GetNetworkEdgeSecurityServiceRequest extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field string network_edge_security_service = 157011879 [(.google.api.field_behavior) = REQUIRED]; */ - private $network_edge_security_service = ''; + protected $network_edge_security_service = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetNetworkEndpointGroupRequest.php b/Compute/src/V1/GetNetworkEndpointGroupRequest.php index 9b85abd55fd6..455a9b4d439e 100644 --- a/Compute/src/V1/GetNetworkEndpointGroupRequest.php +++ b/Compute/src/V1/GetNetworkEndpointGroupRequest.php @@ -20,19 +20,19 @@ class GetNetworkEndpointGroupRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string network_endpoint_group = 433907078 [(.google.api.field_behavior) = REQUIRED]; */ - private $network_endpoint_group = ''; + protected $network_endpoint_group = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * The name of the zone where the network endpoint group is located. It should comply with RFC1035. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetNetworkFirewallPolicyRequest.php b/Compute/src/V1/GetNetworkFirewallPolicyRequest.php index 62981cc0260c..284ac2647509 100644 --- a/Compute/src/V1/GetNetworkFirewallPolicyRequest.php +++ b/Compute/src/V1/GetNetworkFirewallPolicyRequest.php @@ -20,13 +20,13 @@ class GetNetworkFirewallPolicyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string firewall_policy = 498173265 [(.google.api.field_behavior) = REQUIRED]; */ - private $firewall_policy = ''; + protected $firewall_policy = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetNetworkProfileRequest.php b/Compute/src/V1/GetNetworkProfileRequest.php index ddf85a12148e..7f8eb229d320 100644 --- a/Compute/src/V1/GetNetworkProfileRequest.php +++ b/Compute/src/V1/GetNetworkProfileRequest.php @@ -20,13 +20,13 @@ class GetNetworkProfileRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string network_profile = 173112472 [(.google.api.field_behavior) = REQUIRED]; */ - private $network_profile = ''; + protected $network_profile = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetNetworkRequest.php b/Compute/src/V1/GetNetworkRequest.php index 41da5dc9c591..9c193d039c0c 100644 --- a/Compute/src/V1/GetNetworkRequest.php +++ b/Compute/src/V1/GetNetworkRequest.php @@ -20,13 +20,13 @@ class GetNetworkRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string network = 232872494 [(.google.api.field_behavior) = REQUIRED]; */ - private $network = ''; + protected $network = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetNodeGroupRequest.php b/Compute/src/V1/GetNodeGroupRequest.php index 0cb5ca87537b..dd30ffa76d4b 100644 --- a/Compute/src/V1/GetNodeGroupRequest.php +++ b/Compute/src/V1/GetNodeGroupRequest.php @@ -20,19 +20,19 @@ class GetNodeGroupRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string node_group = 469958146 [(.google.api.field_behavior) = REQUIRED]; */ - private $node_group = ''; + protected $node_group = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetNodeTemplateRequest.php b/Compute/src/V1/GetNodeTemplateRequest.php index 55944366420d..60e992583cc9 100644 --- a/Compute/src/V1/GetNodeTemplateRequest.php +++ b/Compute/src/V1/GetNodeTemplateRequest.php @@ -20,19 +20,19 @@ class GetNodeTemplateRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string node_template = 323154455 [(.google.api.field_behavior) = REQUIRED]; */ - private $node_template = ''; + protected $node_template = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * The name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetNodeTypeRequest.php b/Compute/src/V1/GetNodeTypeRequest.php index 984691c7391e..dca3e88c158c 100644 --- a/Compute/src/V1/GetNodeTypeRequest.php +++ b/Compute/src/V1/GetNodeTypeRequest.php @@ -20,19 +20,19 @@ class GetNodeTypeRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string node_type = 465832791 [(.google.api.field_behavior) = REQUIRED]; */ - private $node_type = ''; + protected $node_type = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetOperationalStatusInterconnectAttachmentGroupRequest.php b/Compute/src/V1/GetOperationalStatusInterconnectAttachmentGroupRequest.php index 27edcb72e21d..4b592fb32f55 100644 --- a/Compute/src/V1/GetOperationalStatusInterconnectAttachmentGroupRequest.php +++ b/Compute/src/V1/GetOperationalStatusInterconnectAttachmentGroupRequest.php @@ -20,13 +20,13 @@ class GetOperationalStatusInterconnectAttachmentGroupRequest extends \Google\Pro * * Generated from protobuf field string interconnect_attachment_group = 75905012 [(.google.api.field_behavior) = REQUIRED]; */ - private $interconnect_attachment_group = ''; + protected $interconnect_attachment_group = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetOperationalStatusInterconnectGroupRequest.php b/Compute/src/V1/GetOperationalStatusInterconnectGroupRequest.php index 31ef6be159ab..4682237a081c 100644 --- a/Compute/src/V1/GetOperationalStatusInterconnectGroupRequest.php +++ b/Compute/src/V1/GetOperationalStatusInterconnectGroupRequest.php @@ -20,13 +20,13 @@ class GetOperationalStatusInterconnectGroupRequest extends \Google\Protobuf\Inte * * Generated from protobuf field string interconnect_group = 388651918 [(.google.api.field_behavior) = REQUIRED]; */ - private $interconnect_group = ''; + protected $interconnect_group = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetPacketMirroringRequest.php b/Compute/src/V1/GetPacketMirroringRequest.php index 7b803913799e..569f59cc4d53 100644 --- a/Compute/src/V1/GetPacketMirroringRequest.php +++ b/Compute/src/V1/GetPacketMirroringRequest.php @@ -20,19 +20,19 @@ class GetPacketMirroringRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string packet_mirroring = 22305996 [(.google.api.field_behavior) = REQUIRED]; */ - private $packet_mirroring = ''; + protected $packet_mirroring = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetPacketMirroringRuleNetworkFirewallPolicyRequest.php b/Compute/src/V1/GetPacketMirroringRuleNetworkFirewallPolicyRequest.php index af593cedc44d..2d484dfd564e 100644 --- a/Compute/src/V1/GetPacketMirroringRuleNetworkFirewallPolicyRequest.php +++ b/Compute/src/V1/GetPacketMirroringRuleNetworkFirewallPolicyRequest.php @@ -20,19 +20,19 @@ class GetPacketMirroringRuleNetworkFirewallPolicyRequest extends \Google\Protobu * * Generated from protobuf field string firewall_policy = 498173265 [(.google.api.field_behavior) = REQUIRED]; */ - private $firewall_policy = ''; + protected $firewall_policy = ''; /** * The priority of the rule to get from the firewall policy. * * Generated from protobuf field optional int32 priority = 445151652; */ - private $priority = null; + protected $priority = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetProjectRequest.php b/Compute/src/V1/GetProjectRequest.php index 79fca6d47a19..9229ee9985e8 100644 --- a/Compute/src/V1/GetProjectRequest.php +++ b/Compute/src/V1/GetProjectRequest.php @@ -20,7 +20,7 @@ class GetProjectRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetPublicAdvertisedPrefixeRequest.php b/Compute/src/V1/GetPublicAdvertisedPrefixeRequest.php index 2890cb49b369..1700ff0bae63 100644 --- a/Compute/src/V1/GetPublicAdvertisedPrefixeRequest.php +++ b/Compute/src/V1/GetPublicAdvertisedPrefixeRequest.php @@ -20,13 +20,13 @@ class GetPublicAdvertisedPrefixeRequest extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the PublicAdvertisedPrefix resource to return. * * Generated from protobuf field string public_advertised_prefix = 101874590 [(.google.api.field_behavior) = REQUIRED]; */ - private $public_advertised_prefix = ''; + protected $public_advertised_prefix = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetPublicDelegatedPrefixeRequest.php b/Compute/src/V1/GetPublicDelegatedPrefixeRequest.php index b1872046ebd3..553c1fe5f4b2 100644 --- a/Compute/src/V1/GetPublicDelegatedPrefixeRequest.php +++ b/Compute/src/V1/GetPublicDelegatedPrefixeRequest.php @@ -20,19 +20,19 @@ class GetPublicDelegatedPrefixeRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the PublicDelegatedPrefix resource to return. * * Generated from protobuf field string public_delegated_prefix = 204238440 [(.google.api.field_behavior) = REQUIRED]; */ - private $public_delegated_prefix = ''; + protected $public_delegated_prefix = ''; /** * Name of the region of this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetRegionAutoscalerRequest.php b/Compute/src/V1/GetRegionAutoscalerRequest.php index 81e2f5105649..e2c0a635f4ec 100644 --- a/Compute/src/V1/GetRegionAutoscalerRequest.php +++ b/Compute/src/V1/GetRegionAutoscalerRequest.php @@ -20,19 +20,19 @@ class GetRegionAutoscalerRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string autoscaler = 517258967 [(.google.api.field_behavior) = REQUIRED]; */ - private $autoscaler = ''; + protected $autoscaler = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetRegionBackendServiceRequest.php b/Compute/src/V1/GetRegionBackendServiceRequest.php index 56815dfe554f..f4513a72cd01 100644 --- a/Compute/src/V1/GetRegionBackendServiceRequest.php +++ b/Compute/src/V1/GetRegionBackendServiceRequest.php @@ -20,19 +20,19 @@ class GetRegionBackendServiceRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string backend_service = 306946058 [(.google.api.field_behavior) = REQUIRED]; */ - private $backend_service = ''; + protected $backend_service = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetRegionCommitmentRequest.php b/Compute/src/V1/GetRegionCommitmentRequest.php index e8a756dbb5ed..82e2b9578043 100644 --- a/Compute/src/V1/GetRegionCommitmentRequest.php +++ b/Compute/src/V1/GetRegionCommitmentRequest.php @@ -20,19 +20,19 @@ class GetRegionCommitmentRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string commitment = 482134805 [(.google.api.field_behavior) = REQUIRED]; */ - private $commitment = ''; + protected $commitment = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetRegionDiskRequest.php b/Compute/src/V1/GetRegionDiskRequest.php index a1284ad3d5b6..d576ee374777 100644 --- a/Compute/src/V1/GetRegionDiskRequest.php +++ b/Compute/src/V1/GetRegionDiskRequest.php @@ -20,19 +20,19 @@ class GetRegionDiskRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string disk = 3083677 [(.google.api.field_behavior) = REQUIRED]; */ - private $disk = ''; + protected $disk = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetRegionDiskTypeRequest.php b/Compute/src/V1/GetRegionDiskTypeRequest.php index 33881b3be84c..794669f3501e 100644 --- a/Compute/src/V1/GetRegionDiskTypeRequest.php +++ b/Compute/src/V1/GetRegionDiskTypeRequest.php @@ -20,19 +20,19 @@ class GetRegionDiskTypeRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string disk_type = 93009052 [(.google.api.field_behavior) = REQUIRED]; */ - private $disk_type = ''; + protected $disk_type = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * The name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetRegionHealthCheckRequest.php b/Compute/src/V1/GetRegionHealthCheckRequest.php index dccf7e80ef5b..29d6d2186301 100644 --- a/Compute/src/V1/GetRegionHealthCheckRequest.php +++ b/Compute/src/V1/GetRegionHealthCheckRequest.php @@ -20,19 +20,19 @@ class GetRegionHealthCheckRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string health_check = 308876645 [(.google.api.field_behavior) = REQUIRED]; */ - private $health_check = ''; + protected $health_check = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetRegionHealthCheckServiceRequest.php b/Compute/src/V1/GetRegionHealthCheckServiceRequest.php index 65bd01132d93..8b609a02cb6b 100644 --- a/Compute/src/V1/GetRegionHealthCheckServiceRequest.php +++ b/Compute/src/V1/GetRegionHealthCheckServiceRequest.php @@ -20,19 +20,19 @@ class GetRegionHealthCheckServiceRequest extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field string health_check_service = 408374747 [(.google.api.field_behavior) = REQUIRED]; */ - private $health_check_service = ''; + protected $health_check_service = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetRegionInstanceGroupManagerRequest.php b/Compute/src/V1/GetRegionInstanceGroupManagerRequest.php index fb6be3f6dd2f..e08449a6d936 100644 --- a/Compute/src/V1/GetRegionInstanceGroupManagerRequest.php +++ b/Compute/src/V1/GetRegionInstanceGroupManagerRequest.php @@ -20,19 +20,19 @@ class GetRegionInstanceGroupManagerRequest extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field string instance_group_manager = 249363395 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group_manager = ''; + protected $instance_group_manager = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetRegionInstanceGroupRequest.php b/Compute/src/V1/GetRegionInstanceGroupRequest.php index 5242eab2f5bf..49389538a153 100644 --- a/Compute/src/V1/GetRegionInstanceGroupRequest.php +++ b/Compute/src/V1/GetRegionInstanceGroupRequest.php @@ -20,19 +20,19 @@ class GetRegionInstanceGroupRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string instance_group = 81095253 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group = ''; + protected $instance_group = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetRegionInstanceTemplateRequest.php b/Compute/src/V1/GetRegionInstanceTemplateRequest.php index c9cdb58a6ffd..0145f3a5b06c 100644 --- a/Compute/src/V1/GetRegionInstanceTemplateRequest.php +++ b/Compute/src/V1/GetRegionInstanceTemplateRequest.php @@ -20,19 +20,19 @@ class GetRegionInstanceTemplateRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string instance_template = 309248228 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_template = ''; + protected $instance_template = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * The name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetRegionInstantSnapshotRequest.php b/Compute/src/V1/GetRegionInstantSnapshotRequest.php index 75f4ea104a9e..2d8654ac12ed 100644 --- a/Compute/src/V1/GetRegionInstantSnapshotRequest.php +++ b/Compute/src/V1/GetRegionInstantSnapshotRequest.php @@ -20,19 +20,19 @@ class GetRegionInstantSnapshotRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string instant_snapshot = 391638626 [(.google.api.field_behavior) = REQUIRED]; */ - private $instant_snapshot = ''; + protected $instant_snapshot = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * The name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetRegionNetworkEndpointGroupRequest.php b/Compute/src/V1/GetRegionNetworkEndpointGroupRequest.php index 27f04930fbb9..3f9512e26800 100644 --- a/Compute/src/V1/GetRegionNetworkEndpointGroupRequest.php +++ b/Compute/src/V1/GetRegionNetworkEndpointGroupRequest.php @@ -20,19 +20,19 @@ class GetRegionNetworkEndpointGroupRequest extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field string network_endpoint_group = 433907078 [(.google.api.field_behavior) = REQUIRED]; */ - private $network_endpoint_group = ''; + protected $network_endpoint_group = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * The name of the region where the network endpoint group is located. It should comply with RFC1035. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetRegionNetworkFirewallPolicyRequest.php b/Compute/src/V1/GetRegionNetworkFirewallPolicyRequest.php index 176843d8ffc0..fb579c7b1930 100644 --- a/Compute/src/V1/GetRegionNetworkFirewallPolicyRequest.php +++ b/Compute/src/V1/GetRegionNetworkFirewallPolicyRequest.php @@ -20,19 +20,19 @@ class GetRegionNetworkFirewallPolicyRequest extends \Google\Protobuf\Internal\Me * * Generated from protobuf field string firewall_policy = 498173265 [(.google.api.field_behavior) = REQUIRED]; */ - private $firewall_policy = ''; + protected $firewall_policy = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetRegionNotificationEndpointRequest.php b/Compute/src/V1/GetRegionNotificationEndpointRequest.php index 307f2a68d75f..1a3f0ef13386 100644 --- a/Compute/src/V1/GetRegionNotificationEndpointRequest.php +++ b/Compute/src/V1/GetRegionNotificationEndpointRequest.php @@ -20,19 +20,19 @@ class GetRegionNotificationEndpointRequest extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field string notification_endpoint = 376807017 [(.google.api.field_behavior) = REQUIRED]; */ - private $notification_endpoint = ''; + protected $notification_endpoint = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetRegionOperationRequest.php b/Compute/src/V1/GetRegionOperationRequest.php index 9cec9398a711..4513d7b4b12c 100644 --- a/Compute/src/V1/GetRegionOperationRequest.php +++ b/Compute/src/V1/GetRegionOperationRequest.php @@ -20,19 +20,19 @@ class GetRegionOperationRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string operation = 52090215 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_response_field) = "name"]; */ - private $operation = ''; + protected $operation = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetRegionRequest.php b/Compute/src/V1/GetRegionRequest.php index 8740f416a3a6..4ff9ef934a74 100644 --- a/Compute/src/V1/GetRegionRequest.php +++ b/Compute/src/V1/GetRegionRequest.php @@ -20,13 +20,13 @@ class GetRegionRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region resource to return. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetRegionSecurityPolicyRequest.php b/Compute/src/V1/GetRegionSecurityPolicyRequest.php index cc5068c65246..cd327e14d39f 100644 --- a/Compute/src/V1/GetRegionSecurityPolicyRequest.php +++ b/Compute/src/V1/GetRegionSecurityPolicyRequest.php @@ -20,19 +20,19 @@ class GetRegionSecurityPolicyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Name of the security policy to get. * * Generated from protobuf field string security_policy = 171082513 [(.google.api.field_behavior) = REQUIRED]; */ - private $security_policy = ''; + protected $security_policy = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetRegionSslCertificateRequest.php b/Compute/src/V1/GetRegionSslCertificateRequest.php index 0efa4fe67f87..b6898361454e 100644 --- a/Compute/src/V1/GetRegionSslCertificateRequest.php +++ b/Compute/src/V1/GetRegionSslCertificateRequest.php @@ -20,19 +20,19 @@ class GetRegionSslCertificateRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Name of the SslCertificate resource to return. * * Generated from protobuf field string ssl_certificate = 46443492 [(.google.api.field_behavior) = REQUIRED]; */ - private $ssl_certificate = ''; + protected $ssl_certificate = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetRegionSslPolicyRequest.php b/Compute/src/V1/GetRegionSslPolicyRequest.php index 3e4ef3e732bd..060ec6ef24de 100644 --- a/Compute/src/V1/GetRegionSslPolicyRequest.php +++ b/Compute/src/V1/GetRegionSslPolicyRequest.php @@ -20,19 +20,19 @@ class GetRegionSslPolicyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Name of the SSL policy to update. The name must be 1-63 characters long, and comply with RFC1035. * * Generated from protobuf field string ssl_policy = 295190213 [(.google.api.field_behavior) = REQUIRED]; */ - private $ssl_policy = ''; + protected $ssl_policy = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetRegionTargetHttpProxyRequest.php b/Compute/src/V1/GetRegionTargetHttpProxyRequest.php index fe7ae3ed0cf9..d94300d1ba2b 100644 --- a/Compute/src/V1/GetRegionTargetHttpProxyRequest.php +++ b/Compute/src/V1/GetRegionTargetHttpProxyRequest.php @@ -20,19 +20,19 @@ class GetRegionTargetHttpProxyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Name of the TargetHttpProxy resource to return. * * Generated from protobuf field string target_http_proxy = 206872421 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_http_proxy = ''; + protected $target_http_proxy = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetRegionTargetHttpsProxyRequest.php b/Compute/src/V1/GetRegionTargetHttpsProxyRequest.php index ac28a0655c32..37342d7f5063 100644 --- a/Compute/src/V1/GetRegionTargetHttpsProxyRequest.php +++ b/Compute/src/V1/GetRegionTargetHttpsProxyRequest.php @@ -20,19 +20,19 @@ class GetRegionTargetHttpsProxyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Name of the TargetHttpsProxy resource to return. * * Generated from protobuf field string target_https_proxy = 52336748 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_https_proxy = ''; + protected $target_https_proxy = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetRegionTargetTcpProxyRequest.php b/Compute/src/V1/GetRegionTargetTcpProxyRequest.php index 00035586ad0f..0008cb5edfd5 100644 --- a/Compute/src/V1/GetRegionTargetTcpProxyRequest.php +++ b/Compute/src/V1/GetRegionTargetTcpProxyRequest.php @@ -20,19 +20,19 @@ class GetRegionTargetTcpProxyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Name of the TargetTcpProxy resource to return. * * Generated from protobuf field string target_tcp_proxy = 503065442 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_tcp_proxy = ''; + protected $target_tcp_proxy = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetRegionUrlMapRequest.php b/Compute/src/V1/GetRegionUrlMapRequest.php index 18eddbe6cc31..867db900706f 100644 --- a/Compute/src/V1/GetRegionUrlMapRequest.php +++ b/Compute/src/V1/GetRegionUrlMapRequest.php @@ -20,19 +20,19 @@ class GetRegionUrlMapRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Name of the UrlMap resource to return. * * Generated from protobuf field string url_map = 367020684 [(.google.api.field_behavior) = REQUIRED]; */ - private $url_map = ''; + protected $url_map = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetReservationBlockRequest.php b/Compute/src/V1/GetReservationBlockRequest.php index 1ce63678adac..72d4834d5ce6 100644 --- a/Compute/src/V1/GetReservationBlockRequest.php +++ b/Compute/src/V1/GetReservationBlockRequest.php @@ -20,32 +20,32 @@ class GetReservationBlockRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * The name of the reservation. Name should conform to RFC1035 or be a resource ID. * * Generated from protobuf field string reservation = 47530956 [(.google.api.field_behavior) = REQUIRED]; */ - private $reservation = ''; + protected $reservation = ''; /** * The name of the reservation block. Name should conform to RFC1035 or be a resource ID. * * Generated from protobuf field string reservation_block = 532832858 [(.google.api.field_behavior) = REQUIRED]; */ - private $reservation_block = ''; + protected $reservation_block = ''; /** * View of the Block. * Check the View enum for the list of possible values. * * Generated from protobuf field optional string view = 3619493; */ - private $view = null; + protected $view = null; /** * Name of the zone for this request. Zone name should conform to RFC1035. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetReservationRequest.php b/Compute/src/V1/GetReservationRequest.php index fec9ff4cd43e..eaf85d485fc5 100644 --- a/Compute/src/V1/GetReservationRequest.php +++ b/Compute/src/V1/GetReservationRequest.php @@ -20,19 +20,19 @@ class GetReservationRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the reservation to retrieve. * * Generated from protobuf field string reservation = 47530956 [(.google.api.field_behavior) = REQUIRED]; */ - private $reservation = ''; + protected $reservation = ''; /** * Name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetReservationSubBlockRequest.php b/Compute/src/V1/GetReservationSubBlockRequest.php index 1088b15c6f40..28a885e3ff31 100644 --- a/Compute/src/V1/GetReservationSubBlockRequest.php +++ b/Compute/src/V1/GetReservationSubBlockRequest.php @@ -20,25 +20,25 @@ class GetReservationSubBlockRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string parent_name = 478151936 [(.google.api.field_behavior) = REQUIRED]; */ - private $parent_name = ''; + protected $parent_name = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * The name of the reservation subBlock. Name should conform to RFC1035 or be a resource ID. * * Generated from protobuf field string reservation_sub_block = 22750491 [(.google.api.field_behavior) = REQUIRED]; */ - private $reservation_sub_block = ''; + protected $reservation_sub_block = ''; /** * Name of the zone for this request. Zone name should conform to RFC1035. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetResourcePolicyRequest.php b/Compute/src/V1/GetResourcePolicyRequest.php index 4de309fb08c4..d079e9ad904f 100644 --- a/Compute/src/V1/GetResourcePolicyRequest.php +++ b/Compute/src/V1/GetResourcePolicyRequest.php @@ -20,19 +20,19 @@ class GetResourcePolicyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Name of the resource policy to retrieve. * * Generated from protobuf field string resource_policy = 159240835 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource_policy = ''; + protected $resource_policy = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetRoutePolicyRouterRequest.php b/Compute/src/V1/GetRoutePolicyRouterRequest.php index 057cd60c22a2..be9bcc6380fc 100644 --- a/Compute/src/V1/GetRoutePolicyRouterRequest.php +++ b/Compute/src/V1/GetRoutePolicyRouterRequest.php @@ -20,25 +20,25 @@ class GetRoutePolicyRouterRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string policy = 91071794; */ - private $policy = null; + protected $policy = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Name of the Router resource to query for the route policy. The name should conform to RFC1035. * * Generated from protobuf field string router = 148608841 [(.google.api.field_behavior) = REQUIRED]; */ - private $router = ''; + protected $router = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetRouteRequest.php b/Compute/src/V1/GetRouteRequest.php index 1f80592447fa..19796d9da47f 100644 --- a/Compute/src/V1/GetRouteRequest.php +++ b/Compute/src/V1/GetRouteRequest.php @@ -20,13 +20,13 @@ class GetRouteRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the Route resource to return. * * Generated from protobuf field string route = 108704329 [(.google.api.field_behavior) = REQUIRED]; */ - private $route = ''; + protected $route = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetRouterRequest.php b/Compute/src/V1/GetRouterRequest.php index 2df64111986c..fe7f936f1b1b 100644 --- a/Compute/src/V1/GetRouterRequest.php +++ b/Compute/src/V1/GetRouterRequest.php @@ -20,19 +20,19 @@ class GetRouterRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Name of the Router resource to return. * * Generated from protobuf field string router = 148608841 [(.google.api.field_behavior) = REQUIRED]; */ - private $router = ''; + protected $router = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetRouterStatusRouterRequest.php b/Compute/src/V1/GetRouterStatusRouterRequest.php index 05f189c8aa89..71fae5a57770 100644 --- a/Compute/src/V1/GetRouterStatusRouterRequest.php +++ b/Compute/src/V1/GetRouterStatusRouterRequest.php @@ -20,19 +20,19 @@ class GetRouterStatusRouterRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Name of the Router resource to query. * * Generated from protobuf field string router = 148608841 [(.google.api.field_behavior) = REQUIRED]; */ - private $router = ''; + protected $router = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetRuleFirewallPolicyRequest.php b/Compute/src/V1/GetRuleFirewallPolicyRequest.php index 85756ce81e13..b90e3f4a7caa 100644 --- a/Compute/src/V1/GetRuleFirewallPolicyRequest.php +++ b/Compute/src/V1/GetRuleFirewallPolicyRequest.php @@ -20,13 +20,13 @@ class GetRuleFirewallPolicyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string firewall_policy = 498173265 [(.google.api.field_behavior) = REQUIRED]; */ - private $firewall_policy = ''; + protected $firewall_policy = ''; /** * The priority of the rule to get from the firewall policy. * * Generated from protobuf field optional int32 priority = 445151652; */ - private $priority = null; + protected $priority = null; /** * @param string $firewallPolicy Name of the firewall policy to which the queried rule belongs. diff --git a/Compute/src/V1/GetRuleNetworkFirewallPolicyRequest.php b/Compute/src/V1/GetRuleNetworkFirewallPolicyRequest.php index 42518e4ac669..08511f3f0425 100644 --- a/Compute/src/V1/GetRuleNetworkFirewallPolicyRequest.php +++ b/Compute/src/V1/GetRuleNetworkFirewallPolicyRequest.php @@ -20,19 +20,19 @@ class GetRuleNetworkFirewallPolicyRequest extends \Google\Protobuf\Internal\Mess * * Generated from protobuf field string firewall_policy = 498173265 [(.google.api.field_behavior) = REQUIRED]; */ - private $firewall_policy = ''; + protected $firewall_policy = ''; /** * The priority of the rule to get from the firewall policy. * * Generated from protobuf field optional int32 priority = 445151652; */ - private $priority = null; + protected $priority = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetRuleRegionNetworkFirewallPolicyRequest.php b/Compute/src/V1/GetRuleRegionNetworkFirewallPolicyRequest.php index ea2bfa1f5844..5b3cab560ff7 100644 --- a/Compute/src/V1/GetRuleRegionNetworkFirewallPolicyRequest.php +++ b/Compute/src/V1/GetRuleRegionNetworkFirewallPolicyRequest.php @@ -20,25 +20,25 @@ class GetRuleRegionNetworkFirewallPolicyRequest extends \Google\Protobuf\Interna * * Generated from protobuf field string firewall_policy = 498173265 [(.google.api.field_behavior) = REQUIRED]; */ - private $firewall_policy = ''; + protected $firewall_policy = ''; /** * The priority of the rule to get from the firewall policy. * * Generated from protobuf field optional int32 priority = 445151652; */ - private $priority = null; + protected $priority = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetRuleRegionSecurityPolicyRequest.php b/Compute/src/V1/GetRuleRegionSecurityPolicyRequest.php index 3cecb78d5dbe..c4685f05bd2e 100644 --- a/Compute/src/V1/GetRuleRegionSecurityPolicyRequest.php +++ b/Compute/src/V1/GetRuleRegionSecurityPolicyRequest.php @@ -20,25 +20,25 @@ class GetRuleRegionSecurityPolicyRequest extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field optional int32 priority = 445151652; */ - private $priority = null; + protected $priority = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Name of the security policy to which the queried rule belongs. * * Generated from protobuf field string security_policy = 171082513 [(.google.api.field_behavior) = REQUIRED]; */ - private $security_policy = ''; + protected $security_policy = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetRuleSecurityPolicyRequest.php b/Compute/src/V1/GetRuleSecurityPolicyRequest.php index 090fc221feca..a1b2745feaf9 100644 --- a/Compute/src/V1/GetRuleSecurityPolicyRequest.php +++ b/Compute/src/V1/GetRuleSecurityPolicyRequest.php @@ -20,19 +20,19 @@ class GetRuleSecurityPolicyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int32 priority = 445151652; */ - private $priority = null; + protected $priority = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the security policy to which the queried rule belongs. * * Generated from protobuf field string security_policy = 171082513 [(.google.api.field_behavior) = REQUIRED]; */ - private $security_policy = ''; + protected $security_policy = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetScreenshotInstanceRequest.php b/Compute/src/V1/GetScreenshotInstanceRequest.php index e9c17b6387bb..0b7d7a739484 100644 --- a/Compute/src/V1/GetScreenshotInstanceRequest.php +++ b/Compute/src/V1/GetScreenshotInstanceRequest.php @@ -20,19 +20,19 @@ class GetScreenshotInstanceRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string instance = 18257045 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance = ''; + protected $instance = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetSecurityPolicyRequest.php b/Compute/src/V1/GetSecurityPolicyRequest.php index b5b7be400235..6bafd7803e55 100644 --- a/Compute/src/V1/GetSecurityPolicyRequest.php +++ b/Compute/src/V1/GetSecurityPolicyRequest.php @@ -20,13 +20,13 @@ class GetSecurityPolicyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the security policy to get. * * Generated from protobuf field string security_policy = 171082513 [(.google.api.field_behavior) = REQUIRED]; */ - private $security_policy = ''; + protected $security_policy = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetSerialPortOutputInstanceRequest.php b/Compute/src/V1/GetSerialPortOutputInstanceRequest.php index 02d29e7e40df..21d698d5ccfb 100644 --- a/Compute/src/V1/GetSerialPortOutputInstanceRequest.php +++ b/Compute/src/V1/GetSerialPortOutputInstanceRequest.php @@ -20,31 +20,31 @@ class GetSerialPortOutputInstanceRequest extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field string instance = 18257045 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance = ''; + protected $instance = ''; /** * Specifies which COM or serial port to retrieve data from. * * Generated from protobuf field optional int32 port = 3446913; */ - private $port = null; + protected $port = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Specifies the starting byte position of the output to return. To start with the first byte of output to the specified port, omit this field or set it to `0`. If the output for that byte position is available, this field matches the `start` parameter sent with the request. If the amount of serial console output exceeds the size of the buffer (1 MB), the oldest output is discarded and is no longer available. If the requested start position refers to discarded output, the start position is adjusted to the oldest output still available, and the adjusted start position is returned as the `start` property value. You can also provide a negative start position, which translates to the most recent number of bytes written to the serial port. For example, -3 is interpreted as the most recent 3 bytes written to the serial console. Note that the negative start is bounded by the retained buffer size, and the returned serial console output will not exceed the max buffer size. * * Generated from protobuf field optional int64 start = 109757538; */ - private $start = null; + protected $start = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetServiceAttachmentRequest.php b/Compute/src/V1/GetServiceAttachmentRequest.php index aff433d487a4..fe62bd3391e1 100644 --- a/Compute/src/V1/GetServiceAttachmentRequest.php +++ b/Compute/src/V1/GetServiceAttachmentRequest.php @@ -20,19 +20,19 @@ class GetServiceAttachmentRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region of this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Name of the ServiceAttachment resource to return. * * Generated from protobuf field string service_attachment = 338957549 [(.google.api.field_behavior) = REQUIRED]; */ - private $service_attachment = ''; + protected $service_attachment = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetShieldedInstanceIdentityInstanceRequest.php b/Compute/src/V1/GetShieldedInstanceIdentityInstanceRequest.php index d9de97bec992..b97990d777c0 100644 --- a/Compute/src/V1/GetShieldedInstanceIdentityInstanceRequest.php +++ b/Compute/src/V1/GetShieldedInstanceIdentityInstanceRequest.php @@ -20,19 +20,19 @@ class GetShieldedInstanceIdentityInstanceRequest extends \Google\Protobuf\Intern * * Generated from protobuf field string instance = 18257045 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance = ''; + protected $instance = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetSnapshotRequest.php b/Compute/src/V1/GetSnapshotRequest.php index c22cf86a67c5..19e874a19ff9 100644 --- a/Compute/src/V1/GetSnapshotRequest.php +++ b/Compute/src/V1/GetSnapshotRequest.php @@ -20,13 +20,13 @@ class GetSnapshotRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the Snapshot resource to return. * * Generated from protobuf field string snapshot = 284874180 [(.google.api.field_behavior) = REQUIRED]; */ - private $snapshot = ''; + protected $snapshot = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetSnapshotSettingRequest.php b/Compute/src/V1/GetSnapshotSettingRequest.php index 42f1e9061223..2edb770109fe 100644 --- a/Compute/src/V1/GetSnapshotSettingRequest.php +++ b/Compute/src/V1/GetSnapshotSettingRequest.php @@ -20,7 +20,7 @@ class GetSnapshotSettingRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetSslCertificateRequest.php b/Compute/src/V1/GetSslCertificateRequest.php index b2012c51a1b8..9391fee48ea0 100644 --- a/Compute/src/V1/GetSslCertificateRequest.php +++ b/Compute/src/V1/GetSslCertificateRequest.php @@ -20,13 +20,13 @@ class GetSslCertificateRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the SslCertificate resource to return. * * Generated from protobuf field string ssl_certificate = 46443492 [(.google.api.field_behavior) = REQUIRED]; */ - private $ssl_certificate = ''; + protected $ssl_certificate = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetSslPolicyRequest.php b/Compute/src/V1/GetSslPolicyRequest.php index 5bd1cfcbc6d9..7f0899561862 100644 --- a/Compute/src/V1/GetSslPolicyRequest.php +++ b/Compute/src/V1/GetSslPolicyRequest.php @@ -20,13 +20,13 @@ class GetSslPolicyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the SSL policy to update. The name must be 1-63 characters long, and comply with RFC1035. * * Generated from protobuf field string ssl_policy = 295190213 [(.google.api.field_behavior) = REQUIRED]; */ - private $ssl_policy = ''; + protected $ssl_policy = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetStatusVpnGatewayRequest.php b/Compute/src/V1/GetStatusVpnGatewayRequest.php index 0b66672de67b..3d38b85b27e2 100644 --- a/Compute/src/V1/GetStatusVpnGatewayRequest.php +++ b/Compute/src/V1/GetStatusVpnGatewayRequest.php @@ -20,19 +20,19 @@ class GetStatusVpnGatewayRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Name of the VPN gateway to return. * * Generated from protobuf field string vpn_gateway = 406684153 [(.google.api.field_behavior) = REQUIRED]; */ - private $vpn_gateway = ''; + protected $vpn_gateway = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetStoragePoolRequest.php b/Compute/src/V1/GetStoragePoolRequest.php index 86e8bb323c43..7e5f00ac663f 100644 --- a/Compute/src/V1/GetStoragePoolRequest.php +++ b/Compute/src/V1/GetStoragePoolRequest.php @@ -20,19 +20,19 @@ class GetStoragePoolRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the storage pool to return. * * Generated from protobuf field string storage_pool = 360473440 [(.google.api.field_behavior) = REQUIRED]; */ - private $storage_pool = ''; + protected $storage_pool = ''; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetStoragePoolTypeRequest.php b/Compute/src/V1/GetStoragePoolTypeRequest.php index a0ff6e358838..26cb488a7c3b 100644 --- a/Compute/src/V1/GetStoragePoolTypeRequest.php +++ b/Compute/src/V1/GetStoragePoolTypeRequest.php @@ -20,19 +20,19 @@ class GetStoragePoolTypeRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the storage pool type to return. * * Generated from protobuf field string storage_pool_type = 285999289 [(.google.api.field_behavior) = REQUIRED]; */ - private $storage_pool_type = ''; + protected $storage_pool_type = ''; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetSubnetworkRequest.php b/Compute/src/V1/GetSubnetworkRequest.php index cda2e6bad50e..249f61468a60 100644 --- a/Compute/src/V1/GetSubnetworkRequest.php +++ b/Compute/src/V1/GetSubnetworkRequest.php @@ -20,19 +20,19 @@ class GetSubnetworkRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Name of the Subnetwork resource to return. * * Generated from protobuf field string subnetwork = 307827694 [(.google.api.field_behavior) = REQUIRED]; */ - private $subnetwork = ''; + protected $subnetwork = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetTargetGrpcProxyRequest.php b/Compute/src/V1/GetTargetGrpcProxyRequest.php index b1715cc51227..33f0ac1238ef 100644 --- a/Compute/src/V1/GetTargetGrpcProxyRequest.php +++ b/Compute/src/V1/GetTargetGrpcProxyRequest.php @@ -20,13 +20,13 @@ class GetTargetGrpcProxyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the TargetGrpcProxy resource to return. * * Generated from protobuf field string target_grpc_proxy = 5020283 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_grpc_proxy = ''; + protected $target_grpc_proxy = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetTargetHttpProxyRequest.php b/Compute/src/V1/GetTargetHttpProxyRequest.php index 52d80418fb5f..d6a0b1ab365f 100644 --- a/Compute/src/V1/GetTargetHttpProxyRequest.php +++ b/Compute/src/V1/GetTargetHttpProxyRequest.php @@ -20,13 +20,13 @@ class GetTargetHttpProxyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the TargetHttpProxy resource to return. * * Generated from protobuf field string target_http_proxy = 206872421 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_http_proxy = ''; + protected $target_http_proxy = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetTargetHttpsProxyRequest.php b/Compute/src/V1/GetTargetHttpsProxyRequest.php index 6d93690be991..a8e615ad0eed 100644 --- a/Compute/src/V1/GetTargetHttpsProxyRequest.php +++ b/Compute/src/V1/GetTargetHttpsProxyRequest.php @@ -20,13 +20,13 @@ class GetTargetHttpsProxyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the TargetHttpsProxy resource to return. * * Generated from protobuf field string target_https_proxy = 52336748 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_https_proxy = ''; + protected $target_https_proxy = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetTargetInstanceRequest.php b/Compute/src/V1/GetTargetInstanceRequest.php index 614ad6ff6049..644a817125a2 100644 --- a/Compute/src/V1/GetTargetInstanceRequest.php +++ b/Compute/src/V1/GetTargetInstanceRequest.php @@ -20,19 +20,19 @@ class GetTargetInstanceRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the TargetInstance resource to return. * * Generated from protobuf field string target_instance = 289769347 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_instance = ''; + protected $target_instance = ''; /** * Name of the zone scoping this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetTargetPoolRequest.php b/Compute/src/V1/GetTargetPoolRequest.php index 3756ae55042b..2a332b3809c9 100644 --- a/Compute/src/V1/GetTargetPoolRequest.php +++ b/Compute/src/V1/GetTargetPoolRequest.php @@ -20,19 +20,19 @@ class GetTargetPoolRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Name of the TargetPool resource to return. * * Generated from protobuf field string target_pool = 62796298 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_pool = ''; + protected $target_pool = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetTargetSslProxyRequest.php b/Compute/src/V1/GetTargetSslProxyRequest.php index 1f73e6c37e6e..3d9ae145ee4e 100644 --- a/Compute/src/V1/GetTargetSslProxyRequest.php +++ b/Compute/src/V1/GetTargetSslProxyRequest.php @@ -20,13 +20,13 @@ class GetTargetSslProxyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the TargetSslProxy resource to return. * * Generated from protobuf field string target_ssl_proxy = 338795853 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_ssl_proxy = ''; + protected $target_ssl_proxy = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetTargetTcpProxyRequest.php b/Compute/src/V1/GetTargetTcpProxyRequest.php index 1b178d23f78a..1e6f8525d0f7 100644 --- a/Compute/src/V1/GetTargetTcpProxyRequest.php +++ b/Compute/src/V1/GetTargetTcpProxyRequest.php @@ -20,13 +20,13 @@ class GetTargetTcpProxyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the TargetTcpProxy resource to return. * * Generated from protobuf field string target_tcp_proxy = 503065442 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_tcp_proxy = ''; + protected $target_tcp_proxy = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetTargetVpnGatewayRequest.php b/Compute/src/V1/GetTargetVpnGatewayRequest.php index 7f5fb8313a3e..a27bfe1925f8 100644 --- a/Compute/src/V1/GetTargetVpnGatewayRequest.php +++ b/Compute/src/V1/GetTargetVpnGatewayRequest.php @@ -20,19 +20,19 @@ class GetTargetVpnGatewayRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Name of the target VPN gateway to return. * * Generated from protobuf field string target_vpn_gateway = 532512843 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_vpn_gateway = ''; + protected $target_vpn_gateway = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetUrlMapRequest.php b/Compute/src/V1/GetUrlMapRequest.php index 97872014fcaf..d678b2e1a7f2 100644 --- a/Compute/src/V1/GetUrlMapRequest.php +++ b/Compute/src/V1/GetUrlMapRequest.php @@ -20,13 +20,13 @@ class GetUrlMapRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the UrlMap resource to return. * * Generated from protobuf field string url_map = 367020684 [(.google.api.field_behavior) = REQUIRED]; */ - private $url_map = ''; + protected $url_map = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetVpnGatewayRequest.php b/Compute/src/V1/GetVpnGatewayRequest.php index 3092bf3214f6..df0084c5b273 100644 --- a/Compute/src/V1/GetVpnGatewayRequest.php +++ b/Compute/src/V1/GetVpnGatewayRequest.php @@ -20,19 +20,19 @@ class GetVpnGatewayRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Name of the VPN gateway to return. * * Generated from protobuf field string vpn_gateway = 406684153 [(.google.api.field_behavior) = REQUIRED]; */ - private $vpn_gateway = ''; + protected $vpn_gateway = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetVpnTunnelRequest.php b/Compute/src/V1/GetVpnTunnelRequest.php index 5ce203f80f45..fe5671303a1d 100644 --- a/Compute/src/V1/GetVpnTunnelRequest.php +++ b/Compute/src/V1/GetVpnTunnelRequest.php @@ -20,19 +20,19 @@ class GetVpnTunnelRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Name of the VpnTunnel resource to return. * * Generated from protobuf field string vpn_tunnel = 143821331 [(.google.api.field_behavior) = REQUIRED]; */ - private $vpn_tunnel = ''; + protected $vpn_tunnel = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetXpnHostProjectRequest.php b/Compute/src/V1/GetXpnHostProjectRequest.php index 3b7abf5e4445..1d57ff9c84bb 100644 --- a/Compute/src/V1/GetXpnHostProjectRequest.php +++ b/Compute/src/V1/GetXpnHostProjectRequest.php @@ -20,7 +20,7 @@ class GetXpnHostProjectRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetXpnResourcesProjectsRequest.php b/Compute/src/V1/GetXpnResourcesProjectsRequest.php index 00395ddafd14..7e6ce84fc0c2 100644 --- a/Compute/src/V1/GetXpnResourcesProjectsRequest.php +++ b/Compute/src/V1/GetXpnResourcesProjectsRequest.php @@ -20,37 +20,37 @@ class GetXpnResourcesProjectsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetZoneOperationRequest.php b/Compute/src/V1/GetZoneOperationRequest.php index 9fb49eb15b6b..c466b176c718 100644 --- a/Compute/src/V1/GetZoneOperationRequest.php +++ b/Compute/src/V1/GetZoneOperationRequest.php @@ -20,19 +20,19 @@ class GetZoneOperationRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string operation = 52090215 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_response_field) = "name"]; */ - private $operation = ''; + protected $operation = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GetZoneRequest.php b/Compute/src/V1/GetZoneRequest.php index 15cefeb826c3..3dcdecb6e814 100644 --- a/Compute/src/V1/GetZoneRequest.php +++ b/Compute/src/V1/GetZoneRequest.php @@ -20,13 +20,13 @@ class GetZoneRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the zone resource to return. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/GlobalAddressesClient.php b/Compute/src/V1/GlobalAddressesClient.php deleted file mode 100644 index f5ff4e821aeb..000000000000 --- a/Compute/src/V1/GlobalAddressesClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * The URL of the destination address to move to. This can be a full or partial URL. For example, the following are all valid URLs to a address: - https://www.googleapis.com/compute/v1/projects/project /global/addresses/address - projects/project/global/addresses/address Note that destination project must be different from the source project. So /global/addresses/address is not valid partial url. * * Generated from protobuf field optional string destination_address = 371693763; */ - private $destination_address = null; + protected $destination_address = null; /** * Constructor. diff --git a/Compute/src/V1/GlobalForwardingRulesClient.php b/Compute/src/V1/GlobalForwardingRulesClient.php deleted file mode 100644 index c803fb08ba06..000000000000 --- a/Compute/src/V1/GlobalForwardingRulesClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional string etag = 3123477; */ - private $etag = null; + protected $etag = null; /** * 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 in general a valid policy but certain services (like Projects) might reject them. * * Generated from protobuf field optional .google.cloud.compute.v1.Policy policy = 91071794; */ - private $policy = null; + protected $policy = null; /** * Constructor. diff --git a/Compute/src/V1/GlobalPublicDelegatedPrefixesClient.php b/Compute/src/V1/GlobalPublicDelegatedPrefixesClient.php deleted file mode 100644 index f77bfa567faa..000000000000 --- a/Compute/src/V1/GlobalPublicDelegatedPrefixesClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional string label_fingerprint = 178124825; */ - private $label_fingerprint = null; + protected $label_fingerprint = null; /** * A list of labels to apply for this resource. Each label must comply with the requirements for labels. For example, "webserver-frontend": "images". A label value can also be empty (e.g. "my-label": ""). * diff --git a/Compute/src/V1/GlobalSetPolicyRequest.php b/Compute/src/V1/GlobalSetPolicyRequest.php index c630b72954a5..6d97cffa2636 100644 --- a/Compute/src/V1/GlobalSetPolicyRequest.php +++ b/Compute/src/V1/GlobalSetPolicyRequest.php @@ -25,13 +25,13 @@ class GlobalSetPolicyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string etag = 3123477; */ - private $etag = null; + protected $etag = null; /** * 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 in general a valid policy but certain services (like Projects) might reject them. * * Generated from protobuf field optional .google.cloud.compute.v1.Policy policy = 91071794; */ - private $policy = null; + protected $policy = null; /** * Constructor. diff --git a/Compute/src/V1/GroupMaintenanceInfo.php b/Compute/src/V1/GroupMaintenanceInfo.php index 2813185cccbf..4adc75481700 100644 --- a/Compute/src/V1/GroupMaintenanceInfo.php +++ b/Compute/src/V1/GroupMaintenanceInfo.php @@ -20,50 +20,50 @@ class GroupMaintenanceInfo extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int32 instance_maintenance_ongoing_count = 137611253; */ - private $instance_maintenance_ongoing_count = null; + protected $instance_maintenance_ongoing_count = null; /** * Describes number of instances that have pending maintenance. * * Generated from protobuf field optional int32 instance_maintenance_pending_count = 76612881; */ - private $instance_maintenance_pending_count = null; + protected $instance_maintenance_pending_count = null; /** * Progress for ongoing maintenance for this group of VMs/hosts. Describes number of hosts in the block that have ongoing maintenance. * * Generated from protobuf field optional int32 maintenance_ongoing_count = 219781919; */ - private $maintenance_ongoing_count = null; + protected $maintenance_ongoing_count = null; /** * Progress for ongoing maintenance for this group of VMs/hosts. Describes number of hosts in the block that have pending maintenance. * * Generated from protobuf field optional int32 maintenance_pending_count = 158783547; */ - private $maintenance_pending_count = null; + protected $maintenance_pending_count = null; /** * The type of maintenance for the reservation. * Check the SchedulingType enum for the list of possible values. * * Generated from protobuf field optional string scheduling_type = 199835397; */ - private $scheduling_type = null; + protected $scheduling_type = null; /** * Describes number of subblock Infrastructure that has ongoing maintenance. Here, Subblock Infrastructure Maintenance pertains to upstream hardware contained in the Subblock that is necessary for a VM Family(e.g. NVLink Domains). Not all VM Families will support this field. * * Generated from protobuf field optional int32 subblock_infra_maintenance_ongoing_count = 366161790; */ - private $subblock_infra_maintenance_ongoing_count = null; + protected $subblock_infra_maintenance_ongoing_count = null; /** * Describes number of subblock Infrastructure that has pending maintenance. Here, Subblock Infrastructure Maintenance pertains to upstream hardware contained in the Subblock that is necessary for a VM Family (e.g. NVLink Domains). Not all VM Families will support this field. * * Generated from protobuf field optional int32 subblock_infra_maintenance_pending_count = 305163418; */ - private $subblock_infra_maintenance_pending_count = null; + protected $subblock_infra_maintenance_pending_count = null; /** * Maintenance information on this group of VMs. * * Generated from protobuf field optional .google.cloud.compute.v1.UpcomingMaintenance upcoming_group_maintenance = 393438448; */ - private $upcoming_group_maintenance = null; + protected $upcoming_group_maintenance = null; /** * Constructor. diff --git a/Compute/src/V1/GuestAttributes.php b/Compute/src/V1/GuestAttributes.php index 2f3bb6c39257..c348e89137ba 100644 --- a/Compute/src/V1/GuestAttributes.php +++ b/Compute/src/V1/GuestAttributes.php @@ -20,37 +20,37 @@ class GuestAttributes extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * The path to be queried. This can be the default namespace ('') or a nested namespace ('\/') or a specified key ('\/\'). * * Generated from protobuf field optional string query_path = 368591164; */ - private $query_path = null; + protected $query_path = null; /** * [Output Only] The value of the requested queried path. * * Generated from protobuf field optional .google.cloud.compute.v1.GuestAttributesValue query_value = 157570874; */ - private $query_value = null; + protected $query_value = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * The key to search for. * * Generated from protobuf field optional string variable_key = 164364828; */ - private $variable_key = null; + protected $variable_key = null; /** * [Output Only] The value found for the requested key. * * Generated from protobuf field optional string variable_value = 124582382; */ - private $variable_value = null; + protected $variable_value = null; /** * Constructor. diff --git a/Compute/src/V1/GuestAttributesEntry.php b/Compute/src/V1/GuestAttributesEntry.php index bbfe2711c297..6a0e33dc33f0 100644 --- a/Compute/src/V1/GuestAttributesEntry.php +++ b/Compute/src/V1/GuestAttributesEntry.php @@ -20,19 +20,19 @@ class GuestAttributesEntry extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string key = 106079; */ - private $key = null; + protected $key = null; /** * Namespace for the guest attribute entry. * * Generated from protobuf field optional string namespace = 178476379; */ - private $namespace = null; + protected $namespace = null; /** * Value for the guest attribute entry. * * Generated from protobuf field optional string value = 111972721; */ - private $value = null; + protected $value = null; /** * Constructor. diff --git a/Compute/src/V1/GuestOsFeature.php b/Compute/src/V1/GuestOsFeature.php index abaa9a431f90..a15b3f97b3d6 100644 --- a/Compute/src/V1/GuestOsFeature.php +++ b/Compute/src/V1/GuestOsFeature.php @@ -21,7 +21,7 @@ class GuestOsFeature extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string type = 3575610; */ - private $type = null; + protected $type = null; /** * Constructor. diff --git a/Compute/src/V1/HTTP2HealthCheck.php b/Compute/src/V1/HTTP2HealthCheck.php index d69cf3a5286b..cdbe78cce766 100644 --- a/Compute/src/V1/HTTP2HealthCheck.php +++ b/Compute/src/V1/HTTP2HealthCheck.php @@ -19,45 +19,45 @@ class HTTP2HealthCheck extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string host = 3208616; */ - private $host = null; + protected $host = null; /** * The TCP port number to which the health check prober sends packets. The default value is 443. Valid values are 1 through 65535. * * Generated from protobuf field optional int32 port = 3446913; */ - private $port = null; + protected $port = null; /** * Not supported. * * Generated from protobuf field optional string port_name = 41534345; */ - private $port_name = null; + protected $port_name = null; /** * Specifies how a port is selected for health checking. Can be one of the following values: USE_FIXED_PORT: Specifies a port number explicitly using the port field in the health check. Supported by backend services for passthrough load balancers and backend services for proxy load balancers. Not supported by target pools. The health check supports all backends supported by the backend service provided the backend can be health checked. For example, GCE_VM_IP network endpoint groups, GCE_VM_IP_PORT network endpoint groups, and instance group backends. USE_NAMED_PORT: Not supported. USE_SERVING_PORT: Provides an indirect method of specifying the health check port by referring to the backend service. Only supported by backend services for proxy load balancers. Not supported by target pools. Not supported by backend services for passthrough load balancers. Supports all backends that can be health checked; for example, GCE_VM_IP_PORT network endpoint groups and instance group backends. For GCE_VM_IP_PORT network endpoint group backends, the health check uses the port number specified for each endpoint in the network endpoint group. For instance group backends, the health check uses the port number determined by looking up the backend service's named port in the instance group's list of named ports. * Check the PortSpecification enum for the list of possible values. * * Generated from protobuf field optional string port_specification = 51590597; */ - private $port_specification = null; + protected $port_specification = null; /** * Specifies the type of proxy header to append before sending data to the backend, either NONE or PROXY_V1. The default is NONE. * Check the ProxyHeader enum for the list of possible values. * * Generated from protobuf field optional string proxy_header = 160374142; */ - private $proxy_header = null; + protected $proxy_header = null; /** * The request path of the HTTP/2 health check request. The default value is /. Must comply with RFC3986. * * Generated from protobuf field optional string request_path = 229403605; */ - private $request_path = null; + protected $request_path = null; /** * Creates a content-based HTTP/2 health check. In addition to the required HTTP 200 (OK) status code, you can configure the health check to pass only when the backend sends this specific ASCII response string within the first 1024 bytes of the HTTP response body. For details, see: https://cloud.google.com/load-balancing/docs/health-check-concepts#criteria-protocol-http * * Generated from protobuf field optional string response = 196547649; */ - private $response = null; + protected $response = null; /** * Constructor. diff --git a/Compute/src/V1/HTTPHealthCheck.php b/Compute/src/V1/HTTPHealthCheck.php index e84764b88d43..6a41a50abd26 100644 --- a/Compute/src/V1/HTTPHealthCheck.php +++ b/Compute/src/V1/HTTPHealthCheck.php @@ -19,45 +19,45 @@ class HTTPHealthCheck extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string host = 3208616; */ - private $host = null; + protected $host = null; /** * The TCP port number to which the health check prober sends packets. The default value is 80. Valid values are 1 through 65535. * * Generated from protobuf field optional int32 port = 3446913; */ - private $port = null; + protected $port = null; /** * Not supported. * * Generated from protobuf field optional string port_name = 41534345; */ - private $port_name = null; + protected $port_name = null; /** * Specifies how a port is selected for health checking. Can be one of the following values: USE_FIXED_PORT: Specifies a port number explicitly using the port field in the health check. Supported by backend services for passthrough load balancers and backend services for proxy load balancers. Also supported in legacy HTTP health checks for target pools. The health check supports all backends supported by the backend service provided the backend can be health checked. For example, GCE_VM_IP network endpoint groups, GCE_VM_IP_PORT network endpoint groups, and instance group backends. USE_NAMED_PORT: Not supported. USE_SERVING_PORT: Provides an indirect method of specifying the health check port by referring to the backend service. Only supported by backend services for proxy load balancers. Not supported by target pools. Not supported by backend services for pass-through load balancers. Supports all backends that can be health checked; for example, GCE_VM_IP_PORT network endpoint groups and instance group backends. For GCE_VM_IP_PORT network endpoint group backends, the health check uses the port number specified for each endpoint in the network endpoint group. For instance group backends, the health check uses the port number determined by looking up the backend service's named port in the instance group's list of named ports. * Check the PortSpecification enum for the list of possible values. * * Generated from protobuf field optional string port_specification = 51590597; */ - private $port_specification = null; + protected $port_specification = null; /** * Specifies the type of proxy header to append before sending data to the backend, either NONE or PROXY_V1. The default is NONE. * Check the ProxyHeader enum for the list of possible values. * * Generated from protobuf field optional string proxy_header = 160374142; */ - private $proxy_header = null; + protected $proxy_header = null; /** * The request path of the HTTP health check request. The default value is /. Must comply with RFC3986. * * Generated from protobuf field optional string request_path = 229403605; */ - private $request_path = null; + protected $request_path = null; /** * Creates a content-based HTTP health check. In addition to the required HTTP 200 (OK) status code, you can configure the health check to pass only when the backend sends this specific ASCII response string within the first 1024 bytes of the HTTP response body. For details, see: https://cloud.google.com/load-balancing/docs/health-check-concepts#criteria-protocol-http * * Generated from protobuf field optional string response = 196547649; */ - private $response = null; + protected $response = null; /** * Constructor. diff --git a/Compute/src/V1/HTTPSHealthCheck.php b/Compute/src/V1/HTTPSHealthCheck.php index 4c11a2e56dbc..6cc30b173595 100644 --- a/Compute/src/V1/HTTPSHealthCheck.php +++ b/Compute/src/V1/HTTPSHealthCheck.php @@ -19,45 +19,45 @@ class HTTPSHealthCheck extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string host = 3208616; */ - private $host = null; + protected $host = null; /** * The TCP port number to which the health check prober sends packets. The default value is 443. Valid values are 1 through 65535. * * Generated from protobuf field optional int32 port = 3446913; */ - private $port = null; + protected $port = null; /** * Not supported. * * Generated from protobuf field optional string port_name = 41534345; */ - private $port_name = null; + protected $port_name = null; /** * Specifies how a port is selected for health checking. Can be one of the following values: USE_FIXED_PORT: Specifies a port number explicitly using the port field in the health check. Supported by backend services for passthrough load balancers and backend services for proxy load balancers. Not supported by target pools. The health check supports all backends supported by the backend service provided the backend can be health checked. For example, GCE_VM_IP network endpoint groups, GCE_VM_IP_PORT network endpoint groups, and instance group backends. USE_NAMED_PORT: Not supported. USE_SERVING_PORT: Provides an indirect method of specifying the health check port by referring to the backend service. Only supported by backend services for proxy load balancers. Not supported by target pools. Not supported by backend services for passthrough load balancers. Supports all backends that can be health checked; for example, GCE_VM_IP_PORT network endpoint groups and instance group backends. For GCE_VM_IP_PORT network endpoint group backends, the health check uses the port number specified for each endpoint in the network endpoint group. For instance group backends, the health check uses the port number determined by looking up the backend service's named port in the instance group's list of named ports. * Check the PortSpecification enum for the list of possible values. * * Generated from protobuf field optional string port_specification = 51590597; */ - private $port_specification = null; + protected $port_specification = null; /** * Specifies the type of proxy header to append before sending data to the backend, either NONE or PROXY_V1. The default is NONE. * Check the ProxyHeader enum for the list of possible values. * * Generated from protobuf field optional string proxy_header = 160374142; */ - private $proxy_header = null; + protected $proxy_header = null; /** * The request path of the HTTPS health check request. The default value is /. Must comply with RFC3986. * * Generated from protobuf field optional string request_path = 229403605; */ - private $request_path = null; + protected $request_path = null; /** * Creates a content-based HTTPS health check. In addition to the required HTTP 200 (OK) status code, you can configure the health check to pass only when the backend sends this specific ASCII response string within the first 1024 bytes of the HTTP response body. For details, see: https://cloud.google.com/load-balancing/docs/health-check-concepts#criteria-protocol-http * * Generated from protobuf field optional string response = 196547649; */ - private $response = null; + protected $response = null; /** * Constructor. diff --git a/Compute/src/V1/HealthCheck.php b/Compute/src/V1/HealthCheck.php index d3e37ad14f3c..dfb4815d27f6 100644 --- a/Compute/src/V1/HealthCheck.php +++ b/Compute/src/V1/HealthCheck.php @@ -9,7 +9,7 @@ use Google\Protobuf\Internal\GPBUtil; /** - * Represents a health check resource. Google Compute Engine has two health check resources: * [Regional](/compute/docs/reference/rest/v1/regionHealthChecks) * [Global](https://cloud.google.com/compute/docs/reference/rest/v1/healthChecks) These health check resources can be used for load balancing and for autohealing VMs in a managed instance group (MIG). **Load balancing** Health check requirements vary depending on the type of load balancer. For details about the type of health check supported for each load balancer and corresponding backend type, see Health checks overview: Load balancer guide. **Autohealing in MIGs** The health checks that you use for autohealing VMs in a MIG can be either regional or global. For more information, see Set up an application health check and autohealing. For more information, see Health checks overview. + * Represents a health check resource. Google Compute Engine has two health check resources: * [Regional](/compute/docs/reference/rest/v1/regionHealthChecks) * [Global](/compute/docs/reference/rest/v1/healthChecks) These health check resources can be used for load balancing and for autohealing VMs in a managed instance group (MIG). **Load balancing** Health check requirements vary depending on the type of load balancer. For details about the type of health check supported for each load balancer and corresponding backend type, see Health checks overview: Load balancer guide. **Autohealing in MIGs** The health checks that you use for autohealing VMs in a MIG can be either regional or global. For more information, see Set up an application health check and autohealing. For more information, see Health checks overview. * * Generated from protobuf message google.cloud.compute.v1.HealthCheck */ @@ -20,77 +20,77 @@ class HealthCheck extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int32 check_interval_sec = 345561006; */ - private $check_interval_sec = null; + protected $check_interval_sec = null; /** * [Output Only] Creation timestamp in 3339 text format. * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * An optional description of this resource. Provide this property when you create the resource. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * Generated from protobuf field optional .google.cloud.compute.v1.GRPCHealthCheck grpc_health_check = 85529574; */ - private $grpc_health_check = null; + protected $grpc_health_check = null; /** * A so-far unhealthy instance will be marked healthy after this many consecutive successes. The default value is 2. * * Generated from protobuf field optional int32 healthy_threshold = 403212361; */ - private $healthy_threshold = null; + protected $healthy_threshold = null; /** * Generated from protobuf field optional .google.cloud.compute.v1.HTTP2HealthCheck http2_health_check = 11360986; */ - private $http2_health_check = null; + protected $http2_health_check = null; /** * Generated from protobuf field optional .google.cloud.compute.v1.HTTPHealthCheck http_health_check = 412586940; */ - private $http_health_check = null; + protected $http_health_check = null; /** * Generated from protobuf field optional .google.cloud.compute.v1.HTTPSHealthCheck https_health_check = 436046905; */ - private $https_health_check = null; + protected $https_health_check = null; /** * [Output Only] The unique identifier for the resource. This identifier is defined by the server. * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * Type of the resource. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * Configure logging on this health check. * * Generated from protobuf field optional .google.cloud.compute.v1.HealthCheckLogConfig log_config = 351299741; */ - private $log_config = null; + protected $log_config = null; /** * Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. For example, a name that is 1-63 characters long, matches the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?`, and otherwise complies with RFC1035. This regular expression describes a name where the first character is a lowercase letter, and all following characters are a dash, lowercase letter, or digit, except the last character, which isn't a dash. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * [Output Only] Region where the health check resides. Not applicable to global health checks. * * Generated from protobuf field optional string region = 138946292; */ - private $region = null; + protected $region = null; /** * [Output Only] Server-defined URL for the resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * The list of cloud regions from which health checks are performed. If any regions are specified, then exactly 3 regions should be specified. The region names must be valid names of Google Cloud regions. This can only be set for global health check. If this list is non-empty, then there are restrictions on what other health check fields are supported and what other resources can use this health check: - SSL, HTTP2, and GRPC protocols are not supported. - The TCP request field is not supported. - The proxyHeader field for HTTP, HTTPS, and TCP is not supported. - The checkIntervalSec field must be at least 30. - The health check cannot be used with BackendService nor with managed instance group auto-healing. * @@ -100,30 +100,30 @@ class HealthCheck extends \Google\Protobuf\Internal\Message /** * Generated from protobuf field optional .google.cloud.compute.v1.SSLHealthCheck ssl_health_check = 280032440; */ - private $ssl_health_check = null; + protected $ssl_health_check = null; /** * Generated from protobuf field optional .google.cloud.compute.v1.TCPHealthCheck tcp_health_check = 469980419; */ - private $tcp_health_check = null; + protected $tcp_health_check = null; /** * How long (in seconds) to wait before claiming failure. The default value is 5 seconds. It is invalid for timeoutSec to have greater value than checkIntervalSec. * * Generated from protobuf field optional int32 timeout_sec = 79994995; */ - private $timeout_sec = null; + protected $timeout_sec = null; /** * Specifies the type of the healthCheck, either TCP, SSL, HTTP, HTTPS, HTTP2 or GRPC. Exactly one of the protocol-specific health check fields must be specified, which must match type field. * Check the Type enum for the list of possible values. * * Generated from protobuf field optional string type = 3575610; */ - private $type = null; + protected $type = null; /** * A so-far healthy instance will be marked unhealthy after this many consecutive failures. The default value is 2. * * Generated from protobuf field optional int32 unhealthy_threshold = 227958480; */ - private $unhealthy_threshold = null; + protected $unhealthy_threshold = null; /** * Constructor. diff --git a/Compute/src/V1/HealthCheckList.php b/Compute/src/V1/HealthCheckList.php index e0caf40099f7..d15ed900504b 100644 --- a/Compute/src/V1/HealthCheckList.php +++ b/Compute/src/V1/HealthCheckList.php @@ -20,7 +20,7 @@ class HealthCheckList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of HealthCheck resources. * @@ -32,25 +32,25 @@ class HealthCheckList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/HealthCheckLogConfig.php b/Compute/src/V1/HealthCheckLogConfig.php index 58c9a6c00921..c41cac0345a3 100644 --- a/Compute/src/V1/HealthCheckLogConfig.php +++ b/Compute/src/V1/HealthCheckLogConfig.php @@ -20,7 +20,7 @@ class HealthCheckLogConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional bool enable = 311764355; */ - private $enable = null; + protected $enable = null; /** * Constructor. diff --git a/Compute/src/V1/HealthCheckReference.php b/Compute/src/V1/HealthCheckReference.php index ea7141303825..cfe94d47fac6 100644 --- a/Compute/src/V1/HealthCheckReference.php +++ b/Compute/src/V1/HealthCheckReference.php @@ -18,7 +18,7 @@ class HealthCheckReference extends \Google\Protobuf\Internal\Message /** * Generated from protobuf field optional string health_check = 308876645; */ - private $health_check = null; + protected $health_check = null; /** * Constructor. diff --git a/Compute/src/V1/HealthCheckService.php b/Compute/src/V1/HealthCheckService.php index 3ef8103c13a4..79749ee14ec7 100644 --- a/Compute/src/V1/HealthCheckService.php +++ b/Compute/src/V1/HealthCheckService.php @@ -20,19 +20,19 @@ class HealthCheckService extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * An optional description of this resource. Provide this property when you create the resource. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * Fingerprint of this resource. A hash of the contents stored in this object. This field is used in optimistic locking. This field will be ignored when inserting a HealthCheckService. An up-to-date fingerprint must be provided in order to patch/update the HealthCheckService; Otherwise, the request will fail with error 412 conditionNotMet. To see the latest fingerprint, make a get() request to retrieve the HealthCheckService. * * Generated from protobuf field optional string fingerprint = 234678500; */ - private $fingerprint = null; + protected $fingerprint = null; /** * A list of URLs to the HealthCheck resources. Must have at least one HealthCheck, and not more than 10 for regional HealthCheckService, and not more than 1 for global HealthCheckService. HealthCheck resources must have portSpecification=USE_SERVING_PORT or portSpecification=USE_FIXED_PORT. For regional HealthCheckService, the HealthCheck must be regional and in the same region. For global HealthCheckService, HealthCheck must be global. Mix of regional and global HealthChecks is not supported. Multiple regional HealthChecks must belong to the same region. Regional HealthChecks must belong to the same region as zones of NetworkEndpointGroups. For global HealthCheckService using global INTERNET_IP_PORT NetworkEndpointGroups, the global HealthChecks must specify sourceRegions, and HealthChecks that specify sourceRegions can only be used with global INTERNET_IP_PORT NetworkEndpointGroups. * @@ -45,25 +45,25 @@ class HealthCheckService extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string health_status_aggregation_policy = 253163129; */ - private $health_status_aggregation_policy = null; + protected $health_status_aggregation_policy = null; /** * [Output Only] The unique identifier for the resource. This identifier is defined by the server. * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * [Output only] Type of the resource. Always compute#healthCheckServicefor health check services. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * Name of the resource. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * A list of URLs to the NetworkEndpointGroup resources. Must not have more than 100. For regional HealthCheckService, NEGs must be in zones in the region of the HealthCheckService. For global HealthCheckServices, the NetworkEndpointGroups must be global INTERNET_IP_PORT. * @@ -81,13 +81,13 @@ class HealthCheckService extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string region = 138946292; */ - private $region = null; + protected $region = null; /** * [Output Only] Server-defined URL for the resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * Constructor. diff --git a/Compute/src/V1/HealthCheckServiceReference.php b/Compute/src/V1/HealthCheckServiceReference.php index 90eda9307863..40ddcb9d5981 100644 --- a/Compute/src/V1/HealthCheckServiceReference.php +++ b/Compute/src/V1/HealthCheckServiceReference.php @@ -18,7 +18,7 @@ class HealthCheckServiceReference extends \Google\Protobuf\Internal\Message /** * Generated from protobuf field optional string health_check_service = 408374747; */ - private $health_check_service = null; + protected $health_check_service = null; /** * Constructor. diff --git a/Compute/src/V1/HealthCheckServicesList.php b/Compute/src/V1/HealthCheckServicesList.php index fbf4a586a5bc..3efa5f339fa4 100644 --- a/Compute/src/V1/HealthCheckServicesList.php +++ b/Compute/src/V1/HealthCheckServicesList.php @@ -19,7 +19,7 @@ class HealthCheckServicesList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of HealthCheckService resources. * @@ -31,25 +31,25 @@ class HealthCheckServicesList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/HealthChecksAggregatedList.php b/Compute/src/V1/HealthChecksAggregatedList.php index 05983bbd8283..c6aaa4012547 100644 --- a/Compute/src/V1/HealthChecksAggregatedList.php +++ b/Compute/src/V1/HealthChecksAggregatedList.php @@ -19,7 +19,7 @@ class HealthChecksAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of HealthChecksScopedList resources. * @@ -31,19 +31,19 @@ class HealthChecksAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Unreachable resources. * @@ -55,7 +55,7 @@ class HealthChecksAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/HealthChecksClient.php b/Compute/src/V1/HealthChecksClient.php deleted file mode 100644 index 24d3ac4a808c..000000000000 --- a/Compute/src/V1/HealthChecksClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/HealthStatus.php b/Compute/src/V1/HealthStatus.php index 49dc4c7e0ec9..c52a3283e79e 100644 --- a/Compute/src/V1/HealthStatus.php +++ b/Compute/src/V1/HealthStatus.php @@ -25,60 +25,60 @@ class HealthStatus extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string forwarding_rule = 269964030; */ - private $forwarding_rule = null; + protected $forwarding_rule = null; /** * A forwarding rule IP address assigned to this instance. * * Generated from protobuf field optional string forwarding_rule_ip = 172250632; */ - private $forwarding_rule_ip = null; + protected $forwarding_rule_ip = null; /** * Health state of the IPv4 address of the instance. * Check the HealthState enum for the list of possible values. * * Generated from protobuf field optional string health_state = 324007150; */ - private $health_state = null; + protected $health_state = null; /** * URL of the instance resource. * * Generated from protobuf field optional string instance = 18257045; */ - private $instance = null; + protected $instance = null; /** * For target pool based Network Load Balancing, it indicates the forwarding rule's IP address assigned to this instance. For other types of load balancing, the field indicates VM internal ip. * * Generated from protobuf field optional string ip_address = 406272220; */ - private $ip_address = null; + protected $ip_address = null; /** * Generated from protobuf field optional string ipv6_address = 341563804; */ - private $ipv6_address = null; + protected $ipv6_address = null; /** * Health state of the IPv6 address of the instance. * Check the Ipv6HealthState enum for the list of possible values. * * Generated from protobuf field optional string ipv6_health_state = 190316614; */ - private $ipv6_health_state = null; + protected $ipv6_health_state = null; /** * The named port of the instance group, not necessarily the port that is health-checked. * * Generated from protobuf field optional int32 port = 3446913; */ - private $port = null; + protected $port = null; /** * Generated from protobuf field optional string weight = 282149496; */ - private $weight = null; + protected $weight = null; /** * * Check the WeightError enum for the list of possible values. * * Generated from protobuf field optional string weight_error = 522501505; */ - private $weight_error = null; + protected $weight_error = null; /** * Constructor. diff --git a/Compute/src/V1/HealthStatusForNetworkEndpoint.php b/Compute/src/V1/HealthStatusForNetworkEndpoint.php index 1371816da1e2..f69fc7281c02 100644 --- a/Compute/src/V1/HealthStatusForNetworkEndpoint.php +++ b/Compute/src/V1/HealthStatusForNetworkEndpoint.php @@ -19,39 +19,39 @@ class HealthStatusForNetworkEndpoint extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.BackendServiceReference backend_service = 306946058; */ - private $backend_service = null; + protected $backend_service = null; /** * URL of the forwarding rule associated with the health state of the network endpoint. * * Generated from protobuf field optional .google.cloud.compute.v1.ForwardingRuleReference forwarding_rule = 269964030; */ - private $forwarding_rule = null; + protected $forwarding_rule = null; /** * URL of the health check associated with the health state of the network endpoint. * * Generated from protobuf field optional .google.cloud.compute.v1.HealthCheckReference health_check = 308876645; */ - private $health_check = null; + protected $health_check = null; /** * URL of the health check service associated with the health state of the network endpoint. * * Generated from protobuf field optional .google.cloud.compute.v1.HealthCheckServiceReference health_check_service = 408374747; */ - private $health_check_service = null; + protected $health_check_service = null; /** * Health state of the network endpoint determined based on the health checks configured. * Check the HealthState enum for the list of possible values. * * Generated from protobuf field optional string health_state = 324007150; */ - private $health_state = null; + protected $health_state = null; /** * Health state of the ipv6 network endpoint determined based on the health checks configured. * Check the Ipv6HealthState enum for the list of possible values. * * Generated from protobuf field optional string ipv6_health_state = 190316614; */ - private $ipv6_health_state = null; + protected $ipv6_health_state = null; /** * Constructor. diff --git a/Compute/src/V1/HelpLink.php b/Compute/src/V1/HelpLink.php index b0f49741525a..f0b9c7868c69 100644 --- a/Compute/src/V1/HelpLink.php +++ b/Compute/src/V1/HelpLink.php @@ -20,13 +20,13 @@ class HelpLink extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * The URL of the link. * * Generated from protobuf field optional string url = 116079; */ - private $url = null; + protected $url = null; /** * Constructor. diff --git a/Compute/src/V1/HostRule.php b/Compute/src/V1/HostRule.php index 52928ff3b823..e0554748b364 100644 --- a/Compute/src/V1/HostRule.php +++ b/Compute/src/V1/HostRule.php @@ -20,7 +20,7 @@ class HostRule extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * The list of host patterns to match. They must be valid hostnames with optional port numbers in the format host:port. * matches any string of ([a-z0-9-.]*). In that case, * must be the first character, and if followed by anything, the immediate following character must be either - or .. * based matching is not supported when the URL map is bound to a target gRPC proxy that has the validateForProxyless field set to true. * @@ -32,7 +32,7 @@ class HostRule extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string path_matcher = 337813272; */ - private $path_matcher = null; + protected $path_matcher = null; /** * Constructor. diff --git a/Compute/src/V1/HttpFaultAbort.php b/Compute/src/V1/HttpFaultAbort.php index f8d1ea37dab5..21e0dd19ac84 100644 --- a/Compute/src/V1/HttpFaultAbort.php +++ b/Compute/src/V1/HttpFaultAbort.php @@ -20,13 +20,13 @@ class HttpFaultAbort extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional uint32 http_status = 468949897; */ - private $http_status = null; + protected $http_status = null; /** * The percentage of traffic for connections, operations, or requests that is aborted as part of fault injection. The value must be from 0.0 to 100.0 inclusive. * * Generated from protobuf field optional double percentage = 151909018; */ - private $percentage = null; + protected $percentage = null; /** * Constructor. diff --git a/Compute/src/V1/HttpFaultDelay.php b/Compute/src/V1/HttpFaultDelay.php index 07a40a06f432..eff29236d3f8 100644 --- a/Compute/src/V1/HttpFaultDelay.php +++ b/Compute/src/V1/HttpFaultDelay.php @@ -20,13 +20,13 @@ class HttpFaultDelay extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.Duration fixed_delay = 317037816; */ - private $fixed_delay = null; + protected $fixed_delay = null; /** * The percentage of traffic for connections, operations, or requests for which a delay is introduced as part of fault injection. The value must be from 0.0 to 100.0 inclusive. * * Generated from protobuf field optional double percentage = 151909018; */ - private $percentage = null; + protected $percentage = null; /** * Constructor. diff --git a/Compute/src/V1/HttpFaultInjection.php b/Compute/src/V1/HttpFaultInjection.php index afa4850714b3..20f4eb1c2046 100644 --- a/Compute/src/V1/HttpFaultInjection.php +++ b/Compute/src/V1/HttpFaultInjection.php @@ -20,13 +20,13 @@ class HttpFaultInjection extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.HttpFaultAbort abort = 92611376; */ - private $abort = null; + protected $abort = null; /** * The specification for how client requests are delayed as part of fault injection, before being sent to a backend service. * * Generated from protobuf field optional .google.cloud.compute.v1.HttpFaultDelay delay = 95467907; */ - private $delay = null; + protected $delay = null; /** * Constructor. diff --git a/Compute/src/V1/HttpHeaderMatch.php b/Compute/src/V1/HttpHeaderMatch.php index 831adf64fbd5..76137301c6a5 100644 --- a/Compute/src/V1/HttpHeaderMatch.php +++ b/Compute/src/V1/HttpHeaderMatch.php @@ -20,49 +20,49 @@ class HttpHeaderMatch extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string exact_match = 457641093; */ - private $exact_match = null; + protected $exact_match = null; /** * The name of the HTTP header to match. For matching against the HTTP request's authority, use a headerMatch with the header name ":authority". For matching a request's method, use the headerName ":method". When the URL map is bound to a target gRPC proxy that has the validateForProxyless field set to true, only non-binary user-specified custom metadata and the `content-type` header are supported. The following transport-level headers cannot be used in header matching rules: `:authority`, `:method`, `:path`, `:scheme`, `user-agent`, `accept-encoding`, `content-encoding`, `grpc-accept-encoding`, `grpc-encoding`, `grpc-previous-rpc-attempts`, `grpc-tags-bin`, `grpc-timeout` and `grpc-trace-bin`. * * Generated from protobuf field optional string header_name = 110223613; */ - private $header_name = null; + protected $header_name = null; /** * If set to false, the headerMatch is considered a match if the preceding match criteria are met. If set to true, the headerMatch is considered a match if the preceding match criteria are NOT met. The default setting is false. * * Generated from protobuf field optional bool invert_match = 501130268; */ - private $invert_match = null; + protected $invert_match = null; /** * The value of the header must start with the contents of prefixMatch. Only one of exactMatch, prefixMatch, suffixMatch, regexMatch, presentMatch or rangeMatch must be set. * * Generated from protobuf field optional string prefix_match = 257898968; */ - private $prefix_match = null; + protected $prefix_match = null; /** * A header with the contents of headerName must exist. The match takes place whether or not the request's header has a value. Only one of exactMatch, prefixMatch, suffixMatch, regexMatch, presentMatch or rangeMatch must be set. * * Generated from protobuf field optional bool present_match = 67435841; */ - private $present_match = null; + protected $present_match = null; /** * The header value must be an integer and its value must be in the range specified in rangeMatch. If the header does not contain an integer, number or is empty, the match fails. For example for a range [-5, 0] - -3 will match. - 0 will not match. - 0.25 will not match. - -3someString will not match. Only one of exactMatch, prefixMatch, suffixMatch, regexMatch, presentMatch or rangeMatch must be set. rangeMatch is not supported for load balancers that have loadBalancingScheme set to EXTERNAL. * * Generated from protobuf field optional .google.cloud.compute.v1.Int64RangeMatch range_match = 97244227; */ - private $range_match = null; + protected $range_match = null; /** * The value of the header must match the regular expression specified in regexMatch. For more information about regular expression syntax, see Syntax. For matching against a port specified in the HTTP request, use a headerMatch with headerName set to PORT and a regular expression that satisfies the RFC2616 Host header's port specifier. Only one of exactMatch, prefixMatch, suffixMatch, regexMatch, presentMatch or rangeMatch must be set. Regular expressions can only be used when the loadBalancingScheme is set to INTERNAL_SELF_MANAGED. * * Generated from protobuf field optional string regex_match = 107387853; */ - private $regex_match = null; + protected $regex_match = null; /** * The value of the header must end with the contents of suffixMatch. Only one of exactMatch, prefixMatch, suffixMatch, regexMatch, presentMatch or rangeMatch must be set. * * Generated from protobuf field optional string suffix_match = 426488663; */ - private $suffix_match = null; + protected $suffix_match = null; /** * Constructor. diff --git a/Compute/src/V1/HttpHeaderOption.php b/Compute/src/V1/HttpHeaderOption.php index 47e8de52d0a0..91db700f1f7b 100644 --- a/Compute/src/V1/HttpHeaderOption.php +++ b/Compute/src/V1/HttpHeaderOption.php @@ -20,19 +20,19 @@ class HttpHeaderOption extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string header_name = 110223613; */ - private $header_name = null; + protected $header_name = null; /** * The value of the header to add. * * Generated from protobuf field optional string header_value = 203094335; */ - private $header_value = null; + protected $header_value = null; /** * If false, headerValue is appended to any values that already exist for the header. If true, headerValue is set for the header, discarding any values that were set for that header. The default value is true, unless a variable is present in headerValue, in which case the default value is false. . * * Generated from protobuf field optional bool replace = 20755124; */ - private $replace = null; + protected $replace = null; /** * Constructor. diff --git a/Compute/src/V1/HttpQueryParameterMatch.php b/Compute/src/V1/HttpQueryParameterMatch.php index 45c55afd1187..fceb57f346e3 100644 --- a/Compute/src/V1/HttpQueryParameterMatch.php +++ b/Compute/src/V1/HttpQueryParameterMatch.php @@ -20,25 +20,25 @@ class HttpQueryParameterMatch extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string exact_match = 457641093; */ - private $exact_match = null; + protected $exact_match = null; /** * The name of the query parameter to match. The query parameter must exist in the request, in the absence of which the request match fails. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * Specifies that the queryParameterMatch matches if the request contains the query parameter, irrespective of whether the parameter has a value or not. Only one of presentMatch, exactMatch, or regexMatch must be set. * * Generated from protobuf field optional bool present_match = 67435841; */ - private $present_match = null; + protected $present_match = null; /** * The queryParameterMatch matches if the value of the parameter matches the regular expression specified by regexMatch. For more information about regular expression syntax, see Syntax. Only one of presentMatch, exactMatch, or regexMatch must be set. Regular expressions can only be used when the loadBalancingScheme is set to INTERNAL_SELF_MANAGED. * * Generated from protobuf field optional string regex_match = 107387853; */ - private $regex_match = null; + protected $regex_match = null; /** * Constructor. diff --git a/Compute/src/V1/HttpRedirectAction.php b/Compute/src/V1/HttpRedirectAction.php index 382e211884b5..4f261e689719 100644 --- a/Compute/src/V1/HttpRedirectAction.php +++ b/Compute/src/V1/HttpRedirectAction.php @@ -20,38 +20,38 @@ class HttpRedirectAction extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string host_redirect = 107417747; */ - private $host_redirect = null; + protected $host_redirect = null; /** * If set to true, the URL scheme in the redirected request is set to HTTPS. If set to false, the URL scheme of the redirected request remains the same as that of the request. This must only be set for URL maps used in TargetHttpProxys. Setting this true for TargetHttpsProxy is not permitted. The default is set to false. * * Generated from protobuf field optional bool https_redirect = 170260656; */ - private $https_redirect = null; + protected $https_redirect = null; /** * The path that is used in the redirect response instead of the one that was supplied in the request. pathRedirect cannot be supplied together with prefixRedirect. Supply one alone or neither. If neither is supplied, the path of the original request is used for the redirect. The value must be from 1 to 1024 characters. * * Generated from protobuf field optional string path_redirect = 272342710; */ - private $path_redirect = null; + protected $path_redirect = null; /** * The prefix that replaces the prefixMatch specified in the HttpRouteRuleMatch, retaining the remaining portion of the URL before redirecting the request. prefixRedirect cannot be supplied together with pathRedirect. Supply one alone or neither. If neither is supplied, the path of the original request is used for the redirect. The value must be from 1 to 1024 characters. * * Generated from protobuf field optional string prefix_redirect = 446184169; */ - private $prefix_redirect = null; + protected $prefix_redirect = null; /** * The HTTP Status code to use for this RedirectAction. Supported values are: - MOVED_PERMANENTLY_DEFAULT, which is the default value and corresponds to 301. - FOUND, which corresponds to 302. - SEE_OTHER which corresponds to 303. - TEMPORARY_REDIRECT, which corresponds to 307. In this case, the request method is retained. - PERMANENT_REDIRECT, which corresponds to 308. In this case, the request method is retained. * Check the RedirectResponseCode enum for the list of possible values. * * Generated from protobuf field optional string redirect_response_code = 436710408; */ - private $redirect_response_code = null; + protected $redirect_response_code = null; /** * If set to true, any accompanying query portion of the original URL is removed before redirecting the request. If set to false, the query portion of the original URL is retained. The default is set to false. * * Generated from protobuf field optional bool strip_query = 52284641; */ - private $strip_query = null; + protected $strip_query = null; /** * Constructor. diff --git a/Compute/src/V1/HttpRetryPolicy.php b/Compute/src/V1/HttpRetryPolicy.php index 0a4064eeb15a..6123dfd10935 100644 --- a/Compute/src/V1/HttpRetryPolicy.php +++ b/Compute/src/V1/HttpRetryPolicy.php @@ -20,13 +20,13 @@ class HttpRetryPolicy extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional uint32 num_retries = 251680141; */ - private $num_retries = null; + protected $num_retries = null; /** * Specifies a non-zero timeout per retry attempt. If not specified, will use the timeout set in the HttpRouteAction field. If timeout in the HttpRouteAction field is not set, this field uses the largest timeout among all backend services associated with the route. Not supported when the URL map is bound to a target gRPC proxy that has the validateForProxyless field set to true. * * Generated from protobuf field optional .google.cloud.compute.v1.Duration per_try_timeout = 280041147; */ - private $per_try_timeout = null; + protected $per_try_timeout = null; /** * Specifies one or more conditions when this retry policy applies. Valid values are: - 5xx: retry is attempted if the instance or endpoint responds with any 5xx response code, or if the instance or endpoint does not respond at all. For example, disconnects, reset, read timeout, connection failure, and refused streams. - gateway-error: Similar to 5xx, but only applies to response codes 502, 503 or 504. - connect-failure: a retry is attempted on failures connecting to the instance or endpoint. For example, connection timeouts. - retriable-4xx: a retry is attempted if the instance or endpoint responds with a 4xx response code. The only error that you can retry is error code 409. - refused-stream: a retry is attempted if the instance or endpoint resets the stream with a REFUSED_STREAM error code. This reset type indicates that it is safe to retry. - cancelled: a retry is attempted if the gRPC status code in the response header is set to cancelled. - deadline-exceeded: a retry is attempted if the gRPC status code in the response header is set to deadline-exceeded. - internal: a retry is attempted if the gRPC status code in the response header is set to internal. - resource-exhausted: a retry is attempted if the gRPC status code in the response header is set to resource-exhausted. - unavailable: a retry is attempted if the gRPC status code in the response header is set to unavailable. Only the following codes are supported when the URL map is bound to target gRPC proxy that has validateForProxyless field set to true. - cancelled - deadline-exceeded - internal - resource-exhausted - unavailable * diff --git a/Compute/src/V1/HttpRouteAction.php b/Compute/src/V1/HttpRouteAction.php index f8e59e681ba4..1ba66645ae76 100644 --- a/Compute/src/V1/HttpRouteAction.php +++ b/Compute/src/V1/HttpRouteAction.php @@ -19,43 +19,43 @@ class HttpRouteAction extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.CorsPolicy cors_policy = 398943748; */ - private $cors_policy = null; + protected $cors_policy = null; /** * The specification for fault injection introduced into traffic to test the resiliency of clients to backend service failure. As part of fault injection, when clients send requests to a backend service, delays can be introduced by a load balancer on a percentage of requests before sending those requests to the backend service. Similarly requests from clients can be aborted by the load balancer for a percentage of requests. timeout and retry_policy is ignored by clients that are configured with a fault_injection_policy if: 1. The traffic is generated by fault injection AND 2. The fault injection is not a delay fault injection. Fault injection is not supported with the classic Application Load Balancer . To see which load balancers support fault injection, see Load balancing: Routing and traffic management features. * * Generated from protobuf field optional .google.cloud.compute.v1.HttpFaultInjection fault_injection_policy = 412781079; */ - private $fault_injection_policy = null; + protected $fault_injection_policy = null; /** * Specifies the maximum duration (timeout) for streams on the selected route. Unlike the timeout field where the timeout duration starts from the time the request has been fully processed (known as *end-of-stream*), the duration in this field is computed from the beginning of the stream until the response has been processed, including all retries. A stream that does not complete in this duration is closed. If not specified, this field uses the maximum maxStreamDuration value among all backend services associated with the route. This field is only allowed if the Url map is used with backend services with loadBalancingScheme set to INTERNAL_SELF_MANAGED. * * Generated from protobuf field optional .google.cloud.compute.v1.Duration max_stream_duration = 61428376; */ - private $max_stream_duration = null; + protected $max_stream_duration = null; /** * Specifies the policy on how requests intended for the route's backends are shadowed to a separate mirrored backend service. The load balancer does not wait for responses from the shadow service. Before sending traffic to the shadow service, the host / authority header is suffixed with -shadow. Not supported when the URL map is bound to a target gRPC proxy that has the validateForProxyless field set to true. * * Generated from protobuf field optional .google.cloud.compute.v1.RequestMirrorPolicy request_mirror_policy = 220196866; */ - private $request_mirror_policy = null; + protected $request_mirror_policy = null; /** * Specifies the retry policy associated with this route. * * Generated from protobuf field optional .google.cloud.compute.v1.HttpRetryPolicy retry_policy = 56799913; */ - private $retry_policy = null; + protected $retry_policy = null; /** * Specifies the timeout for the selected route. Timeout is computed from the time the request has been fully processed (known as *end-of-stream*) up until the response has been processed. Timeout includes all retries. If not specified, this field uses the largest timeout among all backend services associated with the route. Not supported when the URL map is bound to a target gRPC proxy that has validateForProxyless field set to true. * * Generated from protobuf field optional .google.cloud.compute.v1.Duration timeout = 296701281; */ - private $timeout = null; + protected $timeout = null; /** * The spec to modify the URL of the request, before forwarding the request to the matched service. urlRewrite is the only action supported in UrlMaps for classic Application Load Balancers. Not supported when the URL map is bound to a target gRPC proxy that has the validateForProxyless field set to true. * * Generated from protobuf field optional .google.cloud.compute.v1.UrlRewrite url_rewrite = 273333948; */ - private $url_rewrite = null; + protected $url_rewrite = null; /** * A list of weighted backend services to send traffic to when a route match occurs. The weights determine the fraction of traffic that flows to their corresponding backend service. If all traffic needs to go to a single backend service, there must be one weightedBackendService with weight set to a non-zero number. After a backend service is identified and before forwarding the request to the backend service, advanced routing actions such as URL rewrites and header transformations are applied depending on additional settings specified in this HttpRouteAction. * diff --git a/Compute/src/V1/HttpRouteRule.php b/Compute/src/V1/HttpRouteRule.php index 425e1beb8125..d8fb6b73ed0b 100644 --- a/Compute/src/V1/HttpRouteRule.php +++ b/Compute/src/V1/HttpRouteRule.php @@ -20,19 +20,19 @@ class HttpRouteRule extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.CustomErrorResponsePolicy custom_error_response_policy = 202816619; */ - private $custom_error_response_policy = null; + protected $custom_error_response_policy = null; /** * The short description conveying the intent of this routeRule. The description can have a maximum length of 1024 characters. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * Specifies changes to request and response headers that need to take effect for the selected backendService. The headerAction value specified here is applied before the matching pathMatchers[].headerAction and after pathMatchers[].routeRules[].routeAction.weightedBackendService.backendServiceWeightAction[].headerAction HeaderAction is not supported for load balancers that have their loadBalancingScheme set to EXTERNAL. Not supported when the URL map is bound to a target gRPC proxy that has validateForProxyless field set to true. * * Generated from protobuf field optional .google.cloud.compute.v1.HttpHeaderAction header_action = 328077352; */ - private $header_action = null; + protected $header_action = null; /** * The list of criteria for matching attributes of a request to this routeRule. This list has OR semantics: the request matches this routeRule when any of the matchRules are satisfied. However predicates within a given matchRule have AND semantics. All predicates within a matchRule must match for the request to match the rule. * @@ -44,25 +44,25 @@ class HttpRouteRule extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int32 priority = 445151652; */ - private $priority = null; + protected $priority = null; /** * In response to a matching matchRule, the load balancer performs advanced routing actions, such as URL rewrites and header transformations, before forwarding the request to the selected backend. Only one of urlRedirect, service or routeAction.weightedBackendService can be set. URL maps for classic Application Load Balancers only support the urlRewrite action within a route rule's routeAction. * * Generated from protobuf field optional .google.cloud.compute.v1.HttpRouteAction route_action = 424563948; */ - private $route_action = null; + protected $route_action = null; /** * The full or partial URL of the backend service resource to which traffic is directed if this rule is matched. If routeAction is also specified, advanced routing actions, such as URL rewrites, take effect before sending the request to the backend. Only one of urlRedirect, service or routeAction.weightedBackendService can be set. * * Generated from protobuf field optional string service = 373540533; */ - private $service = null; + protected $service = null; /** * When this rule is matched, the request is redirected to a URL specified by urlRedirect. Only one of urlRedirect, service or routeAction.weightedBackendService can be set. Not supported when the URL map is bound to a target gRPC proxy. * * Generated from protobuf field optional .google.cloud.compute.v1.HttpRedirectAction url_redirect = 405147820; */ - private $url_redirect = null; + protected $url_redirect = null; /** * Constructor. diff --git a/Compute/src/V1/HttpRouteRuleMatch.php b/Compute/src/V1/HttpRouteRuleMatch.php index 888a97586f72..8d8edffb284f 100644 --- a/Compute/src/V1/HttpRouteRuleMatch.php +++ b/Compute/src/V1/HttpRouteRuleMatch.php @@ -20,7 +20,7 @@ class HttpRouteRuleMatch extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string full_path_match = 214598875; */ - private $full_path_match = null; + protected $full_path_match = null; /** * Specifies a list of header match criteria, all of which must match corresponding headers in the request. * @@ -32,7 +32,7 @@ class HttpRouteRuleMatch extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional bool ignore_case = 464324989; */ - private $ignore_case = null; + protected $ignore_case = null; /** * Opaque filter criteria used by the load balancer to restrict routing configuration to a limited set of xDS compliant clients. In their xDS requests to the load balancer, xDS clients present node metadata. When there is a match, the relevant routing configuration is made available to those proxies. For each metadataFilter in this list, if its filterMatchCriteria is set to MATCH_ANY, at least one of the filterLabels must match the corresponding label provided in the metadata. If its filterMatchCriteria is set to MATCH_ALL, then all of its filterLabels must match with corresponding labels provided in the metadata. If multiple metadata filters are specified, all of them need to be satisfied in order to be considered a match. metadataFilters specified here is applied after those specified in ForwardingRule that refers to the UrlMap this HttpRouteRuleMatch belongs to. metadataFilters only applies to load balancers that have loadBalancingScheme set to INTERNAL_SELF_MANAGED. Not supported when the URL map is bound to a target gRPC proxy that has validateForProxyless field set to true. * @@ -44,13 +44,13 @@ class HttpRouteRuleMatch extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string path_template_match = 292348186; */ - private $path_template_match = null; + protected $path_template_match = null; /** * For satisfying the matchRule condition, the request's path must begin with the specified prefixMatch. prefixMatch must begin with a /. The value must be from 1 to 1024 characters. Only one of prefixMatch, fullPathMatch or regexMatch must be specified. * * Generated from protobuf field optional string prefix_match = 257898968; */ - private $prefix_match = null; + protected $prefix_match = null; /** * Specifies a list of query parameter match criteria, all of which must match corresponding query parameters in the request. Not supported when the URL map is bound to a target gRPC proxy. * @@ -62,7 +62,7 @@ class HttpRouteRuleMatch extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string regex_match = 107387853; */ - private $regex_match = null; + protected $regex_match = null; /** * Constructor. diff --git a/Compute/src/V1/Image.php b/Compute/src/V1/Image.php index 88131907443c..5f6898cea800 100644 --- a/Compute/src/V1/Image.php +++ b/Compute/src/V1/Image.php @@ -21,49 +21,49 @@ class Image extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string architecture = 302803283; */ - private $architecture = null; + protected $architecture = null; /** * Size of the image tar.gz archive stored in Google Cloud Storage (in bytes). * * Generated from protobuf field optional int64 archive_size_bytes = 381093450; */ - private $archive_size_bytes = null; + protected $archive_size_bytes = null; /** * [Output Only] Creation timestamp in RFC3339 text format. * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * The deprecation status associated with this image. * * Generated from protobuf field optional .google.cloud.compute.v1.DeprecationStatus deprecated = 515138995; */ - private $deprecated = null; + protected $deprecated = null; /** * An optional description of this resource. Provide this property when you create the resource. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * Size of the image when restored onto a persistent disk (in GB). * * Generated from protobuf field optional int64 disk_size_gb = 316263735; */ - private $disk_size_gb = null; + protected $disk_size_gb = null; /** * Whether this image is created from a confidential compute mode disk. [Output Only]: This field is not set by user, but from source disk. * * Generated from protobuf field optional bool enable_confidential_compute = 102135228; */ - private $enable_confidential_compute = null; + protected $enable_confidential_compute = null; /** * The name of the image family to which this image belongs. The image family name can be from a publicly managed image family provided by Compute Engine, or from a custom image family you create. For example, centos-stream-9 is a publicly available image family. For more information, see Image family best practices. When creating disks, you can specify an image family instead of a specific image name. The image family always returns its latest image that is not deprecated. The name of the image family must comply with RFC1035. * * Generated from protobuf field optional string family = 328751972; */ - private $family = null; + protected $family = null; /** * A list of features to enable on the guest operating system. Applicable only for bootable images. To see a list of available options, see the guestOSfeatures[].type parameter. * @@ -75,25 +75,25 @@ class Image extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * Encrypts the image using a customer-supplied encryption key. After you encrypt an image with a customer-supplied key, you must provide the same key if you use the image later (e.g. to create a disk from the image). Customer-supplied encryption keys do not protect access to metadata of the disk. If you do not provide an encryption key when creating the image, then the disk will be encrypted using an automatically generated key and you do not need to provide a key to use the image later. * * Generated from protobuf field optional .google.cloud.compute.v1.CustomerEncryptionKey image_encryption_key = 379512583; */ - private $image_encryption_key = null; + protected $image_encryption_key = null; /** * [Output Only] Type of the resource. Always compute#image for images. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * A fingerprint for the labels being applied to this image, which is essentially a hash of the labels used for optimistic locking. The fingerprint is initially generated by Compute Engine and changes after every request to modify or update labels. You must always provide an up-to-date fingerprint hash in order to update or change labels, otherwise the request will fail with error 412 conditionNotMet. To see the latest fingerprint, make a get() request to retrieve an image. * * Generated from protobuf field optional string label_fingerprint = 178124825; */ - private $label_fingerprint = null; + protected $label_fingerprint = null; /** * Labels to apply to this image. These can be later modified by the setLabels method. * @@ -117,105 +117,105 @@ class Image extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * The parameters of the raw disk image. * * Generated from protobuf field optional .google.cloud.compute.v1.RawDisk raw_disk = 503113556; */ - private $raw_disk = null; + protected $raw_disk = null; /** * Output only. Reserved for future use. * * Generated from protobuf field optional bool satisfies_pzi = 480964257; */ - private $satisfies_pzi = null; + protected $satisfies_pzi = null; /** * [Output Only] Reserved for future use. * * Generated from protobuf field optional bool satisfies_pzs = 480964267; */ - private $satisfies_pzs = null; + protected $satisfies_pzs = null; /** * [Output Only] Server-defined URL for the resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * Set the secure boot keys of shielded instance. * * Generated from protobuf field optional .google.cloud.compute.v1.InitialStateConfig shielded_instance_initial_state = 192356867; */ - private $shielded_instance_initial_state = null; + protected $shielded_instance_initial_state = null; /** * URL of the source disk used to create this image. For example, the following are valid values: - https://www.googleapis.com/compute/v1/projects/project/zones/zone /disks/disk - projects/project/zones/zone/disks/disk - zones/zone/disks/disk In order to create an image, you must provide the full or partial URL of one of the following: - The rawDisk.source URL - The sourceDisk URL - The sourceImage URL - The sourceSnapshot URL * * Generated from protobuf field optional string source_disk = 451753793; */ - private $source_disk = null; + protected $source_disk = null; /** * The customer-supplied encryption key of the source disk. Required if the source disk is protected by a customer-supplied encryption key. * * Generated from protobuf field optional .google.cloud.compute.v1.CustomerEncryptionKey source_disk_encryption_key = 531501153; */ - private $source_disk_encryption_key = null; + protected $source_disk_encryption_key = null; /** * [Output Only] The ID value of the disk used to create this image. This value may be used to determine whether the image was taken from the current or a previous instance of a given disk name. * * Generated from protobuf field optional string source_disk_id = 454190809; */ - private $source_disk_id = null; + protected $source_disk_id = null; /** * URL of the source image used to create this image. The following are valid formats for the URL: - https://www.googleapis.com/compute/v1/projects/project_id/global/ images/image_name - projects/project_id/global/images/image_name In order to create an image, you must provide the full or partial URL of one of the following: - The rawDisk.source URL - The sourceDisk URL - The sourceImage URL - The sourceSnapshot URL * * Generated from protobuf field optional string source_image = 50443319; */ - private $source_image = null; + protected $source_image = null; /** * The customer-supplied encryption key of the source image. Required if the source image is protected by a customer-supplied encryption key. * * Generated from protobuf field optional .google.cloud.compute.v1.CustomerEncryptionKey source_image_encryption_key = 381503659; */ - private $source_image_encryption_key = null; + protected $source_image_encryption_key = null; /** * [Output Only] The ID value of the image used to create this image. This value may be used to determine whether the image was taken from the current or a previous instance of a given image name. * * Generated from protobuf field optional string source_image_id = 55328291; */ - private $source_image_id = null; + protected $source_image_id = null; /** * URL of the source snapshot used to create this image. The following are valid formats for the URL: - https://www.googleapis.com/compute/v1/projects/project_id/global/ snapshots/snapshot_name - projects/project_id/global/snapshots/snapshot_name In order to create an image, you must provide the full or partial URL of one of the following: - The rawDisk.source URL - The sourceDisk URL - The sourceImage URL - The sourceSnapshot URL * * Generated from protobuf field optional string source_snapshot = 126061928; */ - private $source_snapshot = null; + protected $source_snapshot = null; /** * The customer-supplied encryption key of the source snapshot. Required if the source snapshot is protected by a customer-supplied encryption key. * * Generated from protobuf field optional .google.cloud.compute.v1.CustomerEncryptionKey source_snapshot_encryption_key = 303679322; */ - private $source_snapshot_encryption_key = null; + protected $source_snapshot_encryption_key = null; /** * [Output Only] The ID value of the snapshot used to create this image. This value may be used to determine whether the snapshot was taken from the current or a previous instance of a given snapshot name. * * Generated from protobuf field optional string source_snapshot_id = 98962258; */ - private $source_snapshot_id = null; + protected $source_snapshot_id = null; /** * The type of the image used to create this disk. The default and only valid value is RAW. * Check the SourceType enum for the list of possible values. * * Generated from protobuf field optional string source_type = 452245726; */ - private $source_type = null; + protected $source_type = null; /** * [Output Only] The status of the image. An image can be used to create other resources, such as instances, only after the image has been successfully created and the status is set to READY. Possible values are FAILED, PENDING, or READY. * Check the Status enum for the list of possible values. * * Generated from protobuf field optional string status = 181260274; */ - private $status = null; + protected $status = null; /** * Cloud Storage bucket storage location of the image (regional or multi-regional). * diff --git a/Compute/src/V1/ImageFamilyView.php b/Compute/src/V1/ImageFamilyView.php index 42cb473d6470..7f7c94e3eca3 100644 --- a/Compute/src/V1/ImageFamilyView.php +++ b/Compute/src/V1/ImageFamilyView.php @@ -19,7 +19,7 @@ class ImageFamilyView extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.Image image = 100313435; */ - private $image = null; + protected $image = null; /** * Constructor. diff --git a/Compute/src/V1/ImageFamilyViewsClient.php b/Compute/src/V1/ImageFamilyViewsClient.php deleted file mode 100644 index b430a6fa8daf..000000000000 --- a/Compute/src/V1/ImageFamilyViewsClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of Image resources. * @@ -32,25 +32,25 @@ class ImageList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/ImagesClient.php b/Compute/src/V1/ImagesClient.php deleted file mode 100644 index 686176fe6467..000000000000 --- a/Compute/src/V1/ImagesClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional .google.cloud.compute.v1.FileContentBuffer pk = 3579; */ - private $pk = null; + protected $pk = null; /** * Constructor. diff --git a/Compute/src/V1/InsertAddressRequest.php b/Compute/src/V1/InsertAddressRequest.php index 8814e67bfd88..a61d4eaae2eb 100644 --- a/Compute/src/V1/InsertAddressRequest.php +++ b/Compute/src/V1/InsertAddressRequest.php @@ -20,25 +20,25 @@ class InsertAddressRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.compute.v1.Address address_resource = 483888121 [(.google.api.field_behavior) = REQUIRED]; */ - private $address_resource = null; + protected $address_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertAutoscalerRequest.php b/Compute/src/V1/InsertAutoscalerRequest.php index 62c964004abb..078d4794ee28 100644 --- a/Compute/src/V1/InsertAutoscalerRequest.php +++ b/Compute/src/V1/InsertAutoscalerRequest.php @@ -20,25 +20,25 @@ class InsertAutoscalerRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.compute.v1.Autoscaler autoscaler_resource = 207616118 [(.google.api.field_behavior) = REQUIRED]; */ - private $autoscaler_resource = null; + protected $autoscaler_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertBackendBucketRequest.php b/Compute/src/V1/InsertBackendBucketRequest.php index 7cb9c5af0605..07e743f5cd88 100644 --- a/Compute/src/V1/InsertBackendBucketRequest.php +++ b/Compute/src/V1/InsertBackendBucketRequest.php @@ -20,19 +20,19 @@ class InsertBackendBucketRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.compute.v1.BackendBucket backend_bucket_resource = 380757784 [(.google.api.field_behavior) = REQUIRED]; */ - private $backend_bucket_resource = null; + protected $backend_bucket_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertBackendServiceRequest.php b/Compute/src/V1/InsertBackendServiceRequest.php index f44d612cd065..4a420dd594b1 100644 --- a/Compute/src/V1/InsertBackendServiceRequest.php +++ b/Compute/src/V1/InsertBackendServiceRequest.php @@ -20,19 +20,19 @@ class InsertBackendServiceRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.compute.v1.BackendService backend_service_resource = 347586723 [(.google.api.field_behavior) = REQUIRED]; */ - private $backend_service_resource = null; + protected $backend_service_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertDiskRequest.php b/Compute/src/V1/InsertDiskRequest.php index b43bd23b7488..df0fae9c6e8b 100644 --- a/Compute/src/V1/InsertDiskRequest.php +++ b/Compute/src/V1/InsertDiskRequest.php @@ -20,31 +20,31 @@ class InsertDiskRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.compute.v1.Disk disk_resource = 25880688 [(.google.api.field_behavior) = REQUIRED]; */ - private $disk_resource = null; + protected $disk_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Source image to restore onto a disk. This field is optional. * * Generated from protobuf field optional string source_image = 50443319; */ - private $source_image = null; + protected $source_image = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertExternalVpnGatewayRequest.php b/Compute/src/V1/InsertExternalVpnGatewayRequest.php index be3c1e8a1a21..35dbce8dd374 100644 --- a/Compute/src/V1/InsertExternalVpnGatewayRequest.php +++ b/Compute/src/V1/InsertExternalVpnGatewayRequest.php @@ -20,19 +20,19 @@ class InsertExternalVpnGatewayRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.compute.v1.ExternalVpnGateway external_vpn_gateway_resource = 486813576 [(.google.api.field_behavior) = REQUIRED]; */ - private $external_vpn_gateway_resource = null; + protected $external_vpn_gateway_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertFirewallPolicyRequest.php b/Compute/src/V1/InsertFirewallPolicyRequest.php index 7de5b0a137a9..b44520fb1d5e 100644 --- a/Compute/src/V1/InsertFirewallPolicyRequest.php +++ b/Compute/src/V1/InsertFirewallPolicyRequest.php @@ -20,19 +20,19 @@ class InsertFirewallPolicyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.compute.v1.FirewallPolicy firewall_policy_resource = 495049532 [(.google.api.field_behavior) = REQUIRED]; */ - private $firewall_policy_resource = null; + protected $firewall_policy_resource = null; /** * Parent ID for this request. The ID can be either be "folders/[FOLDER_ID]" if the parent is a folder or "organizations/[ORGANIZATION_ID]" if the parent is an organization. * * Generated from protobuf field string parent_id = 459714768 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "parent_id"]; */ - private $parent_id = ''; + protected $parent_id = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $parentId Parent ID for this request. The ID can be either be "folders/[FOLDER_ID]" if the parent is a folder or "organizations/[ORGANIZATION_ID]" if the parent is an organization. diff --git a/Compute/src/V1/InsertFirewallRequest.php b/Compute/src/V1/InsertFirewallRequest.php index 308a139466bf..c5cbc7a29ecd 100644 --- a/Compute/src/V1/InsertFirewallRequest.php +++ b/Compute/src/V1/InsertFirewallRequest.php @@ -20,19 +20,19 @@ class InsertFirewallRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.compute.v1.Firewall firewall_resource = 41425005 [(.google.api.field_behavior) = REQUIRED]; */ - private $firewall_resource = null; + protected $firewall_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertForwardingRuleRequest.php b/Compute/src/V1/InsertForwardingRuleRequest.php index 67395f134e84..6b7e59b61553 100644 --- a/Compute/src/V1/InsertForwardingRuleRequest.php +++ b/Compute/src/V1/InsertForwardingRuleRequest.php @@ -20,25 +20,25 @@ class InsertForwardingRuleRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.compute.v1.ForwardingRule forwarding_rule_resource = 301211695 [(.google.api.field_behavior) = REQUIRED]; */ - private $forwarding_rule_resource = null; + protected $forwarding_rule_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertGlobalAddressRequest.php b/Compute/src/V1/InsertGlobalAddressRequest.php index 0cb5f8afd3f6..43e80fbd727a 100644 --- a/Compute/src/V1/InsertGlobalAddressRequest.php +++ b/Compute/src/V1/InsertGlobalAddressRequest.php @@ -20,19 +20,19 @@ class InsertGlobalAddressRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.compute.v1.Address address_resource = 483888121 [(.google.api.field_behavior) = REQUIRED]; */ - private $address_resource = null; + protected $address_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertGlobalForwardingRuleRequest.php b/Compute/src/V1/InsertGlobalForwardingRuleRequest.php index 7541802a4f83..54d069c6a667 100644 --- a/Compute/src/V1/InsertGlobalForwardingRuleRequest.php +++ b/Compute/src/V1/InsertGlobalForwardingRuleRequest.php @@ -20,19 +20,19 @@ class InsertGlobalForwardingRuleRequest extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field .google.cloud.compute.v1.ForwardingRule forwarding_rule_resource = 301211695 [(.google.api.field_behavior) = REQUIRED]; */ - private $forwarding_rule_resource = null; + protected $forwarding_rule_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertGlobalNetworkEndpointGroupRequest.php b/Compute/src/V1/InsertGlobalNetworkEndpointGroupRequest.php index 099283af9415..b11a7232b7cb 100644 --- a/Compute/src/V1/InsertGlobalNetworkEndpointGroupRequest.php +++ b/Compute/src/V1/InsertGlobalNetworkEndpointGroupRequest.php @@ -20,19 +20,19 @@ class InsertGlobalNetworkEndpointGroupRequest extends \Google\Protobuf\Internal\ * * Generated from protobuf field .google.cloud.compute.v1.NetworkEndpointGroup network_endpoint_group_resource = 525788839 [(.google.api.field_behavior) = REQUIRED]; */ - private $network_endpoint_group_resource = null; + protected $network_endpoint_group_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertGlobalPublicDelegatedPrefixeRequest.php b/Compute/src/V1/InsertGlobalPublicDelegatedPrefixeRequest.php index 30c45ea7f363..775e80c19456 100644 --- a/Compute/src/V1/InsertGlobalPublicDelegatedPrefixeRequest.php +++ b/Compute/src/V1/InsertGlobalPublicDelegatedPrefixeRequest.php @@ -20,19 +20,19 @@ class InsertGlobalPublicDelegatedPrefixeRequest extends \Google\Protobuf\Interna * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.PublicDelegatedPrefix public_delegated_prefix_resource = 47594501 [(.google.api.field_behavior) = REQUIRED]; */ - private $public_delegated_prefix_resource = null; + protected $public_delegated_prefix_resource = null; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertHealthCheckRequest.php b/Compute/src/V1/InsertHealthCheckRequest.php index a5b44c456f07..63460d8de2d9 100644 --- a/Compute/src/V1/InsertHealthCheckRequest.php +++ b/Compute/src/V1/InsertHealthCheckRequest.php @@ -20,19 +20,19 @@ class InsertHealthCheckRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.compute.v1.HealthCheck health_check_resource = 201925032 [(.google.api.field_behavior) = REQUIRED]; */ - private $health_check_resource = null; + protected $health_check_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertImageRequest.php b/Compute/src/V1/InsertImageRequest.php index 65fdd002b671..06bbf451eac3 100644 --- a/Compute/src/V1/InsertImageRequest.php +++ b/Compute/src/V1/InsertImageRequest.php @@ -20,25 +20,25 @@ class InsertImageRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional bool force_create = 197723344; */ - private $force_create = null; + protected $force_create = null; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.Image image_resource = 371171954 [(.google.api.field_behavior) = REQUIRED]; */ - private $image_resource = null; + protected $image_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertInstanceGroupManagerRequest.php b/Compute/src/V1/InsertInstanceGroupManagerRequest.php index 09b2569c0e50..1cfd97090283 100644 --- a/Compute/src/V1/InsertInstanceGroupManagerRequest.php +++ b/Compute/src/V1/InsertInstanceGroupManagerRequest.php @@ -20,25 +20,25 @@ class InsertInstanceGroupManagerRequest extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field .google.cloud.compute.v1.InstanceGroupManager instance_group_manager_resource = 261063946 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group_manager_resource = null; + protected $instance_group_manager_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone where you want to create the managed instance group. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertInstanceGroupManagerResizeRequestRequest.php b/Compute/src/V1/InsertInstanceGroupManagerResizeRequestRequest.php index 8ce01ff91548..705d3a8aad57 100644 --- a/Compute/src/V1/InsertInstanceGroupManagerResizeRequestRequest.php +++ b/Compute/src/V1/InsertInstanceGroupManagerResizeRequestRequest.php @@ -20,31 +20,31 @@ class InsertInstanceGroupManagerResizeRequestRequest extends \Google\Protobuf\In * * Generated from protobuf field string instance_group_manager = 249363395 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group_manager = ''; + protected $instance_group_manager = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.InstanceGroupManagerResizeRequest instance_group_manager_resize_request_resource = 468541293 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group_manager_resize_request_resource = null; + protected $instance_group_manager_resize_request_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone where the managed instance group is located and where the resize request will be created. Name should conform to RFC1035. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertInstanceGroupRequest.php b/Compute/src/V1/InsertInstanceGroupRequest.php index 654dd5c9b139..abec107d1cd0 100644 --- a/Compute/src/V1/InsertInstanceGroupRequest.php +++ b/Compute/src/V1/InsertInstanceGroupRequest.php @@ -20,25 +20,25 @@ class InsertInstanceGroupRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.compute.v1.InstanceGroup instance_group_resource = 286612152 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group_resource = null; + protected $instance_group_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone where you want to create the instance group. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertInstanceRequest.php b/Compute/src/V1/InsertInstanceRequest.php index c4a395d22a44..267ea18e5f56 100644 --- a/Compute/src/V1/InsertInstanceRequest.php +++ b/Compute/src/V1/InsertInstanceRequest.php @@ -20,37 +20,37 @@ class InsertInstanceRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.compute.v1.Instance instance_resource = 215988344 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_resource = null; + protected $instance_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Specifies instance template to create the instance. This field is optional. It can be a full or partial URL. For example, the following are all valid URLs to an instance template: - https://www.googleapis.com/compute/v1/projects/project /global/instanceTemplates/instanceTemplate - projects/project/global/instanceTemplates/instanceTemplate - global/instanceTemplates/instanceTemplate * * Generated from protobuf field optional string source_instance_template = 332423616; */ - private $source_instance_template = null; + protected $source_instance_template = null; /** * Specifies the machine image to use to create the instance. This field is optional. It can be a full or partial URL. For example, the following are all valid URLs to a machine image: - https://www.googleapis.com/compute/v1/projects/project/global/global /machineImages/machineImage - projects/project/global/global/machineImages/machineImage - global/machineImages/machineImage * * Generated from protobuf field optional string source_machine_image = 21769791; */ - private $source_machine_image = null; + protected $source_machine_image = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertInstanceTemplateRequest.php b/Compute/src/V1/InsertInstanceTemplateRequest.php index 8a2c08a28502..03b8e3a305a4 100644 --- a/Compute/src/V1/InsertInstanceTemplateRequest.php +++ b/Compute/src/V1/InsertInstanceTemplateRequest.php @@ -20,19 +20,19 @@ class InsertInstanceTemplateRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.compute.v1.InstanceTemplate instance_template_resource = 10679561 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_template_resource = null; + protected $instance_template_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertInstantSnapshotRequest.php b/Compute/src/V1/InsertInstantSnapshotRequest.php index e08577374239..e5a0ed6cf0c5 100644 --- a/Compute/src/V1/InsertInstantSnapshotRequest.php +++ b/Compute/src/V1/InsertInstantSnapshotRequest.php @@ -20,25 +20,25 @@ class InsertInstantSnapshotRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.compute.v1.InstantSnapshot instant_snapshot_resource = 383915339 [(.google.api.field_behavior) = REQUIRED]; */ - private $instant_snapshot_resource = null; + protected $instant_snapshot_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertInterconnectAttachmentGroupRequest.php b/Compute/src/V1/InsertInterconnectAttachmentGroupRequest.php index b5436c5d2f48..b42db39ff736 100644 --- a/Compute/src/V1/InsertInterconnectAttachmentGroupRequest.php +++ b/Compute/src/V1/InsertInterconnectAttachmentGroupRequest.php @@ -20,19 +20,19 @@ class InsertInterconnectAttachmentGroupRequest extends \Google\Protobuf\Internal * * Generated from protobuf field .google.cloud.compute.v1.InterconnectAttachmentGroup interconnect_attachment_group_resource = 9990137 [(.google.api.field_behavior) = REQUIRED]; */ - private $interconnect_attachment_group_resource = null; + protected $interconnect_attachment_group_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). end_interface: MixerMutationRequestBuilder * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertInterconnectAttachmentRequest.php b/Compute/src/V1/InsertInterconnectAttachmentRequest.php index a314802505f0..dcadc810c437 100644 --- a/Compute/src/V1/InsertInterconnectAttachmentRequest.php +++ b/Compute/src/V1/InsertInterconnectAttachmentRequest.php @@ -20,31 +20,31 @@ class InsertInterconnectAttachmentRequest extends \Google\Protobuf\Internal\Mess * * Generated from protobuf field .google.cloud.compute.v1.InterconnectAttachment interconnect_attachment_resource = 212341369 [(.google.api.field_behavior) = REQUIRED]; */ - private $interconnect_attachment_resource = null; + protected $interconnect_attachment_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * If true, the request will not be committed. * * Generated from protobuf field optional bool validate_only = 242744629; */ - private $validate_only = null; + protected $validate_only = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertInterconnectGroupRequest.php b/Compute/src/V1/InsertInterconnectGroupRequest.php index 610fd9d71787..03555960fbff 100644 --- a/Compute/src/V1/InsertInterconnectGroupRequest.php +++ b/Compute/src/V1/InsertInterconnectGroupRequest.php @@ -20,19 +20,19 @@ class InsertInterconnectGroupRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.compute.v1.InterconnectGroup interconnect_group_resource = 85571999 [(.google.api.field_behavior) = REQUIRED]; */ - private $interconnect_group_resource = null; + protected $interconnect_group_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). end_interface: MixerMutationRequestBuilder * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertInterconnectRequest.php b/Compute/src/V1/InsertInterconnectRequest.php index 6629a8486d9b..caed82906bd3 100644 --- a/Compute/src/V1/InsertInterconnectRequest.php +++ b/Compute/src/V1/InsertInterconnectRequest.php @@ -20,19 +20,19 @@ class InsertInterconnectRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.compute.v1.Interconnect interconnect_resource = 397611167 [(.google.api.field_behavior) = REQUIRED]; */ - private $interconnect_resource = null; + protected $interconnect_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertLicenseRequest.php b/Compute/src/V1/InsertLicenseRequest.php index 88fd192f1b06..06b12220af8c 100644 --- a/Compute/src/V1/InsertLicenseRequest.php +++ b/Compute/src/V1/InsertLicenseRequest.php @@ -20,19 +20,19 @@ class InsertLicenseRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.compute.v1.License license_resource = 437955148 [(.google.api.field_behavior) = REQUIRED]; */ - private $license_resource = null; + protected $license_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertMachineImageRequest.php b/Compute/src/V1/InsertMachineImageRequest.php index 639e39a5dc5a..499f5a064dd6 100644 --- a/Compute/src/V1/InsertMachineImageRequest.php +++ b/Compute/src/V1/InsertMachineImageRequest.php @@ -20,25 +20,25 @@ class InsertMachineImageRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.compute.v1.MachineImage machine_image_resource = 60740970 [(.google.api.field_behavior) = REQUIRED]; */ - private $machine_image_resource = null; + protected $machine_image_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Required. Source instance that is used to create the machine image from. * * Generated from protobuf field optional string source_instance = 396315705; */ - private $source_instance = null; + protected $source_instance = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertNetworkAttachmentRequest.php b/Compute/src/V1/InsertNetworkAttachmentRequest.php index 5a224c9e88a0..89c87f2b5a5d 100644 --- a/Compute/src/V1/InsertNetworkAttachmentRequest.php +++ b/Compute/src/V1/InsertNetworkAttachmentRequest.php @@ -20,25 +20,25 @@ class InsertNetworkAttachmentRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.compute.v1.NetworkAttachment network_attachment_resource = 210974745 [(.google.api.field_behavior) = REQUIRED]; */ - private $network_attachment_resource = null; + protected $network_attachment_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region of this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). end_interface: MixerMutationRequestBuilder * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertNetworkEdgeSecurityServiceRequest.php b/Compute/src/V1/InsertNetworkEdgeSecurityServiceRequest.php index 8d968b09048a..679f6d7699c9 100644 --- a/Compute/src/V1/InsertNetworkEdgeSecurityServiceRequest.php +++ b/Compute/src/V1/InsertNetworkEdgeSecurityServiceRequest.php @@ -20,31 +20,31 @@ class InsertNetworkEdgeSecurityServiceRequest extends \Google\Protobuf\Internal\ * * Generated from protobuf field .google.cloud.compute.v1.NetworkEdgeSecurityService network_edge_security_service_resource = 477548966 [(.google.api.field_behavior) = REQUIRED]; */ - private $network_edge_security_service_resource = null; + protected $network_edge_security_service_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * If true, the request will not be committed. * * Generated from protobuf field optional bool validate_only = 242744629; */ - private $validate_only = null; + protected $validate_only = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertNetworkEndpointGroupRequest.php b/Compute/src/V1/InsertNetworkEndpointGroupRequest.php index 508d2120b8c0..77187015afcd 100644 --- a/Compute/src/V1/InsertNetworkEndpointGroupRequest.php +++ b/Compute/src/V1/InsertNetworkEndpointGroupRequest.php @@ -20,25 +20,25 @@ class InsertNetworkEndpointGroupRequest extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field .google.cloud.compute.v1.NetworkEndpointGroup network_endpoint_group_resource = 525788839 [(.google.api.field_behavior) = REQUIRED]; */ - private $network_endpoint_group_resource = null; + protected $network_endpoint_group_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone where you want to create the network endpoint group. It should comply with RFC1035. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertNetworkFirewallPolicyRequest.php b/Compute/src/V1/InsertNetworkFirewallPolicyRequest.php index b74f7f1b3499..aeeab510c301 100644 --- a/Compute/src/V1/InsertNetworkFirewallPolicyRequest.php +++ b/Compute/src/V1/InsertNetworkFirewallPolicyRequest.php @@ -20,19 +20,19 @@ class InsertNetworkFirewallPolicyRequest extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field .google.cloud.compute.v1.FirewallPolicy firewall_policy_resource = 495049532 [(.google.api.field_behavior) = REQUIRED]; */ - private $firewall_policy_resource = null; + protected $firewall_policy_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertNetworkRequest.php b/Compute/src/V1/InsertNetworkRequest.php index 33f21733003e..7cbaeac71c04 100644 --- a/Compute/src/V1/InsertNetworkRequest.php +++ b/Compute/src/V1/InsertNetworkRequest.php @@ -20,19 +20,19 @@ class InsertNetworkRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.compute.v1.Network network_resource = 122105599 [(.google.api.field_behavior) = REQUIRED]; */ - private $network_resource = null; + protected $network_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertNodeGroupRequest.php b/Compute/src/V1/InsertNodeGroupRequest.php index 794f9dfac99f..378ed0221ae6 100644 --- a/Compute/src/V1/InsertNodeGroupRequest.php +++ b/Compute/src/V1/InsertNodeGroupRequest.php @@ -20,31 +20,31 @@ class InsertNodeGroupRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field int32 initial_node_count = 71951469 [(.google.api.field_behavior) = REQUIRED]; */ - private $initial_node_count = 0; + protected $initial_node_count = 0; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.NodeGroup node_group_resource = 505321899 [(.google.api.field_behavior) = REQUIRED]; */ - private $node_group_resource = null; + protected $node_group_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertNodeTemplateRequest.php b/Compute/src/V1/InsertNodeTemplateRequest.php index 568092abd3fd..d0c3de98bd27 100644 --- a/Compute/src/V1/InsertNodeTemplateRequest.php +++ b/Compute/src/V1/InsertNodeTemplateRequest.php @@ -20,25 +20,25 @@ class InsertNodeTemplateRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.compute.v1.NodeTemplate node_template_resource = 127364406 [(.google.api.field_behavior) = REQUIRED]; */ - private $node_template_resource = null; + protected $node_template_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * The name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertPacketMirroringRequest.php b/Compute/src/V1/InsertPacketMirroringRequest.php index 525b79724cdd..5d2c24f8f5be 100644 --- a/Compute/src/V1/InsertPacketMirroringRequest.php +++ b/Compute/src/V1/InsertPacketMirroringRequest.php @@ -20,25 +20,25 @@ class InsertPacketMirroringRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.compute.v1.PacketMirroring packet_mirroring_resource = 493501985 [(.google.api.field_behavior) = REQUIRED]; */ - private $packet_mirroring_resource = null; + protected $packet_mirroring_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertPublicAdvertisedPrefixeRequest.php b/Compute/src/V1/InsertPublicAdvertisedPrefixeRequest.php index 28f20209d6c6..0ecf803fd676 100644 --- a/Compute/src/V1/InsertPublicAdvertisedPrefixeRequest.php +++ b/Compute/src/V1/InsertPublicAdvertisedPrefixeRequest.php @@ -20,19 +20,19 @@ class InsertPublicAdvertisedPrefixeRequest extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.PublicAdvertisedPrefix public_advertised_prefix_resource = 233614223 [(.google.api.field_behavior) = REQUIRED]; */ - private $public_advertised_prefix_resource = null; + protected $public_advertised_prefix_resource = null; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertPublicDelegatedPrefixeRequest.php b/Compute/src/V1/InsertPublicDelegatedPrefixeRequest.php index f86081346c3c..44d3d3f81daf 100644 --- a/Compute/src/V1/InsertPublicDelegatedPrefixeRequest.php +++ b/Compute/src/V1/InsertPublicDelegatedPrefixeRequest.php @@ -20,25 +20,25 @@ class InsertPublicDelegatedPrefixeRequest extends \Google\Protobuf\Internal\Mess * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.PublicDelegatedPrefix public_delegated_prefix_resource = 47594501 [(.google.api.field_behavior) = REQUIRED]; */ - private $public_delegated_prefix_resource = null; + protected $public_delegated_prefix_resource = null; /** * Name of the region of this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertRegionAutoscalerRequest.php b/Compute/src/V1/InsertRegionAutoscalerRequest.php index 57706c85969a..92e30278880c 100644 --- a/Compute/src/V1/InsertRegionAutoscalerRequest.php +++ b/Compute/src/V1/InsertRegionAutoscalerRequest.php @@ -20,25 +20,25 @@ class InsertRegionAutoscalerRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.compute.v1.Autoscaler autoscaler_resource = 207616118 [(.google.api.field_behavior) = REQUIRED]; */ - private $autoscaler_resource = null; + protected $autoscaler_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertRegionBackendServiceRequest.php b/Compute/src/V1/InsertRegionBackendServiceRequest.php index f272925ee8e5..5ca25c1aefa3 100644 --- a/Compute/src/V1/InsertRegionBackendServiceRequest.php +++ b/Compute/src/V1/InsertRegionBackendServiceRequest.php @@ -20,25 +20,25 @@ class InsertRegionBackendServiceRequest extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field .google.cloud.compute.v1.BackendService backend_service_resource = 347586723 [(.google.api.field_behavior) = REQUIRED]; */ - private $backend_service_resource = null; + protected $backend_service_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertRegionCommitmentRequest.php b/Compute/src/V1/InsertRegionCommitmentRequest.php index 31b9a2add047..6910998b31bd 100644 --- a/Compute/src/V1/InsertRegionCommitmentRequest.php +++ b/Compute/src/V1/InsertRegionCommitmentRequest.php @@ -20,25 +20,25 @@ class InsertRegionCommitmentRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.compute.v1.Commitment commitment_resource = 244240888 [(.google.api.field_behavior) = REQUIRED]; */ - private $commitment_resource = null; + protected $commitment_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertRegionDiskRequest.php b/Compute/src/V1/InsertRegionDiskRequest.php index 1bde4997f64d..057a42a1598c 100644 --- a/Compute/src/V1/InsertRegionDiskRequest.php +++ b/Compute/src/V1/InsertRegionDiskRequest.php @@ -20,31 +20,31 @@ class InsertRegionDiskRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.compute.v1.Disk disk_resource = 25880688 [(.google.api.field_behavior) = REQUIRED]; */ - private $disk_resource = null; + protected $disk_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Source image to restore onto a disk. This field is optional. * * Generated from protobuf field optional string source_image = 50443319; */ - private $source_image = null; + protected $source_image = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertRegionHealthCheckRequest.php b/Compute/src/V1/InsertRegionHealthCheckRequest.php index 3729d89709b3..11667cdb33fc 100644 --- a/Compute/src/V1/InsertRegionHealthCheckRequest.php +++ b/Compute/src/V1/InsertRegionHealthCheckRequest.php @@ -20,25 +20,25 @@ class InsertRegionHealthCheckRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.compute.v1.HealthCheck health_check_resource = 201925032 [(.google.api.field_behavior) = REQUIRED]; */ - private $health_check_resource = null; + protected $health_check_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertRegionHealthCheckServiceRequest.php b/Compute/src/V1/InsertRegionHealthCheckServiceRequest.php index db165f3cb307..bbdcd14c97e9 100644 --- a/Compute/src/V1/InsertRegionHealthCheckServiceRequest.php +++ b/Compute/src/V1/InsertRegionHealthCheckServiceRequest.php @@ -20,25 +20,25 @@ class InsertRegionHealthCheckServiceRequest extends \Google\Protobuf\Internal\Me * * Generated from protobuf field .google.cloud.compute.v1.HealthCheckService health_check_service_resource = 477367794 [(.google.api.field_behavior) = REQUIRED]; */ - private $health_check_service_resource = null; + protected $health_check_service_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertRegionInstanceGroupManagerRequest.php b/Compute/src/V1/InsertRegionInstanceGroupManagerRequest.php index 78035a414514..96d755e7777b 100644 --- a/Compute/src/V1/InsertRegionInstanceGroupManagerRequest.php +++ b/Compute/src/V1/InsertRegionInstanceGroupManagerRequest.php @@ -20,25 +20,25 @@ class InsertRegionInstanceGroupManagerRequest extends \Google\Protobuf\Internal\ * * Generated from protobuf field .google.cloud.compute.v1.InstanceGroupManager instance_group_manager_resource = 261063946 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group_manager_resource = null; + protected $instance_group_manager_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertRegionInstanceTemplateRequest.php b/Compute/src/V1/InsertRegionInstanceTemplateRequest.php index aa5cac4b38c2..8aa962c77777 100644 --- a/Compute/src/V1/InsertRegionInstanceTemplateRequest.php +++ b/Compute/src/V1/InsertRegionInstanceTemplateRequest.php @@ -20,25 +20,25 @@ class InsertRegionInstanceTemplateRequest extends \Google\Protobuf\Internal\Mess * * Generated from protobuf field .google.cloud.compute.v1.InstanceTemplate instance_template_resource = 10679561 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_template_resource = null; + protected $instance_template_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * The name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertRegionInstantSnapshotRequest.php b/Compute/src/V1/InsertRegionInstantSnapshotRequest.php index 65912a92f154..69727e472e1f 100644 --- a/Compute/src/V1/InsertRegionInstantSnapshotRequest.php +++ b/Compute/src/V1/InsertRegionInstantSnapshotRequest.php @@ -20,25 +20,25 @@ class InsertRegionInstantSnapshotRequest extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field .google.cloud.compute.v1.InstantSnapshot instant_snapshot_resource = 383915339 [(.google.api.field_behavior) = REQUIRED]; */ - private $instant_snapshot_resource = null; + protected $instant_snapshot_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertRegionNetworkEndpointGroupRequest.php b/Compute/src/V1/InsertRegionNetworkEndpointGroupRequest.php index 9eb472a3e89e..c3fc459a8faa 100644 --- a/Compute/src/V1/InsertRegionNetworkEndpointGroupRequest.php +++ b/Compute/src/V1/InsertRegionNetworkEndpointGroupRequest.php @@ -20,25 +20,25 @@ class InsertRegionNetworkEndpointGroupRequest extends \Google\Protobuf\Internal\ * * Generated from protobuf field .google.cloud.compute.v1.NetworkEndpointGroup network_endpoint_group_resource = 525788839 [(.google.api.field_behavior) = REQUIRED]; */ - private $network_endpoint_group_resource = null; + protected $network_endpoint_group_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * The name of the region where you want to create the network endpoint group. It should comply with RFC1035. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertRegionNetworkFirewallPolicyRequest.php b/Compute/src/V1/InsertRegionNetworkFirewallPolicyRequest.php index b4eeb51b4c7b..0a8515cf48ea 100644 --- a/Compute/src/V1/InsertRegionNetworkFirewallPolicyRequest.php +++ b/Compute/src/V1/InsertRegionNetworkFirewallPolicyRequest.php @@ -20,25 +20,25 @@ class InsertRegionNetworkFirewallPolicyRequest extends \Google\Protobuf\Internal * * Generated from protobuf field .google.cloud.compute.v1.FirewallPolicy firewall_policy_resource = 495049532 [(.google.api.field_behavior) = REQUIRED]; */ - private $firewall_policy_resource = null; + protected $firewall_policy_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertRegionNotificationEndpointRequest.php b/Compute/src/V1/InsertRegionNotificationEndpointRequest.php index ee54a2bbef4e..054b32eba597 100644 --- a/Compute/src/V1/InsertRegionNotificationEndpointRequest.php +++ b/Compute/src/V1/InsertRegionNotificationEndpointRequest.php @@ -20,25 +20,25 @@ class InsertRegionNotificationEndpointRequest extends \Google\Protobuf\Internal\ * * Generated from protobuf field .google.cloud.compute.v1.NotificationEndpoint notification_endpoint_resource = 338459940 [(.google.api.field_behavior) = REQUIRED]; */ - private $notification_endpoint_resource = null; + protected $notification_endpoint_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertRegionSecurityPolicyRequest.php b/Compute/src/V1/InsertRegionSecurityPolicyRequest.php index cea7ee554d40..3e2c4a5e7bde 100644 --- a/Compute/src/V1/InsertRegionSecurityPolicyRequest.php +++ b/Compute/src/V1/InsertRegionSecurityPolicyRequest.php @@ -20,31 +20,31 @@ class InsertRegionSecurityPolicyRequest extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.SecurityPolicy security_policy_resource = 216159612 [(.google.api.field_behavior) = REQUIRED]; */ - private $security_policy_resource = null; + protected $security_policy_resource = null; /** * If true, the request will not be committed. * * Generated from protobuf field optional bool validate_only = 242744629; */ - private $validate_only = null; + protected $validate_only = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertRegionSslCertificateRequest.php b/Compute/src/V1/InsertRegionSslCertificateRequest.php index 4cc6af3206f8..e6669aff7ac3 100644 --- a/Compute/src/V1/InsertRegionSslCertificateRequest.php +++ b/Compute/src/V1/InsertRegionSslCertificateRequest.php @@ -20,25 +20,25 @@ class InsertRegionSslCertificateRequest extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.SslCertificate ssl_certificate_resource = 180709897 [(.google.api.field_behavior) = REQUIRED]; */ - private $ssl_certificate_resource = null; + protected $ssl_certificate_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertRegionSslPolicyRequest.php b/Compute/src/V1/InsertRegionSslPolicyRequest.php index 9e5117dc2bbc..132f4e359c18 100644 --- a/Compute/src/V1/InsertRegionSslPolicyRequest.php +++ b/Compute/src/V1/InsertRegionSslPolicyRequest.php @@ -20,25 +20,25 @@ class InsertRegionSslPolicyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.SslPolicy ssl_policy_resource = 274891848 [(.google.api.field_behavior) = REQUIRED]; */ - private $ssl_policy_resource = null; + protected $ssl_policy_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertRegionTargetHttpProxyRequest.php b/Compute/src/V1/InsertRegionTargetHttpProxyRequest.php index dcbfc66a3a06..7d09efedc9fe 100644 --- a/Compute/src/V1/InsertRegionTargetHttpProxyRequest.php +++ b/Compute/src/V1/InsertRegionTargetHttpProxyRequest.php @@ -20,25 +20,25 @@ class InsertRegionTargetHttpProxyRequest extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.TargetHttpProxy target_http_proxy_resource = 24696744 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_http_proxy_resource = null; + protected $target_http_proxy_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertRegionTargetHttpsProxyRequest.php b/Compute/src/V1/InsertRegionTargetHttpsProxyRequest.php index 433c3dc70d01..85367f9a11c9 100644 --- a/Compute/src/V1/InsertRegionTargetHttpsProxyRequest.php +++ b/Compute/src/V1/InsertRegionTargetHttpsProxyRequest.php @@ -20,25 +20,25 @@ class InsertRegionTargetHttpsProxyRequest extends \Google\Protobuf\Internal\Mess * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.TargetHttpsProxy target_https_proxy_resource = 433657473 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_https_proxy_resource = null; + protected $target_https_proxy_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertRegionTargetTcpProxyRequest.php b/Compute/src/V1/InsertRegionTargetTcpProxyRequest.php index 00d407f94d1f..c2fa58592c58 100644 --- a/Compute/src/V1/InsertRegionTargetTcpProxyRequest.php +++ b/Compute/src/V1/InsertRegionTargetTcpProxyRequest.php @@ -20,25 +20,25 @@ class InsertRegionTargetTcpProxyRequest extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.TargetTcpProxy target_tcp_proxy_resource = 145913931 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_tcp_proxy_resource = null; + protected $target_tcp_proxy_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertRegionUrlMapRequest.php b/Compute/src/V1/InsertRegionUrlMapRequest.php index 553b7399822c..c499bbc3afc6 100644 --- a/Compute/src/V1/InsertRegionUrlMapRequest.php +++ b/Compute/src/V1/InsertRegionUrlMapRequest.php @@ -20,25 +20,25 @@ class InsertRegionUrlMapRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * begin_interface: MixerMutationRequestBuilder Request ID to support idempotency. * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.UrlMap url_map_resource = 168675425 [(.google.api.field_behavior) = REQUIRED]; */ - private $url_map_resource = null; + protected $url_map_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertReservationRequest.php b/Compute/src/V1/InsertReservationRequest.php index 2fb81fce1997..c92403f12dd0 100644 --- a/Compute/src/V1/InsertReservationRequest.php +++ b/Compute/src/V1/InsertReservationRequest.php @@ -20,25 +20,25 @@ class InsertReservationRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.Reservation reservation_resource = 285030177 [(.google.api.field_behavior) = REQUIRED]; */ - private $reservation_resource = null; + protected $reservation_resource = null; /** * Name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertResourcePolicyRequest.php b/Compute/src/V1/InsertResourcePolicyRequest.php index 8d2264df457b..aad8ec9ba28f 100644 --- a/Compute/src/V1/InsertResourcePolicyRequest.php +++ b/Compute/src/V1/InsertResourcePolicyRequest.php @@ -20,25 +20,25 @@ class InsertResourcePolicyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.ResourcePolicy resource_policy_resource = 76826186 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource_policy_resource = null; + protected $resource_policy_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertRouteRequest.php b/Compute/src/V1/InsertRouteRequest.php index 8ea370b3efa0..cfdc5cee8ab2 100644 --- a/Compute/src/V1/InsertRouteRequest.php +++ b/Compute/src/V1/InsertRouteRequest.php @@ -20,19 +20,19 @@ class InsertRouteRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.Route route_resource = 225428804 [(.google.api.field_behavior) = REQUIRED]; */ - private $route_resource = null; + protected $route_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertRouterRequest.php b/Compute/src/V1/InsertRouterRequest.php index 80148a991c89..0a5b41360187 100644 --- a/Compute/src/V1/InsertRouterRequest.php +++ b/Compute/src/V1/InsertRouterRequest.php @@ -20,25 +20,25 @@ class InsertRouterRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.Router router_resource = 155222084 [(.google.api.field_behavior) = REQUIRED]; */ - private $router_resource = null; + protected $router_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertSecurityPolicyRequest.php b/Compute/src/V1/InsertSecurityPolicyRequest.php index f41c636938bc..93e7e0e4044a 100644 --- a/Compute/src/V1/InsertSecurityPolicyRequest.php +++ b/Compute/src/V1/InsertSecurityPolicyRequest.php @@ -20,25 +20,25 @@ class InsertSecurityPolicyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.SecurityPolicy security_policy_resource = 216159612 [(.google.api.field_behavior) = REQUIRED]; */ - private $security_policy_resource = null; + protected $security_policy_resource = null; /** * If true, the request will not be committed. * * Generated from protobuf field optional bool validate_only = 242744629; */ - private $validate_only = null; + protected $validate_only = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertServiceAttachmentRequest.php b/Compute/src/V1/InsertServiceAttachmentRequest.php index e250bfd8affe..65bbdca288ae 100644 --- a/Compute/src/V1/InsertServiceAttachmentRequest.php +++ b/Compute/src/V1/InsertServiceAttachmentRequest.php @@ -20,25 +20,25 @@ class InsertServiceAttachmentRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region of this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.ServiceAttachment service_attachment_resource = 472980256 [(.google.api.field_behavior) = REQUIRED]; */ - private $service_attachment_resource = null; + protected $service_attachment_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertSnapshotRequest.php b/Compute/src/V1/InsertSnapshotRequest.php index 801627e35cc9..ffa22aee82ae 100644 --- a/Compute/src/V1/InsertSnapshotRequest.php +++ b/Compute/src/V1/InsertSnapshotRequest.php @@ -20,19 +20,19 @@ class InsertSnapshotRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.Snapshot snapshot_resource = 481319977 [(.google.api.field_behavior) = REQUIRED]; */ - private $snapshot_resource = null; + protected $snapshot_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertSslCertificateRequest.php b/Compute/src/V1/InsertSslCertificateRequest.php index 75691eeeaefd..c17c7816724f 100644 --- a/Compute/src/V1/InsertSslCertificateRequest.php +++ b/Compute/src/V1/InsertSslCertificateRequest.php @@ -20,19 +20,19 @@ class InsertSslCertificateRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.SslCertificate ssl_certificate_resource = 180709897 [(.google.api.field_behavior) = REQUIRED]; */ - private $ssl_certificate_resource = null; + protected $ssl_certificate_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertSslPolicyRequest.php b/Compute/src/V1/InsertSslPolicyRequest.php index 72994af38629..05227ed7cfab 100644 --- a/Compute/src/V1/InsertSslPolicyRequest.php +++ b/Compute/src/V1/InsertSslPolicyRequest.php @@ -20,19 +20,19 @@ class InsertSslPolicyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.SslPolicy ssl_policy_resource = 274891848 [(.google.api.field_behavior) = REQUIRED]; */ - private $ssl_policy_resource = null; + protected $ssl_policy_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertStoragePoolRequest.php b/Compute/src/V1/InsertStoragePoolRequest.php index 5c3951e2744a..566d4512dcc7 100644 --- a/Compute/src/V1/InsertStoragePoolRequest.php +++ b/Compute/src/V1/InsertStoragePoolRequest.php @@ -20,25 +20,25 @@ class InsertStoragePoolRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.StoragePool storage_pool_resource = 157179405 [(.google.api.field_behavior) = REQUIRED]; */ - private $storage_pool_resource = null; + protected $storage_pool_resource = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertSubnetworkRequest.php b/Compute/src/V1/InsertSubnetworkRequest.php index 623c4ff51e55..e5eb0d79460d 100644 --- a/Compute/src/V1/InsertSubnetworkRequest.php +++ b/Compute/src/V1/InsertSubnetworkRequest.php @@ -20,25 +20,25 @@ class InsertSubnetworkRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.Subnetwork subnetwork_resource = 42233151 [(.google.api.field_behavior) = REQUIRED]; */ - private $subnetwork_resource = null; + protected $subnetwork_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertTargetGrpcProxyRequest.php b/Compute/src/V1/InsertTargetGrpcProxyRequest.php index bea70e46764f..cb5223d2f82e 100644 --- a/Compute/src/V1/InsertTargetGrpcProxyRequest.php +++ b/Compute/src/V1/InsertTargetGrpcProxyRequest.php @@ -20,19 +20,19 @@ class InsertTargetGrpcProxyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.TargetGrpcProxy target_grpc_proxy_resource = 328922450 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_grpc_proxy_resource = null; + protected $target_grpc_proxy_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertTargetHttpProxyRequest.php b/Compute/src/V1/InsertTargetHttpProxyRequest.php index e57cfdd17fe7..a1ed3222aa5f 100644 --- a/Compute/src/V1/InsertTargetHttpProxyRequest.php +++ b/Compute/src/V1/InsertTargetHttpProxyRequest.php @@ -20,19 +20,19 @@ class InsertTargetHttpProxyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.TargetHttpProxy target_http_proxy_resource = 24696744 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_http_proxy_resource = null; + protected $target_http_proxy_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertTargetHttpsProxyRequest.php b/Compute/src/V1/InsertTargetHttpsProxyRequest.php index b6844ae675d1..efc822a11f5b 100644 --- a/Compute/src/V1/InsertTargetHttpsProxyRequest.php +++ b/Compute/src/V1/InsertTargetHttpsProxyRequest.php @@ -20,19 +20,19 @@ class InsertTargetHttpsProxyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.TargetHttpsProxy target_https_proxy_resource = 433657473 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_https_proxy_resource = null; + protected $target_https_proxy_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertTargetInstanceRequest.php b/Compute/src/V1/InsertTargetInstanceRequest.php index 53869b4933ef..f01d136b3487 100644 --- a/Compute/src/V1/InsertTargetInstanceRequest.php +++ b/Compute/src/V1/InsertTargetInstanceRequest.php @@ -20,25 +20,25 @@ class InsertTargetInstanceRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.TargetInstance target_instance_resource = 430453066 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_instance_resource = null; + protected $target_instance_resource = null; /** * Name of the zone scoping this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertTargetPoolRequest.php b/Compute/src/V1/InsertTargetPoolRequest.php index b13b39dc173e..f4f95bbcf8b3 100644 --- a/Compute/src/V1/InsertTargetPoolRequest.php +++ b/Compute/src/V1/InsertTargetPoolRequest.php @@ -20,25 +20,25 @@ class InsertTargetPoolRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.TargetPool target_pool_resource = 101281443 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_pool_resource = null; + protected $target_pool_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertTargetSslProxyRequest.php b/Compute/src/V1/InsertTargetSslProxyRequest.php index ba99aa0fd5eb..4e9df21fe6ec 100644 --- a/Compute/src/V1/InsertTargetSslProxyRequest.php +++ b/Compute/src/V1/InsertTargetSslProxyRequest.php @@ -20,19 +20,19 @@ class InsertTargetSslProxyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.TargetSslProxy target_ssl_proxy_resource = 142016192 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_ssl_proxy_resource = null; + protected $target_ssl_proxy_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertTargetTcpProxyRequest.php b/Compute/src/V1/InsertTargetTcpProxyRequest.php index 7b36c0364125..92809a5655f6 100644 --- a/Compute/src/V1/InsertTargetTcpProxyRequest.php +++ b/Compute/src/V1/InsertTargetTcpProxyRequest.php @@ -20,19 +20,19 @@ class InsertTargetTcpProxyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.TargetTcpProxy target_tcp_proxy_resource = 145913931 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_tcp_proxy_resource = null; + protected $target_tcp_proxy_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertTargetVpnGatewayRequest.php b/Compute/src/V1/InsertTargetVpnGatewayRequest.php index 01206b581365..ab53a49457e1 100644 --- a/Compute/src/V1/InsertTargetVpnGatewayRequest.php +++ b/Compute/src/V1/InsertTargetVpnGatewayRequest.php @@ -20,25 +20,25 @@ class InsertTargetVpnGatewayRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.TargetVpnGateway target_vpn_gateway_resource = 498050 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_vpn_gateway_resource = null; + protected $target_vpn_gateway_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertUrlMapRequest.php b/Compute/src/V1/InsertUrlMapRequest.php index 1e5338341a85..aceebe4b7233 100644 --- a/Compute/src/V1/InsertUrlMapRequest.php +++ b/Compute/src/V1/InsertUrlMapRequest.php @@ -20,19 +20,19 @@ class InsertUrlMapRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.UrlMap url_map_resource = 168675425 [(.google.api.field_behavior) = REQUIRED]; */ - private $url_map_resource = null; + protected $url_map_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertVpnGatewayRequest.php b/Compute/src/V1/InsertVpnGatewayRequest.php index f1b83c4506eb..9dfd277f8f40 100644 --- a/Compute/src/V1/InsertVpnGatewayRequest.php +++ b/Compute/src/V1/InsertVpnGatewayRequest.php @@ -20,25 +20,25 @@ class InsertVpnGatewayRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.VpnGateway vpn_gateway_resource = 182688660 [(.google.api.field_behavior) = REQUIRED]; */ - private $vpn_gateway_resource = null; + protected $vpn_gateway_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/InsertVpnTunnelRequest.php b/Compute/src/V1/InsertVpnTunnelRequest.php index 812f0d2a43d2..1c347aeee63f 100644 --- a/Compute/src/V1/InsertVpnTunnelRequest.php +++ b/Compute/src/V1/InsertVpnTunnelRequest.php @@ -20,25 +20,25 @@ class InsertVpnTunnelRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.VpnTunnel vpn_tunnel_resource = 86839482 [(.google.api.field_behavior) = REQUIRED]; */ - private $vpn_tunnel_resource = null; + protected $vpn_tunnel_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/Instance.php b/Compute/src/V1/Instance.php index 9ff0070f4412..df0bf4484c5d 100644 --- a/Compute/src/V1/Instance.php +++ b/Compute/src/V1/Instance.php @@ -20,41 +20,41 @@ class Instance extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.AdvancedMachineFeatures advanced_machine_features = 409646002; */ - private $advanced_machine_features = null; + protected $advanced_machine_features = null; /** * Allows this instance to send and receive packets with non-matching destination or source IPs. This is required if you plan to use this instance to forward routes. For more information, see Enabling IP Forwarding . * * Generated from protobuf field optional bool can_ip_forward = 467731324; */ - private $can_ip_forward = null; + protected $can_ip_forward = null; /** * Generated from protobuf field optional .google.cloud.compute.v1.ConfidentialInstanceConfig confidential_instance_config = 490637685; */ - private $confidential_instance_config = null; + protected $confidential_instance_config = null; /** * [Output Only] The CPU platform used by this instance. * * Generated from protobuf field optional string cpu_platform = 410285354; */ - private $cpu_platform = null; + protected $cpu_platform = null; /** * [Output Only] Creation timestamp in RFC3339 text format. * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * Whether the resource should be protected against deletion. * * Generated from protobuf field optional bool deletion_protection = 458014698; */ - private $deletion_protection = null; + protected $deletion_protection = null; /** * An optional description of this resource. Provide this property when you create the resource. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * Array of disks associated with this instance. Persistent disks must be created before you can assign them. * @@ -66,13 +66,13 @@ class Instance extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.DisplayDevice display_device = 258933875; */ - private $display_device = null; + protected $display_device = null; /** * Specifies a fingerprint for this resource, which is essentially a hash of the instance's contents and used for optimistic locking. The fingerprint is initially generated by Compute Engine and changes after every request to modify or update the instance. You must always provide an up-to-date fingerprint hash in order to update the instance. To see the latest fingerprint, make get() request to the instance. * * Generated from protobuf field optional string fingerprint = 234678500; */ - private $fingerprint = null; + protected $fingerprint = null; /** * A list of the type and count of accelerator cards attached to the instance. * @@ -84,38 +84,38 @@ class Instance extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string hostname = 237067315; */ - private $hostname = null; + protected $hostname = null; /** * [Output Only] The unique identifier for the resource. This identifier is defined by the server. * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * Encrypts suspended data for an instance with a customer-managed encryption key. If you are creating a new instance, this field will encrypt the local SSD and in-memory contents of the instance during the suspend operation. If you do not provide an encryption key when creating the instance, then the local SSD and in-memory contents will be encrypted using an automatically generated key during the suspend operation. * * Generated from protobuf field optional .google.cloud.compute.v1.CustomerEncryptionKey instance_encryption_key = 64741517; */ - private $instance_encryption_key = null; + protected $instance_encryption_key = null; /** * KeyRevocationActionType of the instance. Supported options are "STOP" and "NONE". The default value is "NONE" if it is not specified. * Check the KeyRevocationActionType enum for the list of possible values. * * Generated from protobuf field optional string key_revocation_action_type = 235941474; */ - private $key_revocation_action_type = null; + protected $key_revocation_action_type = null; /** * [Output Only] Type of the resource. Always compute#instance for instances. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * A fingerprint for this request, which is essentially a hash of the label's contents and used for optimistic locking. The fingerprint is initially generated by Compute Engine and changes after every request to modify or update labels. You must always provide an up-to-date fingerprint hash in order to update or change labels. To see the latest fingerprint, make get() request to the instance. * * Generated from protobuf field optional string label_fingerprint = 178124825; */ - private $label_fingerprint = null; + protected $label_fingerprint = null; /** * Labels to apply to this instance. These can be later modified by the setLabels method. * @@ -127,43 +127,43 @@ class Instance extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string last_start_timestamp = 443830736; */ - private $last_start_timestamp = null; + protected $last_start_timestamp = null; /** * [Output Only] Last stop timestamp in RFC3339 text format. * * Generated from protobuf field optional string last_stop_timestamp = 412823010; */ - private $last_stop_timestamp = null; + protected $last_stop_timestamp = null; /** * [Output Only] Last suspended timestamp in RFC3339 text format. * * Generated from protobuf field optional string last_suspended_timestamp = 356275337; */ - private $last_suspended_timestamp = null; + protected $last_suspended_timestamp = null; /** * Full or partial URL of the machine type resource to use for this instance, in the format: zones/zone/machineTypes/machine-type. This is provided by the client when the instance is created. For example, the following is a valid partial url to a predefined machine type: zones/us-central1-f/machineTypes/n1-standard-1 To create a custom machine type, provide a URL to a machine type in the following format, where CPUS is 1 or an even number up to 32 (2, 4, 6, ... 24, etc), and MEMORY is the total memory for this instance. Memory must be a multiple of 256 MB and must be supplied in MB (e.g. 5 GB of memory is 5120 MB): zones/zone/machineTypes/custom-CPUS-MEMORY For example: zones/us-central1-f/machineTypes/custom-4-5120 For a full list of restrictions, read the Specifications for custom machine types. * * Generated from protobuf field optional string machine_type = 227711026; */ - private $machine_type = null; + protected $machine_type = null; /** * The metadata key/value pairs assigned to this instance. This includes metadata keys that were explicitly defined for the instance. * * Generated from protobuf field optional .google.cloud.compute.v1.Metadata metadata = 86866735; */ - private $metadata = null; + protected $metadata = null; /** * Specifies a minimum CPU platform for the VM instance. Applicable values are the friendly names of CPU platforms, such as minCpuPlatform: "Intel Haswell" or minCpuPlatform: "Intel Sandy Bridge". * * Generated from protobuf field optional string min_cpu_platform = 242912759; */ - private $min_cpu_platform = null; + protected $min_cpu_platform = null; /** * The name of the resource, provided by the client when initially creating the resource. The resource name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * An array of network configurations for this instance. These specify how interfaces are configured to interact with other network services, such as connecting to the internet. Multiple interfaces are supported per instance. * @@ -173,26 +173,26 @@ class Instance extends \Google\Protobuf\Internal\Message /** * Generated from protobuf field optional .google.cloud.compute.v1.NetworkPerformanceConfig network_performance_config = 398330850; */ - private $network_performance_config = null; + protected $network_performance_config = null; /** * Input only. [Input Only] Additional params passed with the request, but not persisted as part of resource payload. * * Generated from protobuf field optional .google.cloud.compute.v1.InstanceParams params = 78313862; */ - private $params = null; + protected $params = null; /** * The private IPv6 google access type for the VM. If not specified, use INHERIT_FROM_SUBNETWORK as default. * Check the PrivateIpv6GoogleAccess enum for the list of possible values. * * Generated from protobuf field optional string private_ipv6_google_access = 48277006; */ - private $private_ipv6_google_access = null; + protected $private_ipv6_google_access = null; /** * Specifies the reservations that this instance can consume from. * * Generated from protobuf field optional .google.cloud.compute.v1.ReservationAffinity reservation_affinity = 157850683; */ - private $reservation_affinity = null; + protected $reservation_affinity = null; /** * Resource policies applied to this instance. * @@ -204,31 +204,31 @@ class Instance extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.ResourceStatus resource_status = 249429315; */ - private $resource_status = null; + protected $resource_status = null; /** * [Output Only] Reserved for future use. * * Generated from protobuf field optional bool satisfies_pzi = 480964257; */ - private $satisfies_pzi = null; + protected $satisfies_pzi = null; /** * [Output Only] Reserved for future use. * * Generated from protobuf field optional bool satisfies_pzs = 480964267; */ - private $satisfies_pzs = null; + protected $satisfies_pzs = null; /** * Sets the scheduling options for this instance. * * Generated from protobuf field optional .google.cloud.compute.v1.Scheduling scheduling = 386688404; */ - private $scheduling = null; + protected $scheduling = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * A list of service accounts, with their specified scopes, authorized for this instance. Only one service account per VM instance is supported. Service accounts generate access tokens that can be accessed through the metadata server and used to authenticate applications on the instance. See Service Accounts for more information. * @@ -238,54 +238,54 @@ class Instance extends \Google\Protobuf\Internal\Message /** * Generated from protobuf field optional .google.cloud.compute.v1.ShieldedInstanceConfig shielded_instance_config = 12862901; */ - private $shielded_instance_config = null; + protected $shielded_instance_config = null; /** * Generated from protobuf field optional .google.cloud.compute.v1.ShieldedInstanceIntegrityPolicy shielded_instance_integrity_policy = 163696919; */ - private $shielded_instance_integrity_policy = null; + protected $shielded_instance_integrity_policy = null; /** * Source machine image * * Generated from protobuf field optional string source_machine_image = 21769791; */ - private $source_machine_image = null; + protected $source_machine_image = null; /** * Source machine image encryption key when creating an instance from a machine image. * * Generated from protobuf field optional .google.cloud.compute.v1.CustomerEncryptionKey source_machine_image_encryption_key = 192839075; */ - private $source_machine_image_encryption_key = null; + protected $source_machine_image_encryption_key = null; /** * [Output Only] Whether a VM has been restricted for start because Compute Engine has detected suspicious activity. * * Generated from protobuf field optional bool start_restricted = 123693144; */ - private $start_restricted = null; + protected $start_restricted = null; /** * [Output Only] The status of the instance. One of the following values: PROVISIONING, STAGING, RUNNING, STOPPING, SUSPENDING, SUSPENDED, REPAIRING, and TERMINATED. For more information about the status of the instance, see Instance life cycle. * Check the Status enum for the list of possible values. * * Generated from protobuf field optional string status = 181260274; */ - private $status = null; + protected $status = null; /** * [Output Only] An optional, human-readable explanation of the status. * * Generated from protobuf field optional string status_message = 297428154; */ - private $status_message = null; + protected $status_message = null; /** * Tags to apply to this instance. Tags are used to identify valid sources or targets for network firewalls and are specified by the client during instance creation. The tags can be later modified by the setTags method. Each tag within the list must comply with RFC1035. Multiple tags can be specified via the 'tags.items' field. * * Generated from protobuf field optional .google.cloud.compute.v1.Tags tags = 3552281; */ - private $tags = null; + protected $tags = null; /** * [Output Only] URL of the zone where the instance resides. You must specify this field as part of the HTTP request URL. It is not settable as a field in the request body. * * Generated from protobuf field optional string zone = 3744684; */ - private $zone = null; + protected $zone = null; /** * Constructor. diff --git a/Compute/src/V1/InstanceAggregatedList.php b/Compute/src/V1/InstanceAggregatedList.php index f24fd275f71d..0f9edeb50bcb 100644 --- a/Compute/src/V1/InstanceAggregatedList.php +++ b/Compute/src/V1/InstanceAggregatedList.php @@ -19,7 +19,7 @@ class InstanceAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * An object that contains a list of instances scoped by zone. * @@ -31,19 +31,19 @@ class InstanceAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Unreachable resources. * @@ -55,7 +55,7 @@ class InstanceAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/InstanceConsumptionData.php b/Compute/src/V1/InstanceConsumptionData.php index 11797478b384..5d908d8d2ec5 100644 --- a/Compute/src/V1/InstanceConsumptionData.php +++ b/Compute/src/V1/InstanceConsumptionData.php @@ -19,13 +19,13 @@ class InstanceConsumptionData extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.InstanceConsumptionInfo consumption_info = 146354898; */ - private $consumption_info = null; + protected $consumption_info = null; /** * Server-defined URL for the instance. * * Generated from protobuf field optional string instance = 18257045; */ - private $instance = null; + protected $instance = null; /** * Constructor. diff --git a/Compute/src/V1/InstanceConsumptionInfo.php b/Compute/src/V1/InstanceConsumptionInfo.php index 99dda256c18a..dfa8432f165d 100644 --- a/Compute/src/V1/InstanceConsumptionInfo.php +++ b/Compute/src/V1/InstanceConsumptionInfo.php @@ -19,25 +19,25 @@ class InstanceConsumptionInfo extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int32 guest_cpus = 393356754; */ - private $guest_cpus = null; + protected $guest_cpus = null; /** * The amount of local SSD storage available to the instance, defined in GiB. * * Generated from protobuf field optional int32 local_ssd_gb = 329237578; */ - private $local_ssd_gb = null; + protected $local_ssd_gb = null; /** * The amount of physical memory available to the instance, defined in MiB. * * Generated from protobuf field optional int32 memory_mb = 116001171; */ - private $memory_mb = null; + protected $memory_mb = null; /** * The minimal guaranteed number of virtual CPUs that are reserved. * * Generated from protobuf field optional int32 min_node_cpus = 317231675; */ - private $min_node_cpus = null; + protected $min_node_cpus = null; /** * Constructor. diff --git a/Compute/src/V1/InstanceGroup.php b/Compute/src/V1/InstanceGroup.php index fe2fe72f5490..98736e345ab3 100644 --- a/Compute/src/V1/InstanceGroup.php +++ b/Compute/src/V1/InstanceGroup.php @@ -20,37 +20,37 @@ class InstanceGroup extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * An optional description of this resource. Provide this property when you create the resource. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * [Output Only] The fingerprint of the named ports. The system uses this fingerprint to detect conflicts when multiple users change the named ports concurrently. * * Generated from protobuf field optional string fingerprint = 234678500; */ - private $fingerprint = null; + protected $fingerprint = null; /** * [Output Only] A unique identifier for this instance group, generated by the server. * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * [Output Only] The resource type, which is always compute#instanceGroup for instance groups. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * The name of the instance group. The name must be 1-63 characters long, and comply with RFC1035. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * Optional. Assigns a name to a port number. For example: {name: "http", port: 80} This allows the system to reference ports by the assigned name instead of a port number. Named ports can also contain multiple ports. For example: [{name: "app1", port: 8080}, {name: "app1", port: 8081}, {name: "app2", port: 8082}] Named ports apply to all instances in this instance group. * @@ -62,37 +62,37 @@ class InstanceGroup extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string network = 232872494; */ - private $network = null; + protected $network = null; /** * [Output Only] The URL of the region where the instance group is located (for regional resources). * * Generated from protobuf field optional string region = 138946292; */ - private $region = null; + protected $region = null; /** * [Output Only] The URL for this instance group. The server generates this URL. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] The total number of instances in the instance group. * * Generated from protobuf field optional int32 size = 3530753; */ - private $size = null; + protected $size = null; /** * [Output Only] The URL of the subnetwork to which all instances in the instance group belong. If your instance has multiple network interfaces, then the network and subnetwork fields only refer to the network and subnet used by your primary interface (nic0). * * Generated from protobuf field optional string subnetwork = 307827694; */ - private $subnetwork = null; + protected $subnetwork = null; /** * [Output Only] The URL of the zone where the instance group is located (for zonal resources). * * Generated from protobuf field optional string zone = 3744684; */ - private $zone = null; + protected $zone = null; /** * Constructor. diff --git a/Compute/src/V1/InstanceGroupAggregatedList.php b/Compute/src/V1/InstanceGroupAggregatedList.php index 1cf463594b2e..9533de598444 100644 --- a/Compute/src/V1/InstanceGroupAggregatedList.php +++ b/Compute/src/V1/InstanceGroupAggregatedList.php @@ -19,7 +19,7 @@ class InstanceGroupAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of InstanceGroupsScopedList resources. * @@ -31,19 +31,19 @@ class InstanceGroupAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Unreachable resources. * @@ -55,7 +55,7 @@ class InstanceGroupAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/InstanceGroupList.php b/Compute/src/V1/InstanceGroupList.php index 0a6c9e6209b4..79f574ffccc7 100644 --- a/Compute/src/V1/InstanceGroupList.php +++ b/Compute/src/V1/InstanceGroupList.php @@ -20,7 +20,7 @@ class InstanceGroupList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of InstanceGroup resources. * @@ -32,25 +32,25 @@ class InstanceGroupList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/InstanceGroupManager.php b/Compute/src/V1/InstanceGroupManager.php index be1c997aa03f..56bfa66c4ffa 100644 --- a/Compute/src/V1/InstanceGroupManager.php +++ b/Compute/src/V1/InstanceGroupManager.php @@ -20,7 +20,7 @@ class InstanceGroupManager extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.InstanceGroupManagerAllInstancesConfig all_instances_config = 112596737; */ - private $all_instances_config = null; + protected $all_instances_config = null; /** * The autohealing policy for this managed instance group. You can specify only one value. * @@ -32,86 +32,86 @@ class InstanceGroupManager extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string base_instance_name = 389106439; */ - private $base_instance_name = null; + protected $base_instance_name = null; /** * [Output Only] The creation timestamp for this managed instance group in RFC3339 text format. * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * [Output Only] The list of instance actions and the number of instances in this managed instance group that are scheduled for each of those actions. * * Generated from protobuf field optional .google.cloud.compute.v1.InstanceGroupManagerActionsSummary current_actions = 164045879; */ - private $current_actions = null; + protected $current_actions = null; /** * An optional description of this resource. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * Policy specifying the intended distribution of managed instances across zones in a regional managed instance group. * * Generated from protobuf field optional .google.cloud.compute.v1.DistributionPolicy distribution_policy = 534558541; */ - private $distribution_policy = null; + protected $distribution_policy = null; /** * Fingerprint of this resource. This field may be used in optimistic locking. It will be ignored when inserting an InstanceGroupManager. An up-to-date fingerprint must be provided in order to update the InstanceGroupManager, otherwise the request will fail with error 412 conditionNotMet. To see the latest fingerprint, make a get() request to retrieve an InstanceGroupManager. * * Generated from protobuf field optional string fingerprint = 234678500; */ - private $fingerprint = null; + protected $fingerprint = null; /** * [Output Only] A unique identifier for this resource type. The server generates this identifier. * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * Instance flexibility allowing MIG to create VMs from multiple types of machines. Instance flexibility configuration on MIG overrides instance template configuration. * * Generated from protobuf field optional .google.cloud.compute.v1.InstanceGroupManagerInstanceFlexibilityPolicy instance_flexibility_policy = 26937090; */ - private $instance_flexibility_policy = null; + protected $instance_flexibility_policy = null; /** * [Output Only] The URL of the Instance Group resource. * * Generated from protobuf field optional string instance_group = 81095253; */ - private $instance_group = null; + protected $instance_group = null; /** * The repair policy for this managed instance group. * * Generated from protobuf field optional .google.cloud.compute.v1.InstanceGroupManagerInstanceLifecyclePolicy instance_lifecycle_policy = 447961617; */ - private $instance_lifecycle_policy = null; + protected $instance_lifecycle_policy = null; /** * The URL of the instance template that is specified for this managed instance group. The group uses this template to create all new instances in the managed instance group. The templates for existing instances in the group do not change unless you run recreateInstances, run applyUpdatesToInstances, or set the group's updatePolicy.type to PROACTIVE. * * Generated from protobuf field optional string instance_template = 309248228; */ - private $instance_template = null; + protected $instance_template = null; /** * [Output Only] The resource type, which is always compute#instanceGroupManager for managed instance groups. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * Pagination behavior of the listManagedInstances API method for this managed instance group. * Check the ListManagedInstancesResults enum for the list of possible values. * * Generated from protobuf field optional string list_managed_instances_results = 296047156; */ - private $list_managed_instances_results = null; + protected $list_managed_instances_results = null; /** * The name of the managed instance group. The name must be 1-63 characters long, and comply with RFC1035. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * [Output Only] Named ports configured on the Instance Groups complementary to this Instance Group Manager. * @@ -123,49 +123,49 @@ class InstanceGroupManager extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string region = 138946292; */ - private $region = null; + protected $region = null; /** * Resource policies for this managed instance group. * * Generated from protobuf field optional .google.cloud.compute.v1.InstanceGroupManagerResourcePolicies resource_policies = 22220385; */ - private $resource_policies = null; + protected $resource_policies = null; /** * [Output Only] Reserved for future use. * * Generated from protobuf field optional bool satisfies_pzi = 480964257; */ - private $satisfies_pzi = null; + protected $satisfies_pzi = null; /** * [Output Only] Reserved for future use. * * Generated from protobuf field optional bool satisfies_pzs = 480964267; */ - private $satisfies_pzs = null; + protected $satisfies_pzs = null; /** * [Output Only] The URL for this managed instance group. The server defines this URL. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * Standby policy for stopped and suspended instances. * * Generated from protobuf field optional .google.cloud.compute.v1.InstanceGroupManagerStandbyPolicy standby_policy = 499352324; */ - private $standby_policy = null; + protected $standby_policy = null; /** * Stateful configuration for this Instanced Group Manager * * Generated from protobuf field optional .google.cloud.compute.v1.StatefulPolicy stateful_policy = 47538565; */ - private $stateful_policy = null; + protected $stateful_policy = null; /** * [Output Only] The status of this managed instance group. * * Generated from protobuf field optional .google.cloud.compute.v1.InstanceGroupManagerStatus status = 181260274; */ - private $status = null; + protected $status = null; /** * The URLs for all TargetPool resources to which instances in the instanceGroup field are added. The target pools automatically apply to all of the instances in the managed instance group. * @@ -177,25 +177,25 @@ class InstanceGroupManager extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int32 target_size = 62880239; */ - private $target_size = null; + protected $target_size = null; /** * The target number of stopped instances for this managed instance group. This number changes when you: - Stop instance using the stopInstances method or start instances using the startInstances method. - Manually change the targetStoppedSize using the update method. * * Generated from protobuf field optional int32 target_stopped_size = 2419489; */ - private $target_stopped_size = null; + protected $target_stopped_size = null; /** * The target number of suspended instances for this managed instance group. This number changes when you: - Suspend instance using the suspendInstances method or resume instances using the resumeInstances method. - Manually change the targetSuspendedSize using the update method. * * Generated from protobuf field optional int32 target_suspended_size = 308085843; */ - private $target_suspended_size = null; + protected $target_suspended_size = null; /** * The update policy for this managed instance group. * * Generated from protobuf field optional .google.cloud.compute.v1.InstanceGroupManagerUpdatePolicy update_policy = 175809896; */ - private $update_policy = null; + protected $update_policy = null; /** * Specifies the instance templates used by this managed instance group to create instances. Each version is defined by an instanceTemplate and a name. Every version can appear at most once per instance group. This field overrides the top-level instanceTemplate field. Read more about the relationships between these fields. Exactly one version must leave the targetSize field unset. That version will be applied to all remaining instances. For more information, read about canary updates. * @@ -207,7 +207,7 @@ class InstanceGroupManager extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string zone = 3744684; */ - private $zone = null; + protected $zone = null; /** * Constructor. diff --git a/Compute/src/V1/InstanceGroupManagerActionsSummary.php b/Compute/src/V1/InstanceGroupManagerActionsSummary.php index 3b4c80b800c9..941dcf658fec 100644 --- a/Compute/src/V1/InstanceGroupManagerActionsSummary.php +++ b/Compute/src/V1/InstanceGroupManagerActionsSummary.php @@ -19,79 +19,79 @@ class InstanceGroupManagerActionsSummary extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field optional int32 abandoning = 440023373; */ - private $abandoning = null; + protected $abandoning = null; /** * [Output Only] The number of instances in the managed instance group that are scheduled to be created or are currently being created. If the group fails to create any of these instances, it tries again until it creates the instance successfully. If you have disabled creation retries, this field will not be populated; instead, the creatingWithoutRetries field will be populated. * * Generated from protobuf field optional int32 creating = 209809081; */ - private $creating = null; + protected $creating = null; /** * [Output Only] The number of instances that the managed instance group will attempt to create. The group attempts to create each instance only once. If the group fails to create any of these instances, it decreases the group's targetSize value accordingly. * * Generated from protobuf field optional int32 creating_without_retries = 369916745; */ - private $creating_without_retries = null; + protected $creating_without_retries = null; /** * [Output Only] The number of instances in the managed instance group that are scheduled to be deleted or are currently being deleted. * * Generated from protobuf field optional int32 deleting = 282846120; */ - private $deleting = null; + protected $deleting = null; /** * [Output Only] The number of instances in the managed instance group that are running and have no scheduled actions. * * Generated from protobuf field optional int32 none = 3387192; */ - private $none = null; + protected $none = null; /** * [Output Only] The number of instances in the managed instance group that are scheduled to be recreated or are currently being being recreated. Recreating an instance deletes the existing root persistent disk and creates a new disk from the image that is defined in the instance template. * * Generated from protobuf field optional int32 recreating = 339057132; */ - private $recreating = null; + protected $recreating = null; /** * [Output Only] The number of instances in the managed instance group that are being reconfigured with properties that do not require a restart or a recreate action. For example, setting or removing target pools for the instance. * * Generated from protobuf field optional int32 refreshing = 215044903; */ - private $refreshing = null; + protected $refreshing = null; /** * [Output Only] The number of instances in the managed instance group that are scheduled to be restarted or are currently being restarted. * * Generated from protobuf field optional int32 restarting = 372312947; */ - private $restarting = null; + protected $restarting = null; /** * [Output Only] The number of instances in the managed instance group that are scheduled to be resumed or are currently being resumed. * * Generated from protobuf field optional int32 resuming = 201100714; */ - private $resuming = null; + protected $resuming = null; /** * [Output Only] The number of instances in the managed instance group that are scheduled to be started or are currently being started. * * Generated from protobuf field optional int32 starting = 243064896; */ - private $starting = null; + protected $starting = null; /** * [Output Only] The number of instances in the managed instance group that are scheduled to be stopped or are currently being stopped. * * Generated from protobuf field optional int32 stopping = 105035892; */ - private $stopping = null; + protected $stopping = null; /** * [Output Only] The number of instances in the managed instance group that are scheduled to be suspended or are currently being suspended. * * Generated from protobuf field optional int32 suspending = 29113894; */ - private $suspending = null; + protected $suspending = null; /** * [Output Only] The number of instances in the managed instance group that are being verified. See the managedInstances[].currentAction property in the listManagedInstances method documentation. * * Generated from protobuf field optional int32 verifying = 451612873; */ - private $verifying = null; + protected $verifying = null; /** * Constructor. diff --git a/Compute/src/V1/InstanceGroupManagerAggregatedList.php b/Compute/src/V1/InstanceGroupManagerAggregatedList.php index 9a29737d2915..09eacd31b050 100644 --- a/Compute/src/V1/InstanceGroupManagerAggregatedList.php +++ b/Compute/src/V1/InstanceGroupManagerAggregatedList.php @@ -19,7 +19,7 @@ class InstanceGroupManagerAggregatedList extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of InstanceGroupManagersScopedList resources. * @@ -31,19 +31,19 @@ class InstanceGroupManagerAggregatedList extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Unreachable resources. * @@ -55,7 +55,7 @@ class InstanceGroupManagerAggregatedList extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/InstanceGroupManagerAllInstancesConfig.php b/Compute/src/V1/InstanceGroupManagerAllInstancesConfig.php index 898c6bcd5b05..dd647de1728d 100644 --- a/Compute/src/V1/InstanceGroupManagerAllInstancesConfig.php +++ b/Compute/src/V1/InstanceGroupManagerAllInstancesConfig.php @@ -19,7 +19,7 @@ class InstanceGroupManagerAllInstancesConfig extends \Google\Protobuf\Internal\M * * Generated from protobuf field optional .google.cloud.compute.v1.InstancePropertiesPatch properties = 147688755; */ - private $properties = null; + protected $properties = null; /** * Constructor. diff --git a/Compute/src/V1/InstanceGroupManagerAutoHealingPolicy.php b/Compute/src/V1/InstanceGroupManagerAutoHealingPolicy.php index 16c5af66ef98..d9edfdc49506 100644 --- a/Compute/src/V1/InstanceGroupManagerAutoHealingPolicy.php +++ b/Compute/src/V1/InstanceGroupManagerAutoHealingPolicy.php @@ -19,13 +19,13 @@ class InstanceGroupManagerAutoHealingPolicy extends \Google\Protobuf\Internal\Me * * Generated from protobuf field optional string health_check = 308876645; */ - private $health_check = null; + protected $health_check = null; /** * The initial delay is the number of seconds that a new VM takes to initialize and run its startup script. During a VM's initial delay period, the MIG ignores unsuccessful health checks because the VM might be in the startup process. This prevents the MIG from prematurely recreating a VM. If the health check receives a healthy response during the initial delay, it indicates that the startup process is complete and the VM is ready. The value of initial delay must be between 0 and 3600 seconds. The default value is 0. * * Generated from protobuf field optional int32 initial_delay_sec = 263207002; */ - private $initial_delay_sec = null; + protected $initial_delay_sec = null; /** * Constructor. diff --git a/Compute/src/V1/InstanceGroupManagerInstanceFlexibilityPolicyInstanceSelection.php b/Compute/src/V1/InstanceGroupManagerInstanceFlexibilityPolicyInstanceSelection.php index 3cb094dee9e3..baaa77e1cddf 100644 --- a/Compute/src/V1/InstanceGroupManagerInstanceFlexibilityPolicyInstanceSelection.php +++ b/Compute/src/V1/InstanceGroupManagerInstanceFlexibilityPolicyInstanceSelection.php @@ -25,7 +25,7 @@ class InstanceGroupManagerInstanceFlexibilityPolicyInstanceSelection extends \Go * * Generated from protobuf field optional int32 rank = 3492908; */ - private $rank = null; + protected $rank = null; /** * Constructor. diff --git a/Compute/src/V1/InstanceGroupManagerInstanceLifecyclePolicy.php b/Compute/src/V1/InstanceGroupManagerInstanceLifecyclePolicy.php index 7fbb588b497a..1c91044fe5fd 100644 --- a/Compute/src/V1/InstanceGroupManagerInstanceLifecyclePolicy.php +++ b/Compute/src/V1/InstanceGroupManagerInstanceLifecyclePolicy.php @@ -20,14 +20,14 @@ class InstanceGroupManagerInstanceLifecyclePolicy extends \Google\Protobuf\Inter * * Generated from protobuf field optional string default_action_on_failure = 61383253; */ - private $default_action_on_failure = null; + protected $default_action_on_failure = null; /** * A bit indicating whether to forcefully apply the group's latest configuration when repairing a VM. Valid options are: - NO (default): If configuration updates are available, they are not forcefully applied during repair. Instead, configuration updates are applied according to the group's update policy. - YES: If configuration updates are available, they are applied during repair. * Check the ForceUpdateOnRepair enum for the list of possible values. * * Generated from protobuf field optional string force_update_on_repair = 356302027; */ - private $force_update_on_repair = null; + protected $force_update_on_repair = null; /** * Constructor. diff --git a/Compute/src/V1/InstanceGroupManagerList.php b/Compute/src/V1/InstanceGroupManagerList.php index 191d1c029f15..37e06b7a8f1b 100644 --- a/Compute/src/V1/InstanceGroupManagerList.php +++ b/Compute/src/V1/InstanceGroupManagerList.php @@ -20,7 +20,7 @@ class InstanceGroupManagerList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of InstanceGroupManager resources. * @@ -32,25 +32,25 @@ class InstanceGroupManagerList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/InstanceGroupManagerResizeRequest.php b/Compute/src/V1/InstanceGroupManagerResizeRequest.php index 844fd11d49be..bb2173ac76b9 100644 --- a/Compute/src/V1/InstanceGroupManagerResizeRequest.php +++ b/Compute/src/V1/InstanceGroupManagerResizeRequest.php @@ -20,74 +20,74 @@ class InstanceGroupManagerResizeRequest extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * An optional description of this resource. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * [Output Only] A unique identifier for this resource type. The server generates this identifier. * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * [Output Only] The resource type, which is always compute#instanceGroupManagerResizeRequest for resize requests. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * The name of this resize request. The name must be 1-63 characters long, and comply with RFC1035. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * Requested run duration for instances that will be created by this request. At the end of the run duration instance will be deleted. * * Generated from protobuf field optional .google.cloud.compute.v1.Duration requested_run_duration = 232146425; */ - private $requested_run_duration = null; + protected $requested_run_duration = null; /** * The number of instances to be created by this resize request. The group's target size will be increased by this number. This field cannot be used together with 'instances'. * * Generated from protobuf field optional int32 resize_by = 533735362; */ - private $resize_by = null; + protected $resize_by = null; /** * [Output Only] The URL for this resize request. The server defines this URL. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Server-defined URL for this resource with the resource id. * * Generated from protobuf field optional string self_link_with_id = 44520962; */ - private $self_link_with_id = null; + protected $self_link_with_id = null; /** * [Output only] Current state of the request. * Check the State enum for the list of possible values. * * Generated from protobuf field optional string state = 109757585; */ - private $state = null; + protected $state = null; /** * [Output only] Status of the request. * * Generated from protobuf field optional .google.cloud.compute.v1.InstanceGroupManagerResizeRequestStatus status = 181260274; */ - private $status = null; + protected $status = null; /** * [Output Only] The URL of a zone where the resize request is located. Populated only for zonal resize requests. * * Generated from protobuf field optional string zone = 3744684; */ - private $zone = null; + protected $zone = null; /** * Constructor. diff --git a/Compute/src/V1/InstanceGroupManagerResizeRequestStatus.php b/Compute/src/V1/InstanceGroupManagerResizeRequestStatus.php index 3ae2450312bc..85eed299cc2e 100644 --- a/Compute/src/V1/InstanceGroupManagerResizeRequestStatus.php +++ b/Compute/src/V1/InstanceGroupManagerResizeRequestStatus.php @@ -19,13 +19,13 @@ class InstanceGroupManagerResizeRequestStatus extends \Google\Protobuf\Internal\ * * Generated from protobuf field optional .google.cloud.compute.v1.Error error = 96784904; */ - private $error = null; + protected $error = null; /** * [Output only] Information about the last attempt to fulfill the request. The value is temporary since the ResizeRequest can retry, as long as it's still active and the last attempt value can either be cleared or replaced with a different error. Since ResizeRequest retries infrequently, the value may be stale and no longer show an active problem. The value is cleared when ResizeRequest transitions to the final state (becomes inactive). If the final state is FAILED the error describing it will be storred in the "error" field only. * * Generated from protobuf field optional .google.cloud.compute.v1.InstanceGroupManagerResizeRequestStatusLastAttempt last_attempt = 434771492; */ - private $last_attempt = null; + protected $last_attempt = null; /** * Constructor. diff --git a/Compute/src/V1/InstanceGroupManagerResizeRequestStatusLastAttempt.php b/Compute/src/V1/InstanceGroupManagerResizeRequestStatusLastAttempt.php index 3e30af1aa0fd..ad551432886f 100644 --- a/Compute/src/V1/InstanceGroupManagerResizeRequestStatusLastAttempt.php +++ b/Compute/src/V1/InstanceGroupManagerResizeRequestStatusLastAttempt.php @@ -19,7 +19,7 @@ class InstanceGroupManagerResizeRequestStatusLastAttempt extends \Google\Protobu * * Generated from protobuf field optional .google.cloud.compute.v1.Error error = 96784904; */ - private $error = null; + protected $error = null; /** * Constructor. diff --git a/Compute/src/V1/InstanceGroupManagerResizeRequestsClient.php b/Compute/src/V1/InstanceGroupManagerResizeRequestsClient.php deleted file mode 100644 index 0cd182c6415f..000000000000 --- a/Compute/src/V1/InstanceGroupManagerResizeRequestsClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of resize request resources. * @@ -32,25 +32,25 @@ class InstanceGroupManagerResizeRequestsListResponse extends \Google\Protobuf\In * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/InstanceGroupManagerResourcePolicies.php b/Compute/src/V1/InstanceGroupManagerResourcePolicies.php index 33d27680b60e..cc525216d6d5 100644 --- a/Compute/src/V1/InstanceGroupManagerResourcePolicies.php +++ b/Compute/src/V1/InstanceGroupManagerResourcePolicies.php @@ -19,7 +19,7 @@ class InstanceGroupManagerResourcePolicies extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field optional string workload_policy = 114721530; */ - private $workload_policy = null; + protected $workload_policy = null; /** * Constructor. diff --git a/Compute/src/V1/InstanceGroupManagerStandbyPolicy.php b/Compute/src/V1/InstanceGroupManagerStandbyPolicy.php index 029a6b899a56..fa3377d50828 100644 --- a/Compute/src/V1/InstanceGroupManagerStandbyPolicy.php +++ b/Compute/src/V1/InstanceGroupManagerStandbyPolicy.php @@ -19,14 +19,14 @@ class InstanceGroupManagerStandbyPolicy extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field optional int32 initial_delay_sec = 263207002; */ - private $initial_delay_sec = null; + protected $initial_delay_sec = null; /** * Defines how a MIG resumes or starts VMs from a standby pool when the group scales out. The default mode is `MANUAL`. * Check the Mode enum for the list of possible values. * * Generated from protobuf field optional string mode = 3357091; */ - private $mode = null; + protected $mode = null; /** * Constructor. diff --git a/Compute/src/V1/InstanceGroupManagerStatus.php b/Compute/src/V1/InstanceGroupManagerStatus.php index 589e9e303513..feebda7817b6 100644 --- a/Compute/src/V1/InstanceGroupManagerStatus.php +++ b/Compute/src/V1/InstanceGroupManagerStatus.php @@ -19,31 +19,31 @@ class InstanceGroupManagerStatus extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.InstanceGroupManagerStatusAllInstancesConfig all_instances_config = 112596737; */ - private $all_instances_config = null; + protected $all_instances_config = null; /** * [Output Only] The URL of the Autoscaler that targets this instance group manager. * * Generated from protobuf field optional string autoscaler = 517258967; */ - private $autoscaler = null; + protected $autoscaler = null; /** * [Output Only] A bit indicating whether the managed instance group is in a stable state. A stable state means that: none of the instances in the managed instance group is currently undergoing any type of change (for example, creation, restart, or deletion); no future changes are scheduled for instances in the managed instance group; and the managed instance group itself is not being modified. * * Generated from protobuf field optional bool is_stable = 108410864; */ - private $is_stable = null; + protected $is_stable = null; /** * [Output Only] Stateful status of the given Instance Group Manager. * * Generated from protobuf field optional .google.cloud.compute.v1.InstanceGroupManagerStatusStateful stateful = 244462412; */ - private $stateful = null; + protected $stateful = null; /** * [Output Only] A status of consistency of Instances' versions with their target version specified by version field on Instance Group Manager. * * Generated from protobuf field optional .google.cloud.compute.v1.InstanceGroupManagerStatusVersionTarget version_target = 289386200; */ - private $version_target = null; + protected $version_target = null; /** * Constructor. diff --git a/Compute/src/V1/InstanceGroupManagerStatusAllInstancesConfig.php b/Compute/src/V1/InstanceGroupManagerStatusAllInstancesConfig.php index 4b3888089122..5fe8105edfa9 100644 --- a/Compute/src/V1/InstanceGroupManagerStatusAllInstancesConfig.php +++ b/Compute/src/V1/InstanceGroupManagerStatusAllInstancesConfig.php @@ -19,13 +19,13 @@ class InstanceGroupManagerStatusAllInstancesConfig extends \Google\Protobuf\Inte * * Generated from protobuf field optional string current_revision = 38355937; */ - private $current_revision = null; + protected $current_revision = null; /** * [Output Only] A bit indicating whether this configuration has been applied to all managed instances in the group. * * Generated from protobuf field optional bool effective = 141961639; */ - private $effective = null; + protected $effective = null; /** * Constructor. diff --git a/Compute/src/V1/InstanceGroupManagerStatusStateful.php b/Compute/src/V1/InstanceGroupManagerStatusStateful.php index 168b327fcdcb..3b052f173d82 100644 --- a/Compute/src/V1/InstanceGroupManagerStatusStateful.php +++ b/Compute/src/V1/InstanceGroupManagerStatusStateful.php @@ -19,13 +19,13 @@ class InstanceGroupManagerStatusStateful extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field optional bool has_stateful_config = 110474224; */ - private $has_stateful_config = null; + protected $has_stateful_config = null; /** * [Output Only] Status of per-instance configurations on the instances. * * Generated from protobuf field optional .google.cloud.compute.v1.InstanceGroupManagerStatusStatefulPerInstanceConfigs per_instance_configs = 526265001; */ - private $per_instance_configs = null; + protected $per_instance_configs = null; /** * Constructor. diff --git a/Compute/src/V1/InstanceGroupManagerStatusStatefulPerInstanceConfigs.php b/Compute/src/V1/InstanceGroupManagerStatusStatefulPerInstanceConfigs.php index 7b86e2bcb333..b68e4dc5655e 100644 --- a/Compute/src/V1/InstanceGroupManagerStatusStatefulPerInstanceConfigs.php +++ b/Compute/src/V1/InstanceGroupManagerStatusStatefulPerInstanceConfigs.php @@ -19,7 +19,7 @@ class InstanceGroupManagerStatusStatefulPerInstanceConfigs extends \Google\Proto * * Generated from protobuf field optional bool all_effective = 516540553; */ - private $all_effective = null; + protected $all_effective = null; /** * Constructor. diff --git a/Compute/src/V1/InstanceGroupManagerStatusVersionTarget.php b/Compute/src/V1/InstanceGroupManagerStatusVersionTarget.php index 116acafd7541..3cb8e8efacdb 100644 --- a/Compute/src/V1/InstanceGroupManagerStatusVersionTarget.php +++ b/Compute/src/V1/InstanceGroupManagerStatusVersionTarget.php @@ -19,7 +19,7 @@ class InstanceGroupManagerStatusVersionTarget extends \Google\Protobuf\Internal\ * * Generated from protobuf field optional bool is_reached = 433209149; */ - private $is_reached = null; + protected $is_reached = null; /** * Constructor. diff --git a/Compute/src/V1/InstanceGroupManagerUpdatePolicy.php b/Compute/src/V1/InstanceGroupManagerUpdatePolicy.php index 2ed041b504d1..d50ab874da0c 100644 --- a/Compute/src/V1/InstanceGroupManagerUpdatePolicy.php +++ b/Compute/src/V1/InstanceGroupManagerUpdatePolicy.php @@ -20,47 +20,47 @@ class InstanceGroupManagerUpdatePolicy extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string instance_redistribution_type = 292630424; */ - private $instance_redistribution_type = null; + protected $instance_redistribution_type = null; /** * The maximum number of instances that can be created above the specified targetSize during the update process. This value can be either a fixed number or, if the group has 10 or more instances, a percentage. If you set a percentage, the number of instances is rounded if necessary. The default value for maxSurge is a fixed value equal to the number of zones in which the managed instance group operates. At least one of either maxSurge or maxUnavailable must be greater than 0. Learn more about maxSurge. * * Generated from protobuf field optional .google.cloud.compute.v1.FixedOrPercent max_surge = 302572691; */ - private $max_surge = null; + protected $max_surge = null; /** * The maximum number of instances that can be unavailable during the update process. An instance is considered available if all of the following conditions are satisfied: - The instance's status is RUNNING. - If there is a health check on the instance group, the instance's health check status must be HEALTHY at least once. If there is no health check on the group, then the instance only needs to have a status of RUNNING to be considered available. This value can be either a fixed number or, if the group has 10 or more instances, a percentage. If you set a percentage, the number of instances is rounded if necessary. The default value for maxUnavailable is a fixed value equal to the number of zones in which the managed instance group operates. At least one of either maxSurge or maxUnavailable must be greater than 0. Learn more about maxUnavailable. * * Generated from protobuf field optional .google.cloud.compute.v1.FixedOrPercent max_unavailable = 404940277; */ - private $max_unavailable = null; + protected $max_unavailable = null; /** * Minimal action to be taken on an instance. Use this option to minimize disruption as much as possible or to apply a more disruptive action than is necessary. - To limit disruption as much as possible, set the minimal action to REFRESH. If your update requires a more disruptive action, Compute Engine performs the necessary action to execute the update. - To apply a more disruptive action than is strictly necessary, set the minimal action to RESTART or REPLACE. For example, Compute Engine does not need to restart a VM to change its metadata. But if your application reads instance metadata only when a VM is restarted, you can set the minimal action to RESTART in order to pick up metadata changes. * Check the MinimalAction enum for the list of possible values. * * Generated from protobuf field optional string minimal_action = 270567060; */ - private $minimal_action = null; + protected $minimal_action = null; /** * Most disruptive action that is allowed to be taken on an instance. You can specify either NONE to forbid any actions, REFRESH to avoid restarting the VM and to limit disruption as much as possible. RESTART to allow actions that can be applied without instance replacing or REPLACE to allow all possible actions. If the Updater determines that the minimal update action needed is more disruptive than most disruptive allowed action you specify it will not perform the update at all. * Check the MostDisruptiveAllowedAction enum for the list of possible values. * * Generated from protobuf field optional string most_disruptive_allowed_action = 66103053; */ - private $most_disruptive_allowed_action = null; + protected $most_disruptive_allowed_action = null; /** * What action should be used to replace instances. See minimal_action.REPLACE * Check the ReplacementMethod enum for the list of possible values. * * Generated from protobuf field optional string replacement_method = 505931694; */ - private $replacement_method = null; + protected $replacement_method = null; /** * The type of update process. You can specify either PROACTIVE so that the MIG automatically updates VMs to the latest configurations or OPPORTUNISTIC so that you can select the VMs that you want to update. * Check the Type enum for the list of possible values. * * Generated from protobuf field optional string type = 3575610; */ - private $type = null; + protected $type = null; /** * Constructor. diff --git a/Compute/src/V1/InstanceGroupManagerVersion.php b/Compute/src/V1/InstanceGroupManagerVersion.php index 7ba325887d21..0493b216e222 100644 --- a/Compute/src/V1/InstanceGroupManagerVersion.php +++ b/Compute/src/V1/InstanceGroupManagerVersion.php @@ -19,19 +19,19 @@ class InstanceGroupManagerVersion extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string instance_template = 309248228; */ - private $instance_template = null; + protected $instance_template = null; /** * Name of the version. Unique among all versions in the scope of this managed instance group. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * Specifies the intended number of instances to be created from the instanceTemplate. The final number of instances created from the template will be equal to: - If expressed as a fixed number, the minimum of either targetSize.fixed or instanceGroupManager.targetSize is used. - if expressed as a percent, the targetSize would be (targetSize.percent/100 * InstanceGroupManager.targetSize) If there is a remainder, the number is rounded. If unset, this version will update any remaining instances not updated by another version. Read Starting a canary update for more information. * * Generated from protobuf field optional .google.cloud.compute.v1.FixedOrPercent target_size = 62880239; */ - private $target_size = null; + protected $target_size = null; /** * Constructor. diff --git a/Compute/src/V1/InstanceGroupManagersApplyUpdatesRequest.php b/Compute/src/V1/InstanceGroupManagersApplyUpdatesRequest.php index 69065a64dbfa..008b9a78bf18 100644 --- a/Compute/src/V1/InstanceGroupManagersApplyUpdatesRequest.php +++ b/Compute/src/V1/InstanceGroupManagersApplyUpdatesRequest.php @@ -20,7 +20,7 @@ class InstanceGroupManagersApplyUpdatesRequest extends \Google\Protobuf\Internal * * Generated from protobuf field optional bool all_instances = 403676512; */ - private $all_instances = null; + protected $all_instances = null; /** * The list of URLs of one or more instances for which you want to apply updates. Each URL can be a full URL or a partial URL, such as zones/[ZONE]/instances/[INSTANCE_NAME]. * @@ -33,14 +33,14 @@ class InstanceGroupManagersApplyUpdatesRequest extends \Google\Protobuf\Internal * * Generated from protobuf field optional string minimal_action = 270567060; */ - private $minimal_action = null; + protected $minimal_action = null; /** * The most disruptive action that you want to perform on each instance during the update: - REPLACE: Delete the instance and create it again. - RESTART: Stop the instance and start it again. - REFRESH: Do not stop the instance and limit disruption as much as possible. - NONE: Do not disrupt the instance at all. By default, the most disruptive allowed action is REPLACE. If your update requires a more disruptive action than you set with this flag, the update request will fail. * Check the MostDisruptiveAllowedAction enum for the list of possible values. * * Generated from protobuf field optional string most_disruptive_allowed_action = 66103053; */ - private $most_disruptive_allowed_action = null; + protected $most_disruptive_allowed_action = null; /** * Constructor. diff --git a/Compute/src/V1/InstanceGroupManagersClient.php b/Compute/src/V1/InstanceGroupManagersClient.php deleted file mode 100644 index 12bcf0c25c5c..000000000000 --- a/Compute/src/V1/InstanceGroupManagersClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional bool skip_instances_on_validation_error = 40631073; */ - private $skip_instances_on_validation_error = null; + protected $skip_instances_on_validation_error = null; /** * Constructor. diff --git a/Compute/src/V1/InstanceGroupManagersListErrorsResponse.php b/Compute/src/V1/InstanceGroupManagersListErrorsResponse.php index 0bb1e54ee495..175c9a81944a 100644 --- a/Compute/src/V1/InstanceGroupManagersListErrorsResponse.php +++ b/Compute/src/V1/InstanceGroupManagersListErrorsResponse.php @@ -25,7 +25,7 @@ class InstanceGroupManagersListErrorsResponse extends \Google\Protobuf\Internal\ * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * Constructor. diff --git a/Compute/src/V1/InstanceGroupManagersListManagedInstancesResponse.php b/Compute/src/V1/InstanceGroupManagersListManagedInstancesResponse.php index 01836e45310a..02dac0019a8f 100644 --- a/Compute/src/V1/InstanceGroupManagersListManagedInstancesResponse.php +++ b/Compute/src/V1/InstanceGroupManagersListManagedInstancesResponse.php @@ -25,7 +25,7 @@ class InstanceGroupManagersListManagedInstancesResponse extends \Google\Protobuf * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * Constructor. diff --git a/Compute/src/V1/InstanceGroupManagersListPerInstanceConfigsResp.php b/Compute/src/V1/InstanceGroupManagersListPerInstanceConfigsResp.php index 8b9bd9ab324a..dc960ae2c068 100644 --- a/Compute/src/V1/InstanceGroupManagersListPerInstanceConfigsResp.php +++ b/Compute/src/V1/InstanceGroupManagersListPerInstanceConfigsResp.php @@ -25,13 +25,13 @@ class InstanceGroupManagersListPerInstanceConfigsResp extends \Google\Protobuf\I * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/InstanceGroupManagersScopedList.php b/Compute/src/V1/InstanceGroupManagersScopedList.php index f09f817ce010..6c6428ca677d 100644 --- a/Compute/src/V1/InstanceGroupManagersScopedList.php +++ b/Compute/src/V1/InstanceGroupManagersScopedList.php @@ -25,7 +25,7 @@ class InstanceGroupManagersScopedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/InstanceGroupManagersSetInstanceTemplateRequest.php b/Compute/src/V1/InstanceGroupManagersSetInstanceTemplateRequest.php index 4c9b147cf13b..f68c28b853f8 100644 --- a/Compute/src/V1/InstanceGroupManagersSetInstanceTemplateRequest.php +++ b/Compute/src/V1/InstanceGroupManagersSetInstanceTemplateRequest.php @@ -19,7 +19,7 @@ class InstanceGroupManagersSetInstanceTemplateRequest extends \Google\Protobuf\I * * Generated from protobuf field optional string instance_template = 309248228; */ - private $instance_template = null; + protected $instance_template = null; /** * Constructor. diff --git a/Compute/src/V1/InstanceGroupManagersSetTargetPoolsRequest.php b/Compute/src/V1/InstanceGroupManagersSetTargetPoolsRequest.php index 1a3926891ace..a89d62c5613d 100644 --- a/Compute/src/V1/InstanceGroupManagersSetTargetPoolsRequest.php +++ b/Compute/src/V1/InstanceGroupManagersSetTargetPoolsRequest.php @@ -19,7 +19,7 @@ class InstanceGroupManagersSetTargetPoolsRequest extends \Google\Protobuf\Intern * * Generated from protobuf field optional string fingerprint = 234678500; */ - private $fingerprint = null; + protected $fingerprint = null; /** * The list of target pool URLs that instances in this managed instance group belong to. The managed instance group applies these target pools to all of the instances in the group. Existing instances and new instances in the group all receive these target pool settings. * diff --git a/Compute/src/V1/InstanceGroupManagersStopInstancesRequest.php b/Compute/src/V1/InstanceGroupManagersStopInstancesRequest.php index 8ace64f0c491..cf374062071d 100644 --- a/Compute/src/V1/InstanceGroupManagersStopInstancesRequest.php +++ b/Compute/src/V1/InstanceGroupManagersStopInstancesRequest.php @@ -19,7 +19,7 @@ class InstanceGroupManagersStopInstancesRequest extends \Google\Protobuf\Interna * * Generated from protobuf field optional bool force_stop = 134762710; */ - private $force_stop = null; + protected $force_stop = null; /** * The URLs of one or more instances to stop. This can be a full URL or a partial URL, such as zones/[ZONE]/instances/[INSTANCE_NAME]. * diff --git a/Compute/src/V1/InstanceGroupManagersSuspendInstancesRequest.php b/Compute/src/V1/InstanceGroupManagersSuspendInstancesRequest.php index ed9d03ed3ad6..ec96f9adbbe2 100644 --- a/Compute/src/V1/InstanceGroupManagersSuspendInstancesRequest.php +++ b/Compute/src/V1/InstanceGroupManagersSuspendInstancesRequest.php @@ -19,7 +19,7 @@ class InstanceGroupManagersSuspendInstancesRequest extends \Google\Protobuf\Inte * * Generated from protobuf field optional bool force_suspend = 27637480; */ - private $force_suspend = null; + protected $force_suspend = null; /** * The URLs of one or more instances to suspend. This can be a full URL or a partial URL, such as zones/[ZONE]/instances/[INSTANCE_NAME]. * diff --git a/Compute/src/V1/InstanceGroupsClient.php b/Compute/src/V1/InstanceGroupsClient.php deleted file mode 100644 index 48cdc043e739..000000000000 --- a/Compute/src/V1/InstanceGroupsClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of InstanceWithNamedPorts resources. * @@ -31,25 +31,25 @@ class InstanceGroupsListInstances extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/InstanceGroupsListInstancesRequest.php b/Compute/src/V1/InstanceGroupsListInstancesRequest.php index 222e072ddca2..c9c5cf194e1b 100644 --- a/Compute/src/V1/InstanceGroupsListInstancesRequest.php +++ b/Compute/src/V1/InstanceGroupsListInstancesRequest.php @@ -20,7 +20,7 @@ class InstanceGroupsListInstancesRequest extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field optional string instance_state = 92223591; */ - private $instance_state = null; + protected $instance_state = null; /** * Constructor. diff --git a/Compute/src/V1/InstanceGroupsScopedList.php b/Compute/src/V1/InstanceGroupsScopedList.php index 867443bceb7b..96308c03a27e 100644 --- a/Compute/src/V1/InstanceGroupsScopedList.php +++ b/Compute/src/V1/InstanceGroupsScopedList.php @@ -25,7 +25,7 @@ class InstanceGroupsScopedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/InstanceGroupsSetNamedPortsRequest.php b/Compute/src/V1/InstanceGroupsSetNamedPortsRequest.php index cbc80cb6a1fd..ca1013cbc87b 100644 --- a/Compute/src/V1/InstanceGroupsSetNamedPortsRequest.php +++ b/Compute/src/V1/InstanceGroupsSetNamedPortsRequest.php @@ -19,7 +19,7 @@ class InstanceGroupsSetNamedPortsRequest extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field optional string fingerprint = 234678500; */ - private $fingerprint = null; + protected $fingerprint = null; /** * The list of named ports to set for this instance group. * diff --git a/Compute/src/V1/InstanceList.php b/Compute/src/V1/InstanceList.php index 76c29dcf52a3..771276ead510 100644 --- a/Compute/src/V1/InstanceList.php +++ b/Compute/src/V1/InstanceList.php @@ -20,7 +20,7 @@ class InstanceList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of Instance resources. * @@ -32,25 +32,25 @@ class InstanceList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/InstanceListReferrers.php b/Compute/src/V1/InstanceListReferrers.php index ea499787d3b3..28577dd44f37 100644 --- a/Compute/src/V1/InstanceListReferrers.php +++ b/Compute/src/V1/InstanceListReferrers.php @@ -20,7 +20,7 @@ class InstanceListReferrers extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of Reference resources. * @@ -32,25 +32,25 @@ class InstanceListReferrers extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/InstanceManagedByIgmError.php b/Compute/src/V1/InstanceManagedByIgmError.php index 20d781d4cda9..0ad355990fcd 100644 --- a/Compute/src/V1/InstanceManagedByIgmError.php +++ b/Compute/src/V1/InstanceManagedByIgmError.php @@ -19,19 +19,19 @@ class InstanceManagedByIgmError extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.InstanceManagedByIgmErrorManagedInstanceError error = 96784904; */ - private $error = null; + protected $error = null; /** * [Output Only] Details of the instance action that triggered this error. May be null, if the error was not caused by an action on an instance. This field is optional. * * Generated from protobuf field optional .google.cloud.compute.v1.InstanceManagedByIgmErrorInstanceActionDetails instance_action_details = 292224547; */ - private $instance_action_details = null; + protected $instance_action_details = null; /** * [Output Only] The time that this error occurred. This value is in RFC3339 text format. * * Generated from protobuf field optional string timestamp = 55126294; */ - private $timestamp = null; + protected $timestamp = null; /** * Constructor. diff --git a/Compute/src/V1/InstanceManagedByIgmErrorInstanceActionDetails.php b/Compute/src/V1/InstanceManagedByIgmErrorInstanceActionDetails.php index 540ef16c1134..f08eb09ac5dc 100644 --- a/Compute/src/V1/InstanceManagedByIgmErrorInstanceActionDetails.php +++ b/Compute/src/V1/InstanceManagedByIgmErrorInstanceActionDetails.php @@ -20,19 +20,19 @@ class InstanceManagedByIgmErrorInstanceActionDetails extends \Google\Protobuf\In * * Generated from protobuf field optional string action = 187661878; */ - private $action = null; + protected $action = null; /** * [Output Only] The URL of the instance. The URL can be set even if the instance has not yet been created. * * Generated from protobuf field optional string instance = 18257045; */ - private $instance = null; + protected $instance = null; /** * [Output Only] Version this instance was created from, or was being created from, but the creation failed. Corresponds to one of the versions that were set on the Instance Group Manager resource at the time this instance was being created. * * Generated from protobuf field optional .google.cloud.compute.v1.ManagedInstanceVersion version = 351608024; */ - private $version = null; + protected $version = null; /** * Constructor. diff --git a/Compute/src/V1/InstanceManagedByIgmErrorManagedInstanceError.php b/Compute/src/V1/InstanceManagedByIgmErrorManagedInstanceError.php index 0657f966e73d..8eef6d1f8a67 100644 --- a/Compute/src/V1/InstanceManagedByIgmErrorManagedInstanceError.php +++ b/Compute/src/V1/InstanceManagedByIgmErrorManagedInstanceError.php @@ -19,13 +19,13 @@ class InstanceManagedByIgmErrorManagedInstanceError extends \Google\Protobuf\Int * * Generated from protobuf field optional string code = 3059181; */ - private $code = null; + protected $code = null; /** * [Output Only] Error message. * * Generated from protobuf field optional string message = 418054151; */ - private $message = null; + protected $message = null; /** * Constructor. diff --git a/Compute/src/V1/InstanceMoveRequest.php b/Compute/src/V1/InstanceMoveRequest.php index abb90b308bff..38673a8d0201 100644 --- a/Compute/src/V1/InstanceMoveRequest.php +++ b/Compute/src/V1/InstanceMoveRequest.php @@ -19,13 +19,13 @@ class InstanceMoveRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string destination_zone = 131854653; */ - private $destination_zone = null; + protected $destination_zone = null; /** * The URL of the target instance to move. This can be a full or partial URL. For example, the following are all valid URLs to an instance: - https://www.googleapis.com/compute/v1/projects/project/zones/zone /instances/instance - projects/project/zones/zone/instances/instance - zones/zone/instances/instance * * Generated from protobuf field optional string target_instance = 289769347; */ - private $target_instance = null; + protected $target_instance = null; /** * Constructor. diff --git a/Compute/src/V1/InstanceProperties.php b/Compute/src/V1/InstanceProperties.php index b518ba627f2d..b59acc9001fb 100644 --- a/Compute/src/V1/InstanceProperties.php +++ b/Compute/src/V1/InstanceProperties.php @@ -19,25 +19,25 @@ class InstanceProperties extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.AdvancedMachineFeatures advanced_machine_features = 409646002; */ - private $advanced_machine_features = null; + protected $advanced_machine_features = null; /** * Enables instances created based on these properties to send packets with source IP addresses other than their own and receive packets with destination IP addresses other than their own. If these instances will be used as an IP gateway or it will be set as the next-hop in a Route resource, specify true. If unsure, leave this set to false. See the Enable IP forwarding documentation for more information. * * Generated from protobuf field optional bool can_ip_forward = 467731324; */ - private $can_ip_forward = null; + protected $can_ip_forward = null; /** * Specifies the Confidential Instance options. Note that for MachineImage, this is not supported yet. * * Generated from protobuf field optional .google.cloud.compute.v1.ConfidentialInstanceConfig confidential_instance_config = 490637685; */ - private $confidential_instance_config = null; + protected $confidential_instance_config = null; /** * An optional text description for the instances that are created from these properties. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * An array of disks that are associated with the instances that are created from these properties. * @@ -56,7 +56,7 @@ class InstanceProperties extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string key_revocation_action_type = 235941474; */ - private $key_revocation_action_type = null; + protected $key_revocation_action_type = null; /** * Labels to apply to instances that are created from these properties. * @@ -68,19 +68,19 @@ class InstanceProperties extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string machine_type = 227711026; */ - private $machine_type = null; + protected $machine_type = null; /** * The metadata key/value pairs to assign to instances that are created from these properties. These pairs can consist of custom metadata or predefined keys. See Project and instance metadata for more information. * * Generated from protobuf field optional .google.cloud.compute.v1.Metadata metadata = 86866735; */ - private $metadata = null; + protected $metadata = null; /** * Minimum cpu/platform to be used by instances. The instance may be scheduled on the specified or newer cpu/platform. Applicable values are the friendly names of CPU platforms, such as minCpuPlatform: "Intel Haswell" or minCpuPlatform: "Intel Sandy Bridge". For more information, read Specifying a Minimum CPU Platform. * * Generated from protobuf field optional string min_cpu_platform = 242912759; */ - private $min_cpu_platform = null; + protected $min_cpu_platform = null; /** * An array of network access configurations for this interface. * @@ -92,20 +92,20 @@ class InstanceProperties extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.NetworkPerformanceConfig network_performance_config = 398330850; */ - private $network_performance_config = null; + protected $network_performance_config = null; /** * The private IPv6 google access type for VMs. If not specified, use INHERIT_FROM_SUBNETWORK as default. Note that for MachineImage, this is not supported yet. * Check the PrivateIpv6GoogleAccess enum for the list of possible values. * * Generated from protobuf field optional string private_ipv6_google_access = 48277006; */ - private $private_ipv6_google_access = null; + protected $private_ipv6_google_access = null; /** * Specifies the reservations that instances can consume from. Note that for MachineImage, this is not supported yet. * * Generated from protobuf field optional .google.cloud.compute.v1.ReservationAffinity reservation_affinity = 157850683; */ - private $reservation_affinity = null; + protected $reservation_affinity = null; /** * Resource manager tags to be bound to the instance. Tag keys and values have the same definition as resource manager tags. Keys must be in the format `tagKeys/{tag_key_id}`, and values are in the format `tagValues/456`. The field is ignored (both PUT & PATCH) when empty. * @@ -123,7 +123,7 @@ class InstanceProperties extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.Scheduling scheduling = 386688404; */ - private $scheduling = null; + protected $scheduling = null; /** * A list of service accounts with specified scopes. Access tokens for these service accounts are available to the instances that are created from these properties. Use metadata queries to obtain the access tokens for these instances. * @@ -135,13 +135,13 @@ class InstanceProperties extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.ShieldedInstanceConfig shielded_instance_config = 12862901; */ - private $shielded_instance_config = null; + protected $shielded_instance_config = null; /** * A list of tags to apply to the instances that are created from these properties. The tags identify valid sources or targets for network firewalls. The setTags method can modify this list of tags. Each tag within the list must comply with RFC1035. * * Generated from protobuf field optional .google.cloud.compute.v1.Tags tags = 3552281; */ - private $tags = null; + protected $tags = null; /** * Constructor. diff --git a/Compute/src/V1/InstanceReference.php b/Compute/src/V1/InstanceReference.php index f2a65c98405d..e8194ae5c5f2 100644 --- a/Compute/src/V1/InstanceReference.php +++ b/Compute/src/V1/InstanceReference.php @@ -19,7 +19,7 @@ class InstanceReference extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string instance = 18257045; */ - private $instance = null; + protected $instance = null; /** * Constructor. diff --git a/Compute/src/V1/InstanceSettings.php b/Compute/src/V1/InstanceSettings.php index 76de0c50dffc..040ab50fe4f4 100644 --- a/Compute/src/V1/InstanceSettings.php +++ b/Compute/src/V1/InstanceSettings.php @@ -20,25 +20,25 @@ class InstanceSettings extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string fingerprint = 234678500; */ - private $fingerprint = null; + protected $fingerprint = null; /** * [Output Only] Type of the resource. Always compute#instance_settings for instance settings. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * The metadata key/value pairs assigned to all the instances in the corresponding scope. * * Generated from protobuf field optional .google.cloud.compute.v1.InstanceSettingsMetadata metadata = 86866735; */ - private $metadata = null; + protected $metadata = null; /** * [Output Only] URL of the zone where the resource resides You must specify this field as part of the HTTP request URL. It is not settable as a field in the request body. * * Generated from protobuf field optional string zone = 3744684; */ - private $zone = null; + protected $zone = null; /** * Constructor. diff --git a/Compute/src/V1/InstanceSettingsMetadata.php b/Compute/src/V1/InstanceSettingsMetadata.php index cf6a0cf56844..cf49587f9d4a 100644 --- a/Compute/src/V1/InstanceSettingsMetadata.php +++ b/Compute/src/V1/InstanceSettingsMetadata.php @@ -25,7 +25,7 @@ class InstanceSettingsMetadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * Constructor. diff --git a/Compute/src/V1/InstanceSettingsServiceClient.php b/Compute/src/V1/InstanceSettingsServiceClient.php deleted file mode 100644 index d30cb2b798b4..000000000000 --- a/Compute/src/V1/InstanceSettingsServiceClient.php +++ /dev/null @@ -1,34 +0,0 @@ -google.cloud.compute.v1.InstanceTemplate */ @@ -20,61 +20,61 @@ class InstanceTemplate extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * An optional description of this resource. Provide this property when you create the resource. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * [Output Only] A unique identifier for this instance template. The server defines this identifier. * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * [Output Only] The resource type, which is always compute#instanceTemplate for instance templates. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * Name of the resource; provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * The instance properties for this instance template. * * Generated from protobuf field optional .google.cloud.compute.v1.InstanceProperties properties = 147688755; */ - private $properties = null; + protected $properties = null; /** * [Output Only] URL of the region where the instance template resides. Only applicable for regional resources. * * Generated from protobuf field optional string region = 138946292; */ - private $region = null; + protected $region = null; /** * [Output Only] The URL for this instance template. The server defines this URL. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * The source instance used to create the template. You can provide this as a partial or full URL to the resource. For example, the following are valid values: - https://www.googleapis.com/compute/v1/projects/project/zones/zone /instances/instance - projects/project/zones/zone/instances/instance * * Generated from protobuf field optional string source_instance = 396315705; */ - private $source_instance = null; + protected $source_instance = null; /** * The source instance params to use to create this instance template. * * Generated from protobuf field optional .google.cloud.compute.v1.SourceInstanceParams source_instance_params = 135342156; */ - private $source_instance_params = null; + protected $source_instance_params = null; /** * Constructor. diff --git a/Compute/src/V1/InstanceTemplateAggregatedList.php b/Compute/src/V1/InstanceTemplateAggregatedList.php index 0290382f2669..bbbfb5b50cd6 100644 --- a/Compute/src/V1/InstanceTemplateAggregatedList.php +++ b/Compute/src/V1/InstanceTemplateAggregatedList.php @@ -20,7 +20,7 @@ class InstanceTemplateAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of InstanceTemplatesScopedList resources. * @@ -32,25 +32,25 @@ class InstanceTemplateAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/InstanceTemplateList.php b/Compute/src/V1/InstanceTemplateList.php index b746679dd622..1a3a3290d408 100644 --- a/Compute/src/V1/InstanceTemplateList.php +++ b/Compute/src/V1/InstanceTemplateList.php @@ -20,7 +20,7 @@ class InstanceTemplateList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of InstanceTemplate resources. * @@ -32,25 +32,25 @@ class InstanceTemplateList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/InstanceTemplatesClient.php b/Compute/src/V1/InstanceTemplatesClient.php deleted file mode 100644 index 944a2ef5fd7e..000000000000 --- a/Compute/src/V1/InstanceTemplatesClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/InstanceWithNamedPorts.php b/Compute/src/V1/InstanceWithNamedPorts.php index 9c11c67a68bc..11f0b3b92626 100644 --- a/Compute/src/V1/InstanceWithNamedPorts.php +++ b/Compute/src/V1/InstanceWithNamedPorts.php @@ -19,7 +19,7 @@ class InstanceWithNamedPorts extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string instance = 18257045; */ - private $instance = null; + protected $instance = null; /** * [Output Only] The named ports that belong to this instance group. * @@ -32,7 +32,7 @@ class InstanceWithNamedPorts extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string status = 181260274; */ - private $status = null; + protected $status = null; /** * Constructor. diff --git a/Compute/src/V1/InstancesClient.php b/Compute/src/V1/InstancesClient.php deleted file mode 100644 index e7c6bcd87ed8..000000000000 --- a/Compute/src/V1/InstancesClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional string display_name = 4473832; */ - private $display_name = null; + protected $display_name = null; /** * [Output Only] The name of the firewall policy. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * [Output Only] The packet mirroring rules that apply to the instance. * @@ -37,7 +37,7 @@ class InstancesGetEffectiveFirewallsResponseEffectiveFirewallPolicy extends \Goo * * Generated from protobuf field optional int32 priority = 445151652; */ - private $priority = null; + protected $priority = null; /** * [Output Only] The rules that apply to the instance. Only rules that target the specific VM instance are returned if target service accounts or target secure tags are specified in the rules. * @@ -49,14 +49,14 @@ class InstancesGetEffectiveFirewallsResponseEffectiveFirewallPolicy extends \Goo * * Generated from protobuf field optional string short_name = 492051566; */ - private $short_name = null; + protected $short_name = null; /** * [Output Only] The type of the firewall policy. Can be one of HIERARCHY, NETWORK, NETWORK_REGIONAL, SYSTEM_GLOBAL, SYSTEM_REGIONAL. * Check the Type enum for the list of possible values. * * Generated from protobuf field optional string type = 3575610; */ - private $type = null; + protected $type = null; /** * Constructor. diff --git a/Compute/src/V1/InstancesReportHostAsFaultyRequest.php b/Compute/src/V1/InstancesReportHostAsFaultyRequest.php index 59bb57f8d215..9a6f2eb8cec1 100644 --- a/Compute/src/V1/InstancesReportHostAsFaultyRequest.php +++ b/Compute/src/V1/InstancesReportHostAsFaultyRequest.php @@ -20,7 +20,7 @@ class InstancesReportHostAsFaultyRequest extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field optional string disruption_schedule = 95871619; */ - private $disruption_schedule = null; + protected $disruption_schedule = null; /** * Generated from protobuf field repeated .google.cloud.compute.v1.InstancesReportHostAsFaultyRequestFaultReason fault_reasons = 168056210; */ diff --git a/Compute/src/V1/InstancesReportHostAsFaultyRequestFaultReason.php b/Compute/src/V1/InstancesReportHostAsFaultyRequestFaultReason.php index 64f0cab216a1..271c6497e7f1 100644 --- a/Compute/src/V1/InstancesReportHostAsFaultyRequestFaultReason.php +++ b/Compute/src/V1/InstancesReportHostAsFaultyRequestFaultReason.php @@ -20,11 +20,11 @@ class InstancesReportHostAsFaultyRequestFaultReason extends \Google\Protobuf\Int * * Generated from protobuf field optional string behavior = 437170770; */ - private $behavior = null; + protected $behavior = null; /** * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * Constructor. diff --git a/Compute/src/V1/InstancesScopedList.php b/Compute/src/V1/InstancesScopedList.php index 689b54a62b0c..a2f5a40b3883 100644 --- a/Compute/src/V1/InstancesScopedList.php +++ b/Compute/src/V1/InstancesScopedList.php @@ -25,7 +25,7 @@ class InstancesScopedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/InstancesSetLabelsRequest.php b/Compute/src/V1/InstancesSetLabelsRequest.php index 0b0f2b300d41..a5234e76d34c 100644 --- a/Compute/src/V1/InstancesSetLabelsRequest.php +++ b/Compute/src/V1/InstancesSetLabelsRequest.php @@ -19,7 +19,7 @@ class InstancesSetLabelsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string label_fingerprint = 178124825; */ - private $label_fingerprint = null; + protected $label_fingerprint = null; /** * Generated from protobuf field map labels = 500195327; */ diff --git a/Compute/src/V1/InstancesSetMachineTypeRequest.php b/Compute/src/V1/InstancesSetMachineTypeRequest.php index 118493be933d..2822a3c93e1a 100644 --- a/Compute/src/V1/InstancesSetMachineTypeRequest.php +++ b/Compute/src/V1/InstancesSetMachineTypeRequest.php @@ -19,7 +19,7 @@ class InstancesSetMachineTypeRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string machine_type = 227711026; */ - private $machine_type = null; + protected $machine_type = null; /** * Constructor. diff --git a/Compute/src/V1/InstancesSetMinCpuPlatformRequest.php b/Compute/src/V1/InstancesSetMinCpuPlatformRequest.php index b6db6a94463f..d77cdb457a32 100644 --- a/Compute/src/V1/InstancesSetMinCpuPlatformRequest.php +++ b/Compute/src/V1/InstancesSetMinCpuPlatformRequest.php @@ -19,7 +19,7 @@ class InstancesSetMinCpuPlatformRequest extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field optional string min_cpu_platform = 242912759; */ - private $min_cpu_platform = null; + protected $min_cpu_platform = null; /** * Constructor. diff --git a/Compute/src/V1/InstancesSetNameRequest.php b/Compute/src/V1/InstancesSetNameRequest.php index 48c92f002e14..01ab2162aac7 100644 --- a/Compute/src/V1/InstancesSetNameRequest.php +++ b/Compute/src/V1/InstancesSetNameRequest.php @@ -19,13 +19,13 @@ class InstancesSetNameRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string current_name = 394983825; */ - private $current_name = null; + protected $current_name = null; /** * The name to be applied to the instance. Needs to be RFC 1035 compliant. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * Constructor. diff --git a/Compute/src/V1/InstancesSetSecurityPolicyRequest.php b/Compute/src/V1/InstancesSetSecurityPolicyRequest.php index 59ead552d8a8..0b5d5059a2cd 100644 --- a/Compute/src/V1/InstancesSetSecurityPolicyRequest.php +++ b/Compute/src/V1/InstancesSetSecurityPolicyRequest.php @@ -25,7 +25,7 @@ class InstancesSetSecurityPolicyRequest extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field optional string security_policy = 171082513; */ - private $security_policy = null; + protected $security_policy = null; /** * Constructor. diff --git a/Compute/src/V1/InstancesSetServiceAccountRequest.php b/Compute/src/V1/InstancesSetServiceAccountRequest.php index 79ef66b5c640..eebe32ac0adc 100644 --- a/Compute/src/V1/InstancesSetServiceAccountRequest.php +++ b/Compute/src/V1/InstancesSetServiceAccountRequest.php @@ -19,7 +19,7 @@ class InstancesSetServiceAccountRequest extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field optional string email = 96619420; */ - private $email = null; + protected $email = null; /** * The list of scopes to be made available for this service account. * diff --git a/Compute/src/V1/InstantSnapshot.php b/Compute/src/V1/InstantSnapshot.php index 05d2e482e3a3..97f6d89a6024 100644 --- a/Compute/src/V1/InstantSnapshot.php +++ b/Compute/src/V1/InstantSnapshot.php @@ -21,43 +21,43 @@ class InstantSnapshot extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string architecture = 302803283; */ - private $architecture = null; + protected $architecture = null; /** * [Output Only] Creation timestamp in RFC3339 text format. * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * An optional description of this resource. Provide this property when you create the resource. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * [Output Only] Size of the source disk, specified in GB. * * Generated from protobuf field optional int64 disk_size_gb = 316263735; */ - private $disk_size_gb = null; + protected $disk_size_gb = null; /** * [Output Only] The unique identifier for the resource. This identifier is defined by the server. * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * [Output Only] Type of the resource. Always compute#instantSnapshot for InstantSnapshot resources. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * A fingerprint for the labels being applied to this InstantSnapshot, which is essentially a hash of the labels set used for optimistic locking. The fingerprint is initially generated by Compute Engine and changes after every request to modify or update labels. You must always provide an up-to-date fingerprint hash in order to update or change labels, otherwise the request will fail with error 412 conditionNotMet. To see the latest fingerprint, make a get() request to retrieve a InstantSnapshot. * * Generated from protobuf field optional string label_fingerprint = 178124825; */ - private $label_fingerprint = null; + protected $label_fingerprint = null; /** * Labels to apply to this InstantSnapshot. These can be later modified by the setLabels method. Label values may be empty. * @@ -69,68 +69,68 @@ class InstantSnapshot extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * [Output Only] URL of the region where the instant snapshot resides. You must specify this field as part of the HTTP request URL. It is not settable as a field in the request body. * * Generated from protobuf field optional string region = 138946292; */ - private $region = null; + protected $region = null; /** * [Output Only] Status information for the instant snapshot resource. * * Generated from protobuf field optional .google.cloud.compute.v1.InstantSnapshotResourceStatus resource_status = 249429315; */ - private $resource_status = null; + protected $resource_status = null; /** * Output only. Reserved for future use. * * Generated from protobuf field optional bool satisfies_pzi = 480964257; */ - private $satisfies_pzi = null; + protected $satisfies_pzi = null; /** * [Output Only] Reserved for future use. * * Generated from protobuf field optional bool satisfies_pzs = 480964267; */ - private $satisfies_pzs = null; + protected $satisfies_pzs = null; /** * [Output Only] Server-defined URL for the resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Server-defined URL for this resource's resource id. * * Generated from protobuf field optional string self_link_with_id = 44520962; */ - private $self_link_with_id = null; + protected $self_link_with_id = null; /** * URL of the source disk used to create this instant snapshot. Note that the source disk must be in the same zone/region as the instant snapshot to be created. This can be a full or valid partial URL. For example, the following are valid values: - https://www.googleapis.com/compute/v1/projects/project/zones/zone /disks/disk - https://www.googleapis.com/compute/v1/projects/project/regions/region /disks/disk - projects/project/zones/zone/disks/disk - projects/project/regions/region/disks/disk - zones/zone/disks/disk - regions/region/disks/disk * * Generated from protobuf field optional string source_disk = 451753793; */ - private $source_disk = null; + protected $source_disk = null; /** * [Output Only] The ID value of the disk used to create this InstantSnapshot. This value may be used to determine whether the InstantSnapshot was taken from the current or a previous instance of a given disk name. * * Generated from protobuf field optional string source_disk_id = 454190809; */ - private $source_disk_id = null; + protected $source_disk_id = null; /** * [Output Only] The status of the instantSnapshot. This can be CREATING, DELETING, FAILED, or READY. * Check the Status enum for the list of possible values. * * Generated from protobuf field optional string status = 181260274; */ - private $status = null; + protected $status = null; /** * [Output Only] URL of the zone where the instant snapshot resides. You must specify this field as part of the HTTP request URL. It is not settable as a field in the request body. * * Generated from protobuf field optional string zone = 3744684; */ - private $zone = null; + protected $zone = null; /** * Constructor. diff --git a/Compute/src/V1/InstantSnapshotAggregatedList.php b/Compute/src/V1/InstantSnapshotAggregatedList.php index fe2c2e64edd5..db61a03a105f 100644 --- a/Compute/src/V1/InstantSnapshotAggregatedList.php +++ b/Compute/src/V1/InstantSnapshotAggregatedList.php @@ -19,7 +19,7 @@ class InstantSnapshotAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of InstantSnapshotsScopedList resources. * @@ -31,19 +31,19 @@ class InstantSnapshotAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Unreachable resources. * @@ -55,7 +55,7 @@ class InstantSnapshotAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/InstantSnapshotList.php b/Compute/src/V1/InstantSnapshotList.php index 62a531d17f05..ad722c584591 100644 --- a/Compute/src/V1/InstantSnapshotList.php +++ b/Compute/src/V1/InstantSnapshotList.php @@ -20,7 +20,7 @@ class InstantSnapshotList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of InstantSnapshot resources. * @@ -32,25 +32,25 @@ class InstantSnapshotList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/InstantSnapshotResourceStatus.php b/Compute/src/V1/InstantSnapshotResourceStatus.php index 9b27b629274c..8b65d2602f27 100644 --- a/Compute/src/V1/InstantSnapshotResourceStatus.php +++ b/Compute/src/V1/InstantSnapshotResourceStatus.php @@ -19,7 +19,7 @@ class InstantSnapshotResourceStatus extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int64 storage_size_bytes = 387548913; */ - private $storage_size_bytes = null; + protected $storage_size_bytes = null; /** * Constructor. diff --git a/Compute/src/V1/InstantSnapshotsClient.php b/Compute/src/V1/InstantSnapshotsClient.php deleted file mode 100644 index b9acd0ca6921..000000000000 --- a/Compute/src/V1/InstantSnapshotsClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/Int64RangeMatch.php b/Compute/src/V1/Int64RangeMatch.php index 13f972d0e4f0..49448f2700c4 100644 --- a/Compute/src/V1/Int64RangeMatch.php +++ b/Compute/src/V1/Int64RangeMatch.php @@ -20,13 +20,13 @@ class Int64RangeMatch extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int64 range_end = 322439897; */ - private $range_end = null; + protected $range_end = null; /** * The start of the range (inclusive) in signed long integer format. * * Generated from protobuf field optional int64 range_start = 103333600; */ - private $range_start = null; + protected $range_start = null; /** * Constructor. diff --git a/Compute/src/V1/Interconnect.php b/Compute/src/V1/Interconnect.php index ea761e555b29..1bdd3ba71edd 100644 --- a/Compute/src/V1/Interconnect.php +++ b/Compute/src/V1/Interconnect.php @@ -20,19 +20,19 @@ class Interconnect extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional bool aai_enabled = 388780363; */ - private $aai_enabled = null; + protected $aai_enabled = null; /** * Administrative status of the interconnect. When this is set to true, the Interconnect is functional and can carry traffic. When set to false, no packets can be carried over the interconnect and no BGP routes are exchanged over it. By default, the status is set to true. * * Generated from protobuf field optional bool admin_enabled = 445675089; */ - private $admin_enabled = null; + protected $admin_enabled = null; /** * Configuration information for application awareness on this Cloud Interconnect. * * Generated from protobuf field optional .google.cloud.compute.v1.InterconnectApplicationAwareInterconnect application_aware_interconnect = 429095966; */ - private $application_aware_interconnect = null; + protected $application_aware_interconnect = null; /** * [Output only] List of features available for this Interconnect connection, which can take one of the following values: - IF_MACSEC If present then the Interconnect connection is provisioned on MACsec capable hardware ports. If not present then the Interconnect connection is provisioned on non-MACsec capable ports and MACsec isn't supported and enabling MACsec fails. * Check the AvailableFeatures enum for the list of possible values. @@ -51,19 +51,19 @@ class Interconnect extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * Customer name, to put in the Letter of Authorization as the party authorized to request a crossconnect. * * Generated from protobuf field optional string customer_name = 3665484; */ - private $customer_name = null; + protected $customer_name = null; /** * An optional description of this resource. Provide this property when you create the resource. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * [Output Only] A list of outages expected for this Interconnect. * @@ -75,19 +75,19 @@ class Interconnect extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string google_ip_address = 443105954; */ - private $google_ip_address = null; + protected $google_ip_address = null; /** * [Output Only] Google reference ID to be used when raising support tickets with Google or otherwise to debug backend connectivity issues. * * Generated from protobuf field optional string google_reference_id = 534944469; */ - private $google_reference_id = null; + protected $google_reference_id = null; /** * [Output Only] The unique identifier for the resource. This identifier is defined by the server. * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * [Output Only] A list of the URLs of all InterconnectAttachments configured to use this Interconnect. * @@ -106,19 +106,19 @@ class Interconnect extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string interconnect_type = 515165259; */ - private $interconnect_type = null; + protected $interconnect_type = null; /** * [Output Only] Type of the resource. Always compute#interconnect for interconnects. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * A fingerprint for the labels being applied to this Interconnect, which is essentially a hash of the labels set used for optimistic locking. The fingerprint is initially generated by Compute Engine and changes after every request to modify or update labels. You must always provide an up-to-date fingerprint hash in order to update or change labels, otherwise the request will fail with error 412 conditionNotMet. To see the latest fingerprint, make a get() request to retrieve an Interconnect. * * Generated from protobuf field optional string label_fingerprint = 178124825; */ - private $label_fingerprint = null; + protected $label_fingerprint = null; /** * Labels for this resource. These can only be added or modified by the setLabels method. Each label key/value pair must comply with RFC1035. Label values may be empty. * @@ -131,62 +131,62 @@ class Interconnect extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string link_type = 523207775; */ - private $link_type = null; + protected $link_type = null; /** * URL of the InterconnectLocation object that represents where this connection is to be provisioned. * * Generated from protobuf field optional string location = 290430901; */ - private $location = null; + protected $location = null; /** * Configuration that enables Media Access Control security (MACsec) on the Cloud Interconnect connection between Google and your on-premises router. * * Generated from protobuf field optional .google.cloud.compute.v1.InterconnectMacsec macsec = 528867490; */ - private $macsec = null; + protected $macsec = null; /** * Enable or disable MACsec on this Interconnect connection. MACsec enablement fails if the MACsec object is not specified. * * Generated from protobuf field optional bool macsec_enabled = 194203812; */ - private $macsec_enabled = null; + protected $macsec_enabled = null; /** * Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * Email address to contact the customer NOC for operations and maintenance notifications regarding this Interconnect. If specified, this will be used for notifications in addition to all other forms described, such as Cloud Monitoring logs alerting and Cloud Notifications. This field is required for users who sign up for Cloud Interconnect using workforce identity federation. * * Generated from protobuf field optional string noc_contact_email = 14072832; */ - private $noc_contact_email = null; + protected $noc_contact_email = null; /** * [Output Only] The current status of this Interconnect's functionality, which can take one of the following values: - OS_ACTIVE: A valid Interconnect, which is turned up and is ready to use. Attachments may be provisioned on this Interconnect. - OS_UNPROVISIONED: An Interconnect that has not completed turnup. No attachments may be provisioned on this Interconnect. - OS_UNDER_MAINTENANCE: An Interconnect that is undergoing internal maintenance. No attachments may be provisioned or updated on this Interconnect. * Check the OperationalStatus enum for the list of possible values. * * Generated from protobuf field optional string operational_status = 201070847; */ - private $operational_status = null; + protected $operational_status = null; /** * [Output Only] IP address configured on the customer side of the Interconnect link. The customer should configure this IP address during turnup when prompted by Google NOC. This can be used only for ping tests. * * Generated from protobuf field optional string peer_ip_address = 207735769; */ - private $peer_ip_address = null; + protected $peer_ip_address = null; /** * [Output Only] Number of links actually provisioned in this interconnect. * * Generated from protobuf field optional int32 provisioned_link_count = 410888565; */ - private $provisioned_link_count = null; + protected $provisioned_link_count = null; /** * Indicates that this is a Cross-Cloud Interconnect. This field specifies the location outside of Google's network that the interconnect is connected to. * * Generated from protobuf field optional string remote_location = 324388750; */ - private $remote_location = null; + protected $remote_location = null; /** * Optional. List of features requested for this Interconnect connection, which can take one of the following values: - IF_MACSEC If specified then the connection is created on MACsec capable hardware ports. If not specified, the default value is false, which allocates non-MACsec capable ports first if available. This parameter can be provided only with Interconnect INSERT. It isn't valid for Interconnect PATCH. * Check the RequestedFeatures enum for the list of possible values. @@ -199,26 +199,26 @@ class Interconnect extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int32 requested_link_count = 45051387; */ - private $requested_link_count = null; + protected $requested_link_count = null; /** * [Output Only] Reserved for future use. * * Generated from protobuf field optional bool satisfies_pzs = 480964267; */ - private $satisfies_pzs = null; + protected $satisfies_pzs = null; /** * [Output Only] Server-defined URL for the resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] The current state of Interconnect functionality, which can take one of the following values: - ACTIVE: The Interconnect is valid, turned up and ready to use. Attachments may be provisioned on this Interconnect. - UNPROVISIONED: The Interconnect has not completed turnup. No attachments may be provisioned on this Interconnect. - UNDER_MAINTENANCE: The Interconnect is undergoing internal maintenance. No attachments may be provisioned or updated on this Interconnect. * Check the State enum for the list of possible values. * * Generated from protobuf field optional string state = 109757585; */ - private $state = null; + protected $state = null; /** * Constructor. diff --git a/Compute/src/V1/InterconnectApplicationAwareInterconnect.php b/Compute/src/V1/InterconnectApplicationAwareInterconnect.php index 474ba186dab0..81b7b52662c2 100644 --- a/Compute/src/V1/InterconnectApplicationAwareInterconnect.php +++ b/Compute/src/V1/InterconnectApplicationAwareInterconnect.php @@ -18,13 +18,13 @@ class InterconnectApplicationAwareInterconnect extends \Google\Protobuf\Internal /** * Generated from protobuf field optional .google.cloud.compute.v1.InterconnectApplicationAwareInterconnectBandwidthPercentagePolicy bandwidth_percentage_policy = 187018857; */ - private $bandwidth_percentage_policy = null; + protected $bandwidth_percentage_policy = null; /** * Description for the application awareness profile on this Cloud Interconnect. * * Generated from protobuf field optional string profile_description = 262813286; */ - private $profile_description = null; + protected $profile_description = null; /** * Optional field to specify a list of shape average percentages to be applied in conjunction with StrictPriorityPolicy or BandwidthPercentagePolicy. * @@ -34,7 +34,7 @@ class InterconnectApplicationAwareInterconnect extends \Google\Protobuf\Internal /** * Generated from protobuf field optional .google.cloud.compute.v1.InterconnectApplicationAwareInterconnectStrictPriorityPolicy strict_priority_policy = 145083063; */ - private $strict_priority_policy = null; + protected $strict_priority_policy = null; /** * Constructor. diff --git a/Compute/src/V1/InterconnectApplicationAwareInterconnectBandwidthPercentage.php b/Compute/src/V1/InterconnectApplicationAwareInterconnectBandwidthPercentage.php index f4e165e49fe8..0f4964a41735 100644 --- a/Compute/src/V1/InterconnectApplicationAwareInterconnectBandwidthPercentage.php +++ b/Compute/src/V1/InterconnectApplicationAwareInterconnectBandwidthPercentage.php @@ -20,14 +20,14 @@ class InterconnectApplicationAwareInterconnectBandwidthPercentage extends \Googl * * Generated from protobuf field optional uint32 percentage = 151909018; */ - private $percentage = null; + protected $percentage = null; /** * TrafficClass whose bandwidth percentage is being specified. * Check the TrafficClass enum for the list of possible values. * * Generated from protobuf field optional string traffic_class = 198180022; */ - private $traffic_class = null; + protected $traffic_class = null; /** * Constructor. diff --git a/Compute/src/V1/InterconnectAttachment.php b/Compute/src/V1/InterconnectAttachment.php index 71b17eefe19d..285759159fcc 100644 --- a/Compute/src/V1/InterconnectAttachment.php +++ b/Compute/src/V1/InterconnectAttachment.php @@ -20,20 +20,20 @@ class InterconnectAttachment extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional bool admin_enabled = 445675089; */ - private $admin_enabled = null; + protected $admin_enabled = null; /** * [Output Only] URL of the AttachmentGroup that includes this Attachment. * * Generated from protobuf field optional string attachment_group = 63442019; */ - private $attachment_group = null; + protected $attachment_group = null; /** * Provisioned bandwidth capacity for the interconnect attachment. For attachments of type DEDICATED, the user can set the bandwidth. For attachments of type PARTNER, the Google Partner that is operating the interconnect must set the bandwidth. Output only for PARTNER type, mutable for PARTNER_PROVIDER and DEDICATED, and can take one of the following values: - BPS_50M: 50 Mbit/s - BPS_100M: 100 Mbit/s - BPS_200M: 200 Mbit/s - BPS_300M: 300 Mbit/s - BPS_400M: 400 Mbit/s - BPS_500M: 500 Mbit/s - BPS_1G: 1 Gbit/s - BPS_2G: 2 Gbit/s - BPS_5G: 5 Gbit/s - BPS_10G: 10 Gbit/s - BPS_20G: 20 Gbit/s - BPS_50G: 50 Gbit/s - BPS_100G: 100 Gbit/s * Check the Bandwidth enum for the list of possible values. * * Generated from protobuf field optional string bandwidth = 181715121; */ - private $bandwidth = null; + protected $bandwidth = null; /** * This field is not available. * @@ -51,93 +51,93 @@ class InterconnectAttachment extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string cloud_router_ip_address = 287392776; */ - private $cloud_router_ip_address = null; + protected $cloud_router_ip_address = null; /** * [Output Only] IPv6 address + prefix length to be configured on Cloud Router Interface for this interconnect attachment. * * Generated from protobuf field optional string cloud_router_ipv6_address = 451922376; */ - private $cloud_router_ipv6_address = null; + protected $cloud_router_ipv6_address = null; /** * This field is not available. * * Generated from protobuf field optional string cloud_router_ipv6_interface_id = 521282701; */ - private $cloud_router_ipv6_interface_id = null; + protected $cloud_router_ipv6_interface_id = null; /** * [Output Only] Constraints for this attachment, if any. The attachment does not work if these constraints are not met. * * Generated from protobuf field optional .google.cloud.compute.v1.InterconnectAttachmentConfigurationConstraints configuration_constraints = 179681389; */ - private $configuration_constraints = null; + protected $configuration_constraints = null; /** * [Output Only] Creation timestamp in RFC3339 text format. * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * [Output Only] IPv4 address + prefix length to be configured on the customer router subinterface for this interconnect attachment. * * Generated from protobuf field optional string customer_router_ip_address = 332475761; */ - private $customer_router_ip_address = null; + protected $customer_router_ip_address = null; /** * [Output Only] IPv6 address + prefix length to be configured on the customer router subinterface for this interconnect attachment. * * Generated from protobuf field optional string customer_router_ipv6_address = 290127089; */ - private $customer_router_ipv6_address = null; + protected $customer_router_ipv6_address = null; /** * This field is not available. * * Generated from protobuf field optional string customer_router_ipv6_interface_id = 380994308; */ - private $customer_router_ipv6_interface_id = null; + protected $customer_router_ipv6_interface_id = null; /** * [Output Only] Dataplane version for this InterconnectAttachment. This field is only present for Dataplane version 2 and higher. Absence of this field in the API output indicates that the Dataplane is version 1. * * Generated from protobuf field optional int32 dataplane_version = 34920075; */ - private $dataplane_version = null; + protected $dataplane_version = null; /** * An optional description of this resource. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * Input only. Desired availability domain for the attachment. Only available for type PARTNER, at creation time, and can take one of the following values: - AVAILABILITY_DOMAIN_ANY - AVAILABILITY_DOMAIN_1 - AVAILABILITY_DOMAIN_2 For improved reliability, customers should configure a pair of attachments, one per availability domain. The selected availability domain will be provided to the Partner via the pairing key, so that the provisioned circuit will lie in the specified domain. If not specified, the value will default to AVAILABILITY_DOMAIN_ANY. * Check the EdgeAvailabilityDomain enum for the list of possible values. * * Generated from protobuf field optional string edge_availability_domain = 71289510; */ - private $edge_availability_domain = null; + protected $edge_availability_domain = null; /** * Indicates the user-supplied encryption option of this VLAN attachment (interconnectAttachment). Can only be specified at attachment creation for PARTNER or DEDICATED attachments. Possible values are: - NONE - This is the default value, which means that the VLAN attachment carries unencrypted traffic. VMs are able to send traffic to, or receive traffic from, such a VLAN attachment. - IPSEC - The VLAN attachment carries only encrypted traffic that is encrypted by an IPsec device, such as an HA VPN gateway or third-party IPsec VPN. VMs cannot directly send traffic to, or receive traffic from, such a VLAN attachment. To use *HA VPN over Cloud Interconnect*, the VLAN attachment must be created with this option. * Check the Encryption enum for the list of possible values. * * Generated from protobuf field optional string encryption = 97980291; */ - private $encryption = null; + protected $encryption = null; /** * [Output Only] Google reference ID, to be used when raising support tickets with Google or otherwise to debug backend connectivity issues. [Deprecated] This field is not used. * * Generated from protobuf field optional string google_reference_id = 534944469; */ - private $google_reference_id = null; + protected $google_reference_id = null; /** * [Output Only] The unique identifier for the resource. This identifier is defined by the server. * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * URL of the underlying Interconnect object that this attachment's traffic will traverse through. * * Generated from protobuf field optional string interconnect = 224601230; */ - private $interconnect = null; + protected $interconnect = null; /** * A list of URLs of addresses that have been reserved for the VLAN attachment. Used only for the VLAN attachment that has the encryption option as IPSEC. The addresses must be regional internal IP address ranges. When creating an HA VPN gateway over the VLAN attachment, if the attachment is configured to use a regional internal IP address, then the VPN gateway's IP address is allocated from the IP address range specified here. For example, if the HA VPN gateway's interface 0 is paired to this VLAN attachment, then a regional internal IP address for the VPN gateway interface 0 will be allocated from the IP address specified for this VLAN attachment. If this field is not specified when creating the VLAN attachment, then later on when creating an HA VPN gateway on this VLAN attachment, the HA VPN gateway's IP address is allocated from the regional external IP address pool. * @@ -149,13 +149,13 @@ class InterconnectAttachment extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * A fingerprint for the labels being applied to this InterconnectAttachment, which is essentially a hash of the labels set used for optimistic locking. The fingerprint is initially generated by Compute Engine and changes after every request to modify or update labels. You must always provide an up-to-date fingerprint hash in order to update or change labels, otherwise the request will fail with error 412 conditionNotMet. To see the latest fingerprint, make a get() request to retrieve an InterconnectAttachment. * * Generated from protobuf field optional string label_fingerprint = 178124825; */ - private $label_fingerprint = null; + protected $label_fingerprint = null; /** * Labels for this resource. These can only be added or modified by the setLabels method. Each label key/value pair must comply with RFC1035. Label values may be empty. * @@ -167,107 +167,107 @@ class InterconnectAttachment extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int32 mtu = 108462; */ - private $mtu = null; + protected $mtu = null; /** * Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * [Output Only] The current status of whether or not this interconnect attachment is functional, which can take one of the following values: - OS_ACTIVE: The attachment has been turned up and is ready to use. - OS_UNPROVISIONED: The attachment is not ready to use yet, because turnup is not complete. * Check the OperationalStatus enum for the list of possible values. * * Generated from protobuf field optional string operational_status = 201070847; */ - private $operational_status = null; + protected $operational_status = null; /** * [Output only for type PARTNER. Input only for PARTNER_PROVIDER. Not present for DEDICATED]. The opaque identifier of a PARTNER attachment used to initiate provisioning with a selected partner. Of the form "XXXXX/region/domain" * * Generated from protobuf field optional string pairing_key = 439695464; */ - private $pairing_key = null; + protected $pairing_key = null; /** * Optional BGP ASN for the router supplied by a Layer 3 Partner if they configured BGP on behalf of the customer. Output only for PARTNER type, input only for PARTNER_PROVIDER, not available for DEDICATED. * * Generated from protobuf field optional int64 partner_asn = 438166149; */ - private $partner_asn = null; + protected $partner_asn = null; /** * Informational metadata about Partner attachments from Partners to display to customers. Output only for PARTNER type, mutable for PARTNER_PROVIDER, not available for DEDICATED. * * Generated from protobuf field optional .google.cloud.compute.v1.InterconnectAttachmentPartnerMetadata partner_metadata = 65908934; */ - private $partner_metadata = null; + protected $partner_metadata = null; /** * [Output Only] Information specific to an InterconnectAttachment. This property is populated if the interconnect that this is attached to is of type DEDICATED. * * Generated from protobuf field optional .google.cloud.compute.v1.InterconnectAttachmentPrivateInfo private_interconnect_info = 237270531; */ - private $private_interconnect_info = null; + protected $private_interconnect_info = null; /** * [Output Only] URL of the region where the regional interconnect attachment resides. You must specify this field as part of the HTTP request URL. It is not settable as a field in the request body. * * Generated from protobuf field optional string region = 138946292; */ - private $region = null; + protected $region = null; /** * [Output Only] If the attachment is on a Cross-Cloud Interconnect connection, this field contains the interconnect's remote location service provider. Example values: "Amazon Web Services" "Microsoft Azure". The field is set only for attachments on Cross-Cloud Interconnect connections. Its value is copied from the InterconnectRemoteLocation remoteService field. * * Generated from protobuf field optional string remote_service = 391954364; */ - private $remote_service = null; + protected $remote_service = null; /** * URL of the Cloud Router to be used for dynamic routing. This router must be in the same region as this InterconnectAttachment. The InterconnectAttachment will automatically connect the Interconnect to the network & region within which the Cloud Router is configured. * * Generated from protobuf field optional string router = 148608841; */ - private $router = null; + protected $router = null; /** * [Output Only] Reserved for future use. * * Generated from protobuf field optional bool satisfies_pzs = 480964267; */ - private $satisfies_pzs = null; + protected $satisfies_pzs = null; /** * [Output Only] Server-defined URL for the resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * The stack type for this interconnect attachment to identify whether the IPv6 feature is enabled or not. If not specified, IPV4_ONLY will be used. This field can be both set at interconnect attachments creation and update interconnect attachment operations. * Check the StackType enum for the list of possible values. * * Generated from protobuf field optional string stack_type = 425908881; */ - private $stack_type = null; + protected $stack_type = null; /** * [Output Only] The current state of this attachment's functionality. Enum values ACTIVE and UNPROVISIONED are shared by DEDICATED/PRIVATE, PARTNER, and PARTNER_PROVIDER interconnect attachments, while enum values PENDING_PARTNER, PARTNER_REQUEST_RECEIVED, and PENDING_CUSTOMER are used for only PARTNER and PARTNER_PROVIDER interconnect attachments. This state can take one of the following values: - ACTIVE: The attachment has been turned up and is ready to use. - UNPROVISIONED: The attachment is not ready to use yet, because turnup is not complete. - PENDING_PARTNER: A newly-created PARTNER attachment that has not yet been configured on the Partner side. - PARTNER_REQUEST_RECEIVED: A PARTNER attachment is in the process of provisioning after a PARTNER_PROVIDER attachment was created that references it. - PENDING_CUSTOMER: A PARTNER or PARTNER_PROVIDER attachment that is waiting for a customer to activate it. - DEFUNCT: The attachment was deleted externally and is no longer functional. This could be because the associated Interconnect was removed, or because the other side of a Partner attachment was deleted. * Check the State enum for the list of possible values. * * Generated from protobuf field optional string state = 109757585; */ - private $state = null; + protected $state = null; /** * Input only. Length of the IPv4 subnet mask. Allowed values: - 29 (default) - 30 The default value is 29, except for Cross-Cloud Interconnect connections that use an InterconnectRemoteLocation with a constraints.subnetLengthRange.min equal to 30. For example, connections that use an Azure remote location fall into this category. In these cases, the default value is 30, and requesting 29 returns an error. Where both 29 and 30 are allowed, 29 is preferred, because it gives Google Cloud Support more debugging visibility. * * Generated from protobuf field optional int32 subnet_length = 279831048; */ - private $subnet_length = null; + protected $subnet_length = null; /** * The type of interconnect attachment this is, which can take one of the following values: - DEDICATED: an attachment to a Dedicated Interconnect. - PARTNER: an attachment to a Partner Interconnect, created by the customer. - PARTNER_PROVIDER: an attachment to a Partner Interconnect, created by the partner. * Check the Type enum for the list of possible values. * * Generated from protobuf field optional string type = 3575610; */ - private $type = null; + protected $type = null; /** * The IEEE 802.1Q VLAN tag for this attachment, in the range 2-4093. Only specified at creation time. * * Generated from protobuf field optional int32 vlan_tag8021q = 119927836; */ - private $vlan_tag8021q = null; + protected $vlan_tag8021q = null; /** * Constructor. diff --git a/Compute/src/V1/InterconnectAttachmentAggregatedList.php b/Compute/src/V1/InterconnectAttachmentAggregatedList.php index 4a4df297133c..83f05c11b261 100644 --- a/Compute/src/V1/InterconnectAttachmentAggregatedList.php +++ b/Compute/src/V1/InterconnectAttachmentAggregatedList.php @@ -19,7 +19,7 @@ class InterconnectAttachmentAggregatedList extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of InterconnectAttachmentsScopedList resources. * @@ -31,19 +31,19 @@ class InterconnectAttachmentAggregatedList extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Unreachable resources. * @@ -55,7 +55,7 @@ class InterconnectAttachmentAggregatedList extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/InterconnectAttachmentConfigurationConstraints.php b/Compute/src/V1/InterconnectAttachmentConfigurationConstraints.php index 7b17f1f5342c..86ec168818c2 100644 --- a/Compute/src/V1/InterconnectAttachmentConfigurationConstraints.php +++ b/Compute/src/V1/InterconnectAttachmentConfigurationConstraints.php @@ -20,7 +20,7 @@ class InterconnectAttachmentConfigurationConstraints extends \Google\Protobuf\In * * Generated from protobuf field optional string bgp_md5 = 373093386; */ - private $bgp_md5 = null; + protected $bgp_md5 = null; /** * [Output Only] List of ASN ranges that the remote location is known to support. Formatted as an array of inclusive ranges {min: min-value, max: max-value}. For example, [{min: 123, max: 123}, {min: 64512, max: 65534}] allows the peer ASN to be 123 or anything in the range 64512-65534. This field is only advisory. Although the API accepts other ranges, these are the ranges that we recommend. * diff --git a/Compute/src/V1/InterconnectAttachmentConfigurationConstraintsBgpPeerASNRange.php b/Compute/src/V1/InterconnectAttachmentConfigurationConstraintsBgpPeerASNRange.php index 4849b873da6d..302380d501e1 100644 --- a/Compute/src/V1/InterconnectAttachmentConfigurationConstraintsBgpPeerASNRange.php +++ b/Compute/src/V1/InterconnectAttachmentConfigurationConstraintsBgpPeerASNRange.php @@ -17,11 +17,11 @@ class InterconnectAttachmentConfigurationConstraintsBgpPeerASNRange extends \Goo /** * Generated from protobuf field optional uint32 max = 107876; */ - private $max = null; + protected $max = null; /** * Generated from protobuf field optional uint32 min = 108114; */ - private $min = null; + protected $min = null; /** * Constructor. diff --git a/Compute/src/V1/InterconnectAttachmentGroup.php b/Compute/src/V1/InterconnectAttachmentGroup.php index ca536b99ec34..644ae735ffaf 100644 --- a/Compute/src/V1/InterconnectAttachmentGroup.php +++ b/Compute/src/V1/InterconnectAttachmentGroup.php @@ -24,63 +24,63 @@ class InterconnectAttachmentGroup extends \Google\Protobuf\Internal\Message /** * Generated from protobuf field optional .google.cloud.compute.v1.InterconnectAttachmentGroupConfigured configured = 295631422; */ - private $configured = null; + protected $configured = null; /** * [Output Only] Creation timestamp in RFC3339 text format. * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * An optional description of this resource. Provide this property when you create the resource. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * Opaque system-generated token that uniquely identifies the configuration. If provided when patching a configuration in update mode, the provided token must match the current token or the update is rejected. This provides a reliable means of doing read-modify-write (optimistic locking) as described by AIP 154. * * Generated from protobuf field optional string etag = 3123477; */ - private $etag = null; + protected $etag = null; /** * [Output Only] The unique identifier for the resource type. The server generates this identifier. * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * Generated from protobuf field optional .google.cloud.compute.v1.InterconnectAttachmentGroupIntent intent = 426849948; */ - private $intent = null; + protected $intent = null; /** * The URL of an InterconnectGroup that groups these Attachments' Interconnects. Customers do not need to set this unless directed by Google Support. * * Generated from protobuf field optional string interconnect_group = 388651918; */ - private $interconnect_group = null; + protected $interconnect_group = null; /** * [Output Only] Type of the resource. Always compute#interconnectAttachmentGroup. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * Generated from protobuf field optional .google.cloud.compute.v1.InterconnectAttachmentGroupLogicalStructure logical_structure = 142412989; */ - private $logical_structure = null; + protected $logical_structure = null; /** * Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * [Output Only] Server-defined URL for the resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * Constructor. diff --git a/Compute/src/V1/InterconnectAttachmentGroupAttachment.php b/Compute/src/V1/InterconnectAttachmentGroupAttachment.php index 992814d2ace8..5431e2168daf 100644 --- a/Compute/src/V1/InterconnectAttachmentGroupAttachment.php +++ b/Compute/src/V1/InterconnectAttachmentGroupAttachment.php @@ -18,7 +18,7 @@ class InterconnectAttachmentGroupAttachment extends \Google\Protobuf\Internal\Me /** * Generated from protobuf field optional string attachment = 183982371; */ - private $attachment = null; + protected $attachment = null; /** * Constructor. diff --git a/Compute/src/V1/InterconnectAttachmentGroupConfigured.php b/Compute/src/V1/InterconnectAttachmentGroupConfigured.php index 97af8f6412f6..bfe4eb1e06f8 100644 --- a/Compute/src/V1/InterconnectAttachmentGroupConfigured.php +++ b/Compute/src/V1/InterconnectAttachmentGroupConfigured.php @@ -18,7 +18,7 @@ class InterconnectAttachmentGroupConfigured extends \Google\Protobuf\Internal\Me /** * Generated from protobuf field optional .google.cloud.compute.v1.InterconnectAttachmentGroupConfiguredAvailabilitySLA availability_sla = 472702020; */ - private $availability_sla = null; + protected $availability_sla = null; /** * Constructor. diff --git a/Compute/src/V1/InterconnectAttachmentGroupConfiguredAvailabilitySLA.php b/Compute/src/V1/InterconnectAttachmentGroupConfiguredAvailabilitySLA.php index d3e37caeb125..0762fb8dbac8 100644 --- a/Compute/src/V1/InterconnectAttachmentGroupConfiguredAvailabilitySLA.php +++ b/Compute/src/V1/InterconnectAttachmentGroupConfiguredAvailabilitySLA.php @@ -21,7 +21,7 @@ class InterconnectAttachmentGroupConfiguredAvailabilitySLA extends \Google\Proto * * Generated from protobuf field optional string effective_sla = 144173712; */ - private $effective_sla = null; + protected $effective_sla = null; /** * Generated from protobuf field repeated .google.cloud.compute.v1.InterconnectAttachmentGroupConfiguredAvailabilitySLAIntendedSlaBlockers intended_sla_blockers = 448370308; */ diff --git a/Compute/src/V1/InterconnectAttachmentGroupConfiguredAvailabilitySLAIntendedSlaBlockers.php b/Compute/src/V1/InterconnectAttachmentGroupConfiguredAvailabilitySLAIntendedSlaBlockers.php index c8d9795a8183..f30d06bd2900 100644 --- a/Compute/src/V1/InterconnectAttachmentGroupConfiguredAvailabilitySLAIntendedSlaBlockers.php +++ b/Compute/src/V1/InterconnectAttachmentGroupConfiguredAvailabilitySLAIntendedSlaBlockers.php @@ -27,19 +27,19 @@ class InterconnectAttachmentGroupConfiguredAvailabilitySLAIntendedSlaBlockers ex * * Generated from protobuf field optional string blocker_type = 381194847; */ - private $blocker_type = null; + protected $blocker_type = null; /** * [Output Only] The url of Google Cloud public documentation explaining this requirement. This is set for every type of requirement. * * Generated from protobuf field optional string documentation_link = 93465183; */ - private $documentation_link = null; + protected $documentation_link = null; /** * [Output Only] A human-readable explanation of this requirement and why it's not met. This is set for every type of requirement. * * Generated from protobuf field optional string explanation = 504745497; */ - private $explanation = null; + protected $explanation = null; /** * [Output Only] Metros used to explain this blocker in more detail. These are three-letter lowercase strings like "iad". This will be set for some blockers (like NO_ATTACHMENTS_IN_METRO_AND_ZONE) but does not apply to others. * diff --git a/Compute/src/V1/InterconnectAttachmentGroupIntent.php b/Compute/src/V1/InterconnectAttachmentGroupIntent.php index 9058ba6b4c09..5c1e9a1f9dc1 100644 --- a/Compute/src/V1/InterconnectAttachmentGroupIntent.php +++ b/Compute/src/V1/InterconnectAttachmentGroupIntent.php @@ -21,7 +21,7 @@ class InterconnectAttachmentGroupIntent extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field optional string availability_sla = 472702020; */ - private $availability_sla = null; + protected $availability_sla = null; /** * Constructor. diff --git a/Compute/src/V1/InterconnectAttachmentGroupLogicalStructureRegion.php b/Compute/src/V1/InterconnectAttachmentGroupLogicalStructureRegion.php index 8adffb38ce14..07a155a4ccd9 100644 --- a/Compute/src/V1/InterconnectAttachmentGroupLogicalStructureRegion.php +++ b/Compute/src/V1/InterconnectAttachmentGroupLogicalStructureRegion.php @@ -24,7 +24,7 @@ class InterconnectAttachmentGroupLogicalStructureRegion extends \Google\Protobuf * * Generated from protobuf field optional string region = 138946292; */ - private $region = null; + protected $region = null; /** * Constructor. diff --git a/Compute/src/V1/InterconnectAttachmentGroupLogicalStructureRegionMetro.php b/Compute/src/V1/InterconnectAttachmentGroupLogicalStructureRegionMetro.php index aa3208311345..4ecf38182f61 100644 --- a/Compute/src/V1/InterconnectAttachmentGroupLogicalStructureRegionMetro.php +++ b/Compute/src/V1/InterconnectAttachmentGroupLogicalStructureRegionMetro.php @@ -24,7 +24,7 @@ class InterconnectAttachmentGroupLogicalStructureRegionMetro extends \Google\Pro * * Generated from protobuf field optional string metro = 103787801; */ - private $metro = null; + protected $metro = null; /** * Constructor. diff --git a/Compute/src/V1/InterconnectAttachmentGroupLogicalStructureRegionMetroFacility.php b/Compute/src/V1/InterconnectAttachmentGroupLogicalStructureRegionMetroFacility.php index b3e35ba3fc73..a2669d6507a9 100644 --- a/Compute/src/V1/InterconnectAttachmentGroupLogicalStructureRegionMetroFacility.php +++ b/Compute/src/V1/InterconnectAttachmentGroupLogicalStructureRegionMetroFacility.php @@ -20,7 +20,7 @@ class InterconnectAttachmentGroupLogicalStructureRegionMetroFacility extends \Go * * Generated from protobuf field optional string facility = 501116579; */ - private $facility = null; + protected $facility = null; /** * Generated from protobuf field repeated .google.cloud.compute.v1.InterconnectAttachmentGroupLogicalStructureRegionMetroFacilityZone zones = 116085319; */ diff --git a/Compute/src/V1/InterconnectAttachmentGroupLogicalStructureRegionMetroFacilityZone.php b/Compute/src/V1/InterconnectAttachmentGroupLogicalStructureRegionMetroFacilityZone.php index cb3a5f592f83..8474c5aef37b 100644 --- a/Compute/src/V1/InterconnectAttachmentGroupLogicalStructureRegionMetroFacilityZone.php +++ b/Compute/src/V1/InterconnectAttachmentGroupLogicalStructureRegionMetroFacilityZone.php @@ -26,7 +26,7 @@ class InterconnectAttachmentGroupLogicalStructureRegionMetroFacilityZone extends * * Generated from protobuf field optional string zone = 3744684; */ - private $zone = null; + protected $zone = null; /** * Constructor. diff --git a/Compute/src/V1/InterconnectAttachmentGroupsClient.php b/Compute/src/V1/InterconnectAttachmentGroupsClient.php deleted file mode 100644 index 491cf068d12e..000000000000 --- a/Compute/src/V1/InterconnectAttachmentGroupsClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional string etag = 3123477; */ - private $etag = null; + protected $etag = null; /** * Generated from protobuf field optional .google.cloud.compute.v1.InterconnectAttachmentGroupsOperationalStatus result = 139315229; */ - private $result = null; + protected $result = null; /** * Constructor. diff --git a/Compute/src/V1/InterconnectAttachmentGroupsListResponse.php b/Compute/src/V1/InterconnectAttachmentGroupsListResponse.php index 5c57a8c5361f..feb7faf9449c 100644 --- a/Compute/src/V1/InterconnectAttachmentGroupsListResponse.php +++ b/Compute/src/V1/InterconnectAttachmentGroupsListResponse.php @@ -17,13 +17,13 @@ class InterconnectAttachmentGroupsListResponse extends \Google\Protobuf\Internal /** * Generated from protobuf field optional string etag = 3123477; */ - private $etag = null; + protected $etag = null; /** * [Output Only] Unique identifier for the resource; defined by the server. * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of InterconnectAttachmentGroup resources. * @@ -33,19 +33,19 @@ class InterconnectAttachmentGroupsListResponse extends \Google\Protobuf\Internal /** * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Unreachable resources. end_interface: MixerListResponseWithEtagBuilder * @@ -57,7 +57,7 @@ class InterconnectAttachmentGroupsListResponse extends \Google\Protobuf\Internal * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/InterconnectAttachmentGroupsOperationalStatus.php b/Compute/src/V1/InterconnectAttachmentGroupsOperationalStatus.php index 1da681fd0fac..879f6cd7a435 100644 --- a/Compute/src/V1/InterconnectAttachmentGroupsOperationalStatus.php +++ b/Compute/src/V1/InterconnectAttachmentGroupsOperationalStatus.php @@ -21,24 +21,24 @@ class InterconnectAttachmentGroupsOperationalStatus extends \Google\Protobuf\Int /** * Generated from protobuf field optional .google.cloud.compute.v1.InterconnectAttachmentGroupConfigured configured = 295631422; */ - private $configured = null; + protected $configured = null; /** * Summarizes the status of the group. * Check the GroupStatus enum for the list of possible values. * * Generated from protobuf field optional string group_status = 338778546; */ - private $group_status = null; + protected $group_status = null; /** * Generated from protobuf field optional .google.cloud.compute.v1.InterconnectAttachmentGroupIntent intent = 426849948; */ - private $intent = null; + protected $intent = null; /** * The operational state of the group, including only active Attachments. * * Generated from protobuf field optional .google.cloud.compute.v1.InterconnectAttachmentGroupConfigured operational = 129704914; */ - private $operational = null; + protected $operational = null; /** * Constructor. diff --git a/Compute/src/V1/InterconnectAttachmentGroupsOperationalStatusAttachmentStatus.php b/Compute/src/V1/InterconnectAttachmentGroupsOperationalStatusAttachmentStatus.php index 2098f66b3260..61139a58c9b6 100644 --- a/Compute/src/V1/InterconnectAttachmentGroupsOperationalStatusAttachmentStatus.php +++ b/Compute/src/V1/InterconnectAttachmentGroupsOperationalStatusAttachmentStatus.php @@ -20,27 +20,27 @@ class InterconnectAttachmentGroupsOperationalStatusAttachmentStatus extends \Goo * * Generated from protobuf field optional bool admin_enabled = 445675089; */ - private $admin_enabled = null; + protected $admin_enabled = null; /** * The URL of the Attachment being described. * * Generated from protobuf field optional string attachment = 183982371; */ - private $attachment = null; + protected $attachment = null; /** * Whether this Attachment is participating in the redundant configuration. This will be ACTIVE if and only if the status below is CONNECTION_UP. Any INACTIVE Attachments are excluded from the analysis that generates operational.availabilitySLA. * Check the IsActive enum for the list of possible values. * * Generated from protobuf field optional string is_active = 114830267; */ - private $is_active = null; + protected $is_active = null; /** * Whether this Attachment is active, and if so, whether BGP is up. This is based on the statuses available in the Pantheon UI here: http://google3/java/com/google/cloud/boq/clientapi/gce/hybrid/api/interconnect_models.proto * Check the Status enum for the list of possible values. * * Generated from protobuf field optional string status = 181260274; */ - private $status = null; + protected $status = null; /** * Constructor. diff --git a/Compute/src/V1/InterconnectAttachmentList.php b/Compute/src/V1/InterconnectAttachmentList.php index d189022c1149..103857c637e8 100644 --- a/Compute/src/V1/InterconnectAttachmentList.php +++ b/Compute/src/V1/InterconnectAttachmentList.php @@ -20,7 +20,7 @@ class InterconnectAttachmentList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of InterconnectAttachment resources. * @@ -32,25 +32,25 @@ class InterconnectAttachmentList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/InterconnectAttachmentPartnerMetadata.php b/Compute/src/V1/InterconnectAttachmentPartnerMetadata.php index 7c87bb4bbdcd..8c0578b49422 100644 --- a/Compute/src/V1/InterconnectAttachmentPartnerMetadata.php +++ b/Compute/src/V1/InterconnectAttachmentPartnerMetadata.php @@ -20,19 +20,19 @@ class InterconnectAttachmentPartnerMetadata extends \Google\Protobuf\Internal\Me * * Generated from protobuf field optional string interconnect_name = 514963356; */ - private $interconnect_name = null; + protected $interconnect_name = null; /** * Plain text name of the Partner providing this attachment. This value may be validated to match approved Partner values. * * Generated from protobuf field optional string partner_name = 161747874; */ - private $partner_name = null; + protected $partner_name = null; /** * URL of the Partner's portal for this Attachment. Partners may customise this to be a deep link to the specific resource on the Partner portal. This value may be validated to match approved Partner values. * * Generated from protobuf field optional string portal_url = 269182748; */ - private $portal_url = null; + protected $portal_url = null; /** * Constructor. diff --git a/Compute/src/V1/InterconnectAttachmentPrivateInfo.php b/Compute/src/V1/InterconnectAttachmentPrivateInfo.php index f5c93be6522c..0751858c9d0b 100644 --- a/Compute/src/V1/InterconnectAttachmentPrivateInfo.php +++ b/Compute/src/V1/InterconnectAttachmentPrivateInfo.php @@ -20,7 +20,7 @@ class InterconnectAttachmentPrivateInfo extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field optional uint32 tag8021q = 271820992; */ - private $tag8021q = null; + protected $tag8021q = null; /** * Constructor. diff --git a/Compute/src/V1/InterconnectAttachmentsClient.php b/Compute/src/V1/InterconnectAttachmentsClient.php deleted file mode 100644 index bebfd9428f7c..000000000000 --- a/Compute/src/V1/InterconnectAttachmentsClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/InterconnectCircuitInfo.php b/Compute/src/V1/InterconnectCircuitInfo.php index fb1a00d9900f..ca80412d8d92 100644 --- a/Compute/src/V1/InterconnectCircuitInfo.php +++ b/Compute/src/V1/InterconnectCircuitInfo.php @@ -20,19 +20,19 @@ class InterconnectCircuitInfo extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string customer_demarc_id = 28771859; */ - private $customer_demarc_id = null; + protected $customer_demarc_id = null; /** * Google-assigned unique ID for this circuit. Assigned at circuit turn-up. * * Generated from protobuf field optional string google_circuit_id = 262014711; */ - private $google_circuit_id = null; + protected $google_circuit_id = null; /** * Google-side demarc ID for this circuit. Assigned at circuit turn-up and provided by Google to the customer in the LOA. * * Generated from protobuf field optional string google_demarc_id = 448196270; */ - private $google_demarc_id = null; + protected $google_demarc_id = null; /** * Constructor. diff --git a/Compute/src/V1/InterconnectDiagnostics.php b/Compute/src/V1/InterconnectDiagnostics.php index a80055a140b8..24a5462ae6d7 100644 --- a/Compute/src/V1/InterconnectDiagnostics.php +++ b/Compute/src/V1/InterconnectDiagnostics.php @@ -27,14 +27,14 @@ class InterconnectDiagnostics extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string bundle_aggregation_type = 434939028; */ - private $bundle_aggregation_type = null; + protected $bundle_aggregation_type = null; /** * The operational status of the bundle interface. * Check the BundleOperationalStatus enum for the list of possible values. * * Generated from protobuf field optional string bundle_operational_status = 106433500; */ - private $bundle_operational_status = null; + protected $bundle_operational_status = null; /** * A list of InterconnectDiagnostics.LinkStatus objects, describing the status for each link on the Interconnect. * @@ -46,7 +46,7 @@ class InterconnectDiagnostics extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string mac_address = 332540164; */ - private $mac_address = null; + protected $mac_address = null; /** * Constructor. diff --git a/Compute/src/V1/InterconnectDiagnosticsARPEntry.php b/Compute/src/V1/InterconnectDiagnosticsARPEntry.php index 04deabb62b48..1602c4047192 100644 --- a/Compute/src/V1/InterconnectDiagnosticsARPEntry.php +++ b/Compute/src/V1/InterconnectDiagnosticsARPEntry.php @@ -20,13 +20,13 @@ class InterconnectDiagnosticsARPEntry extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string ip_address = 406272220; */ - private $ip_address = null; + protected $ip_address = null; /** * The MAC address of this ARP neighbor. * * Generated from protobuf field optional string mac_address = 332540164; */ - private $mac_address = null; + protected $mac_address = null; /** * Constructor. diff --git a/Compute/src/V1/InterconnectDiagnosticsLinkLACPStatus.php b/Compute/src/V1/InterconnectDiagnosticsLinkLACPStatus.php index 3e5572253a5a..46ff0e108ffb 100644 --- a/Compute/src/V1/InterconnectDiagnosticsLinkLACPStatus.php +++ b/Compute/src/V1/InterconnectDiagnosticsLinkLACPStatus.php @@ -19,20 +19,20 @@ class InterconnectDiagnosticsLinkLACPStatus extends \Google\Protobuf\Internal\Me * * Generated from protobuf field optional string google_system_id = 91210405; */ - private $google_system_id = null; + protected $google_system_id = null; /** * System ID of the port on the neighbor's side of the LACP exchange. * * Generated from protobuf field optional string neighbor_system_id = 343821342; */ - private $neighbor_system_id = null; + protected $neighbor_system_id = null; /** * The state of a LACP link, which can take one of the following values: - ACTIVE: The link is configured and active within the bundle. - DETACHED: The link is not configured within the bundle. This means that the rest of the object should be empty. * Check the State enum for the list of possible values. * * Generated from protobuf field optional string state = 109757585; */ - private $state = null; + protected $state = null; /** * Constructor. diff --git a/Compute/src/V1/InterconnectDiagnosticsLinkOpticalPower.php b/Compute/src/V1/InterconnectDiagnosticsLinkOpticalPower.php index 3193d7b5ee67..201ad6b86be7 100644 --- a/Compute/src/V1/InterconnectDiagnosticsLinkOpticalPower.php +++ b/Compute/src/V1/InterconnectDiagnosticsLinkOpticalPower.php @@ -20,13 +20,13 @@ class InterconnectDiagnosticsLinkOpticalPower extends \Google\Protobuf\Internal\ * * Generated from protobuf field optional string state = 109757585; */ - private $state = null; + protected $state = null; /** * Value of the current receiving or transmitting optical power, read in dBm. Take a known good optical value, give it a 10% margin and trigger warnings relative to that value. In general, a -7dBm warning and a -11dBm alarm are good optical value estimates for most links. * * Generated from protobuf field optional float value = 111972721; */ - private $value = null; + protected $value = null; /** * Constructor. diff --git a/Compute/src/V1/InterconnectDiagnosticsLinkStatus.php b/Compute/src/V1/InterconnectDiagnosticsLinkStatus.php index 4616f18aca60..7215831c8b02 100644 --- a/Compute/src/V1/InterconnectDiagnosticsLinkStatus.php +++ b/Compute/src/V1/InterconnectDiagnosticsLinkStatus.php @@ -25,42 +25,42 @@ class InterconnectDiagnosticsLinkStatus extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field optional string circuit_id = 225180977; */ - private $circuit_id = null; + protected $circuit_id = null; /** * The Demarc address assigned by Google and provided in the LoA. * * Generated from protobuf field optional string google_demarc = 51084; */ - private $google_demarc = null; + protected $google_demarc = null; /** * Generated from protobuf field optional .google.cloud.compute.v1.InterconnectDiagnosticsLinkLACPStatus lacp_status = 361210415; */ - private $lacp_status = null; + protected $lacp_status = null; /** * Describes the status of MACsec encryption on this link. * * Generated from protobuf field optional .google.cloud.compute.v1.InterconnectDiagnosticsMacsecStatus macsec = 528867490; */ - private $macsec = null; + protected $macsec = null; /** * The operational status of the link. * Check the OperationalStatus enum for the list of possible values. * * Generated from protobuf field optional string operational_status = 201070847; */ - private $operational_status = null; + protected $operational_status = null; /** * An InterconnectDiagnostics.LinkOpticalPower object, describing the current value and status of the received light level. * * Generated from protobuf field optional .google.cloud.compute.v1.InterconnectDiagnosticsLinkOpticalPower receiving_optical_power = 244717279; */ - private $receiving_optical_power = null; + protected $receiving_optical_power = null; /** * An InterconnectDiagnostics.LinkOpticalPower object, describing the current value and status of the transmitted light level. * * Generated from protobuf field optional .google.cloud.compute.v1.InterconnectDiagnosticsLinkOpticalPower transmitting_optical_power = 459431197; */ - private $transmitting_optical_power = null; + protected $transmitting_optical_power = null; /** * Constructor. diff --git a/Compute/src/V1/InterconnectDiagnosticsMacsecStatus.php b/Compute/src/V1/InterconnectDiagnosticsMacsecStatus.php index 19f4ee8ad5b0..54f204a0669f 100644 --- a/Compute/src/V1/InterconnectDiagnosticsMacsecStatus.php +++ b/Compute/src/V1/InterconnectDiagnosticsMacsecStatus.php @@ -20,13 +20,13 @@ class InterconnectDiagnosticsMacsecStatus extends \Google\Protobuf\Internal\Mess * * Generated from protobuf field optional string ckn = 98566; */ - private $ckn = null; + protected $ckn = null; /** * Indicates whether or not MACsec is operational on this link. * * Generated from protobuf field optional bool operational = 129704914; */ - private $operational = null; + protected $operational = null; /** * Constructor. diff --git a/Compute/src/V1/InterconnectGroup.php b/Compute/src/V1/InterconnectGroup.php index 012656f46b6d..83592e1b7a33 100644 --- a/Compute/src/V1/InterconnectGroup.php +++ b/Compute/src/V1/InterconnectGroup.php @@ -18,35 +18,35 @@ class InterconnectGroup extends \Google\Protobuf\Internal\Message /** * Generated from protobuf field optional .google.cloud.compute.v1.InterconnectGroupConfigured configured = 295631422; */ - private $configured = null; + protected $configured = null; /** * [Output Only] Creation timestamp in RFC3339 text format. * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * An optional description of this resource. Provide this property when you create the resource. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * Opaque system-generated token that uniquely identifies the configuration. If provided when patching a configuration in update mode, the provided token must match the current token or the update is rejected. This provides a reliable means of doing read-modify-write (optimistic locking) as described by API 154. * * Generated from protobuf field optional string etag = 3123477; */ - private $etag = null; + protected $etag = null; /** * [Output Only] The unique identifier for the resource type. The server generates this identifier. * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * Generated from protobuf field optional .google.cloud.compute.v1.InterconnectGroupIntent intent = 426849948; */ - private $intent = null; + protected $intent = null; /** * Interconnects in the InterconnectGroup. Keys are arbitrary user-specified strings. Users are encouraged, but not required, to use their preferred format for resource links as keys. Note that there are add-members and remove-members methods in gcloud. The size of this map is limited by an "Interconnects per group" quota. * @@ -58,23 +58,23 @@ class InterconnectGroup extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * Generated from protobuf field optional .google.cloud.compute.v1.InterconnectGroupPhysicalStructure physical_structure = 195307531; */ - private $physical_structure = null; + protected $physical_structure = null; /** * [Output Only] Server-defined URL for the resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * Constructor. diff --git a/Compute/src/V1/InterconnectGroupConfigured.php b/Compute/src/V1/InterconnectGroupConfigured.php index 413964396ec2..188372dfc13d 100644 --- a/Compute/src/V1/InterconnectGroupConfigured.php +++ b/Compute/src/V1/InterconnectGroupConfigured.php @@ -18,7 +18,7 @@ class InterconnectGroupConfigured extends \Google\Protobuf\Internal\Message /** * Generated from protobuf field optional .google.cloud.compute.v1.InterconnectGroupConfiguredTopologyCapability topology_capability = 144190696; */ - private $topology_capability = null; + protected $topology_capability = null; /** * Constructor. diff --git a/Compute/src/V1/InterconnectGroupConfiguredTopologyCapability.php b/Compute/src/V1/InterconnectGroupConfiguredTopologyCapability.php index cc3bb68b99fd..2f71781b9585 100644 --- a/Compute/src/V1/InterconnectGroupConfiguredTopologyCapability.php +++ b/Compute/src/V1/InterconnectGroupConfiguredTopologyCapability.php @@ -25,7 +25,7 @@ class InterconnectGroupConfiguredTopologyCapability extends \Google\Protobuf\Int * * Generated from protobuf field optional string supported_sla = 59292183; */ - private $supported_sla = null; + protected $supported_sla = null; /** * Constructor. diff --git a/Compute/src/V1/InterconnectGroupConfiguredTopologyCapabilityIntendedCapabilityBlockers.php b/Compute/src/V1/InterconnectGroupConfiguredTopologyCapabilityIntendedCapabilityBlockers.php index 2d5944ae7265..64c52aa1e5c2 100644 --- a/Compute/src/V1/InterconnectGroupConfiguredTopologyCapabilityIntendedCapabilityBlockers.php +++ b/Compute/src/V1/InterconnectGroupConfiguredTopologyCapabilityIntendedCapabilityBlockers.php @@ -21,19 +21,19 @@ class InterconnectGroupConfiguredTopologyCapabilityIntendedCapabilityBlockers ex * * Generated from protobuf field optional string blocker_type = 381194847; */ - private $blocker_type = null; + protected $blocker_type = null; /** * [Output Only] The url of Google Cloud public documentation explaining this requirement. This is set for every type of requirement. * * Generated from protobuf field optional string documentation_link = 93465183; */ - private $documentation_link = null; + protected $documentation_link = null; /** * [Output Only] A human-readable explanation of this requirement and why it's not met. This is set for every type of requirement. * * Generated from protobuf field optional string explanation = 504745497; */ - private $explanation = null; + protected $explanation = null; /** * [Output Only] Facilities used to explain this blocker in more detail. Like physicalStructure.metros.facilities.facility, this is a numeric string like "5467". * diff --git a/Compute/src/V1/InterconnectGroupIntent.php b/Compute/src/V1/InterconnectGroupIntent.php index 039bd5e54f22..2450b172b837 100644 --- a/Compute/src/V1/InterconnectGroupIntent.php +++ b/Compute/src/V1/InterconnectGroupIntent.php @@ -21,7 +21,7 @@ class InterconnectGroupIntent extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string topology_capability = 144190696; */ - private $topology_capability = null; + protected $topology_capability = null; /** * Constructor. diff --git a/Compute/src/V1/InterconnectGroupInterconnect.php b/Compute/src/V1/InterconnectGroupInterconnect.php index 78ee769ee1d7..92b9c7659302 100644 --- a/Compute/src/V1/InterconnectGroupInterconnect.php +++ b/Compute/src/V1/InterconnectGroupInterconnect.php @@ -20,7 +20,7 @@ class InterconnectGroupInterconnect extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string interconnect = 224601230; */ - private $interconnect = null; + protected $interconnect = null; /** * Constructor. diff --git a/Compute/src/V1/InterconnectGroupPhysicalStructureMetros.php b/Compute/src/V1/InterconnectGroupPhysicalStructureMetros.php index 9a26fff8244b..e8a58f39ee24 100644 --- a/Compute/src/V1/InterconnectGroupPhysicalStructureMetros.php +++ b/Compute/src/V1/InterconnectGroupPhysicalStructureMetros.php @@ -24,7 +24,7 @@ class InterconnectGroupPhysicalStructureMetros extends \Google\Protobuf\Internal * * Generated from protobuf field optional string metro = 103787801; */ - private $metro = null; + protected $metro = null; /** * Constructor. diff --git a/Compute/src/V1/InterconnectGroupPhysicalStructureMetrosFacilities.php b/Compute/src/V1/InterconnectGroupPhysicalStructureMetrosFacilities.php index c8122bd926e4..cc63b82b07df 100644 --- a/Compute/src/V1/InterconnectGroupPhysicalStructureMetrosFacilities.php +++ b/Compute/src/V1/InterconnectGroupPhysicalStructureMetrosFacilities.php @@ -20,7 +20,7 @@ class InterconnectGroupPhysicalStructureMetrosFacilities extends \Google\Protobu * * Generated from protobuf field optional string facility = 501116579; */ - private $facility = null; + protected $facility = null; /** * Generated from protobuf field repeated .google.cloud.compute.v1.InterconnectGroupPhysicalStructureMetrosFacilitiesZones zones = 116085319; */ diff --git a/Compute/src/V1/InterconnectGroupPhysicalStructureMetrosFacilitiesZones.php b/Compute/src/V1/InterconnectGroupPhysicalStructureMetrosFacilitiesZones.php index 0c0505605a17..95c3f75299b9 100644 --- a/Compute/src/V1/InterconnectGroupPhysicalStructureMetrosFacilitiesZones.php +++ b/Compute/src/V1/InterconnectGroupPhysicalStructureMetrosFacilitiesZones.php @@ -26,7 +26,7 @@ class InterconnectGroupPhysicalStructureMetrosFacilitiesZones extends \Google\Pr * * Generated from protobuf field optional string zone = 3744684; */ - private $zone = null; + protected $zone = null; /** * Constructor. diff --git a/Compute/src/V1/InterconnectGroupsClient.php b/Compute/src/V1/InterconnectGroupsClient.php deleted file mode 100644 index ac9d1756936e..000000000000 --- a/Compute/src/V1/InterconnectGroupsClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional string intent_mismatch_behavior = 164408000; */ - private $intent_mismatch_behavior = null; + protected $intent_mismatch_behavior = null; /** * Generated from protobuf field repeated .google.cloud.compute.v1.InterconnectGroupsCreateMembersInterconnectInput interconnects = 520187301; */ @@ -30,7 +30,7 @@ class InterconnectGroupsCreateMembers extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.InterconnectGroupsCreateMembersInterconnectInput template_interconnect = 224745523; */ - private $template_interconnect = null; + protected $template_interconnect = null; /** * Constructor. diff --git a/Compute/src/V1/InterconnectGroupsCreateMembersInterconnectInput.php b/Compute/src/V1/InterconnectGroupsCreateMembersInterconnectInput.php index 1cd7c763f32a..de15f77ce4eb 100644 --- a/Compute/src/V1/InterconnectGroupsCreateMembersInterconnectInput.php +++ b/Compute/src/V1/InterconnectGroupsCreateMembersInterconnectInput.php @@ -20,57 +20,57 @@ class InterconnectGroupsCreateMembersInterconnectInput extends \Google\Protobuf\ * * Generated from protobuf field optional bool admin_enabled = 445675089; */ - private $admin_enabled = null; + protected $admin_enabled = null; /** * Customer name, to put in the Letter of Authorization as the party authorized to request a crossconnect. * * Generated from protobuf field optional string customer_name = 3665484; */ - private $customer_name = null; + protected $customer_name = null; /** * An optional description of this resource. Provide this property when you create the resource. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * A zone-free location to use for all Interconnects created in this call, like "iad-1234". * * Generated from protobuf field optional string facility = 501116579; */ - private $facility = null; + protected $facility = null; /** * Type of interconnect, which can take one of the following values: - PARTNER: A partner-managed interconnection shared between customers though a partner. - DEDICATED: A dedicated physical interconnection with the customer. Note that a value IT_PRIVATE has been deprecated in favor of DEDICATED. * Check the InterconnectType enum for the list of possible values. * * Generated from protobuf field optional string interconnect_type = 515165259; */ - private $interconnect_type = null; + protected $interconnect_type = null; /** * Type of link requested, which can take one of the following values: - LINK_TYPE_ETHERNET_10G_LR: A 10G Ethernet with LR optics - LINK_TYPE_ETHERNET_100G_LR: A 100G Ethernet with LR optics. - LINK_TYPE_ETHERNET_400G_LR4: A 400G Ethernet with LR4 optics. Note that this field indicates the speed of each of the links in the bundle, not the speed of the entire bundle. * Check the LinkType enum for the list of possible values. * * Generated from protobuf field optional string link_type = 523207775; */ - private $link_type = null; + protected $link_type = null; /** * Name of the Interconnects to be created. This must be specified on the template and/or on each individual interconnect. The name, if not empty, must be 1-63 characters long, and comply with RFC1035. Specifically, any nonempty name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * Email address to contact the customer NOC for operations and maintenance notifications regarding this Interconnect. If specified, this will be used for notifications in addition to all other forms described, such as Cloud Monitoring logs alerting and Cloud Notifications. This field is required for users who sign up for Cloud Interconnect using workforce identity federation. * * Generated from protobuf field optional string noc_contact_email = 14072832; */ - private $noc_contact_email = null; + protected $noc_contact_email = null; /** * Indicates that this is a Cross-Cloud Interconnect. This field specifies the location outside of Google's network that the interconnect is connected to. * * Generated from protobuf field optional string remote_location = 324388750; */ - private $remote_location = null; + protected $remote_location = null; /** * Optional. List of features requested for this Interconnect connection, which can take one of the following values: - IF_MACSEC If specified then the connection is created on MACsec capable hardware ports. If not specified, the default value is false, which allocates non-MACsec capable ports first if available. This parameter can be provided only with Interconnect INSERT. It isn't valid for Interconnect PATCH. * Check the RequestedFeatures enum for the list of possible values. @@ -83,7 +83,7 @@ class InterconnectGroupsCreateMembersInterconnectInput extends \Google\Protobuf\ * * Generated from protobuf field optional int32 requested_link_count = 45051387; */ - private $requested_link_count = null; + protected $requested_link_count = null; /** * Constructor. diff --git a/Compute/src/V1/InterconnectGroupsCreateMembersRequest.php b/Compute/src/V1/InterconnectGroupsCreateMembersRequest.php index 0b0396c1909d..150ea6bb8639 100644 --- a/Compute/src/V1/InterconnectGroupsCreateMembersRequest.php +++ b/Compute/src/V1/InterconnectGroupsCreateMembersRequest.php @@ -17,7 +17,7 @@ class InterconnectGroupsCreateMembersRequest extends \Google\Protobuf\Internal\M /** * Generated from protobuf field optional .google.cloud.compute.v1.InterconnectGroupsCreateMembers request = 21951119; */ - private $request = null; + protected $request = null; /** * Constructor. diff --git a/Compute/src/V1/InterconnectGroupsGetOperationalStatusResponse.php b/Compute/src/V1/InterconnectGroupsGetOperationalStatusResponse.php index 43bb84430596..e1b03dbe9db0 100644 --- a/Compute/src/V1/InterconnectGroupsGetOperationalStatusResponse.php +++ b/Compute/src/V1/InterconnectGroupsGetOperationalStatusResponse.php @@ -18,11 +18,11 @@ class InterconnectGroupsGetOperationalStatusResponse extends \Google\Protobuf\In /** * Generated from protobuf field optional string etag = 3123477; */ - private $etag = null; + protected $etag = null; /** * Generated from protobuf field optional .google.cloud.compute.v1.InterconnectGroupsOperationalStatus result = 139315229; */ - private $result = null; + protected $result = null; /** * Constructor. diff --git a/Compute/src/V1/InterconnectGroupsListResponse.php b/Compute/src/V1/InterconnectGroupsListResponse.php index 0334223250f7..6adc8a18e940 100644 --- a/Compute/src/V1/InterconnectGroupsListResponse.php +++ b/Compute/src/V1/InterconnectGroupsListResponse.php @@ -17,13 +17,13 @@ class InterconnectGroupsListResponse extends \Google\Protobuf\Internal\Message /** * Generated from protobuf field optional string etag = 3123477; */ - private $etag = null; + protected $etag = null; /** * [Output Only] Unique identifier for the resource; defined by the server. * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of InterconnectGroup resources. * @@ -33,19 +33,19 @@ class InterconnectGroupsListResponse extends \Google\Protobuf\Internal\Message /** * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Unreachable resources. end_interface: MixerListResponseWithEtagBuilder * @@ -57,7 +57,7 @@ class InterconnectGroupsListResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/InterconnectGroupsOperationalStatus.php b/Compute/src/V1/InterconnectGroupsOperationalStatus.php index a600b7b4c7b3..88c2095c7615 100644 --- a/Compute/src/V1/InterconnectGroupsOperationalStatus.php +++ b/Compute/src/V1/InterconnectGroupsOperationalStatus.php @@ -20,20 +20,20 @@ class InterconnectGroupsOperationalStatus extends \Google\Protobuf\Internal\Mess * * Generated from protobuf field optional .google.cloud.compute.v1.InterconnectGroupConfigured configured = 295631422; */ - private $configured = null; + protected $configured = null; /** * Summarizes the status of the group. * Check the GroupStatus enum for the list of possible values. * * Generated from protobuf field optional string group_status = 338778546; */ - private $group_status = null; + protected $group_status = null; /** * The intent of the resource, as returned by Get. * * Generated from protobuf field optional .google.cloud.compute.v1.InterconnectGroupIntent intent = 426849948; */ - private $intent = null; + protected $intent = null; /** * Generated from protobuf field repeated .google.cloud.compute.v1.InterconnectGroupsOperationalStatusInterconnectStatus interconnect_statuses = 446756017; */ @@ -43,7 +43,7 @@ class InterconnectGroupsOperationalStatus extends \Google\Protobuf\Internal\Mess * * Generated from protobuf field optional .google.cloud.compute.v1.InterconnectGroupConfigured operational = 129704914; */ - private $operational = null; + protected $operational = null; /** * Constructor. diff --git a/Compute/src/V1/InterconnectGroupsOperationalStatusInterconnectStatus.php b/Compute/src/V1/InterconnectGroupsOperationalStatusInterconnectStatus.php index d5c5f744aa08..b97c7c4ed2a1 100644 --- a/Compute/src/V1/InterconnectGroupsOperationalStatusInterconnectStatus.php +++ b/Compute/src/V1/InterconnectGroupsOperationalStatusInterconnectStatus.php @@ -20,26 +20,26 @@ class InterconnectGroupsOperationalStatusInterconnectStatus extends \Google\Prot * * Generated from protobuf field optional bool admin_enabled = 445675089; */ - private $admin_enabled = null; + protected $admin_enabled = null; /** * The diagnostics of the Interconnect, as returned by the existing get-diagnostics method. * * Generated from protobuf field optional .google.cloud.compute.v1.InterconnectDiagnostics diagnostics = 333355436; */ - private $diagnostics = null; + protected $diagnostics = null; /** * The URL of the Interconnect being described. * * Generated from protobuf field optional string interconnect = 224601230; */ - private $interconnect = null; + protected $interconnect = null; /** * Whether this interconnect is participating in the redundant configuration. * Check the IsActive enum for the list of possible values. * * Generated from protobuf field optional string is_active = 114830267; */ - private $is_active = null; + protected $is_active = null; /** * Constructor. diff --git a/Compute/src/V1/InterconnectList.php b/Compute/src/V1/InterconnectList.php index 3f9770ce20de..e3f1175c6e86 100644 --- a/Compute/src/V1/InterconnectList.php +++ b/Compute/src/V1/InterconnectList.php @@ -20,7 +20,7 @@ class InterconnectList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of Interconnect resources. * @@ -32,25 +32,25 @@ class InterconnectList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/InterconnectLocation.php b/Compute/src/V1/InterconnectLocation.php index bb1bd34c1c29..693a260ac48a 100644 --- a/Compute/src/V1/InterconnectLocation.php +++ b/Compute/src/V1/InterconnectLocation.php @@ -20,13 +20,13 @@ class InterconnectLocation extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string address = 462920692; */ - private $address = null; + protected $address = null; /** * [Output Only] Availability zone for this InterconnectLocation. Within a metropolitan area (metro), maintenance will not be simultaneously scheduled in more than one availability zone. Example: "zone1" or "zone2". * * Generated from protobuf field optional string availability_zone = 158459920; */ - private $availability_zone = null; + protected $availability_zone = null; /** * [Output only] List of features available at this InterconnectLocation, which can take one of the following values: - IF_MACSEC * Check the AvailableFeatures enum for the list of possible values. @@ -46,62 +46,62 @@ class InterconnectLocation extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string city = 3053931; */ - private $city = null; + protected $city = null; /** * [Output Only] Continent for this location, which can take one of the following values: - AFRICA - ASIA_PAC - EUROPE - NORTH_AMERICA - SOUTH_AMERICA * Check the Continent enum for the list of possible values. * * Generated from protobuf field optional string continent = 133442996; */ - private $continent = null; + protected $continent = null; /** * [Output Only] Creation timestamp in RFC3339 text format. * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * [Output Only] An optional description of the resource. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * [Output Only] The name of the provider for this facility (e.g., EQUINIX). * * Generated from protobuf field optional string facility_provider = 533303309; */ - private $facility_provider = null; + protected $facility_provider = null; /** * [Output Only] A provider-assigned Identifier for this facility (e.g., Ashburn-DC1). * * Generated from protobuf field optional string facility_provider_facility_id = 87269125; */ - private $facility_provider_facility_id = null; + protected $facility_provider_facility_id = null; /** * [Output Only] The unique identifier for the resource. This identifier is defined by the server. * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * [Output Only] Type of the resource. Always compute#interconnectLocation for interconnect locations. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] Name of the resource. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * [Output Only] The peeringdb identifier for this facility (corresponding with a netfac type in peeringdb). * * Generated from protobuf field optional string peeringdb_facility_id = 536567094; */ - private $peeringdb_facility_id = null; + protected $peeringdb_facility_id = null; /** * [Output Only] A list of InterconnectLocation.RegionInfo objects, that describe parameters pertaining to the relation between this InterconnectLocation and various Google Cloud regions. * @@ -113,20 +113,20 @@ class InterconnectLocation extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] The status of this InterconnectLocation, which can take one of the following values: - CLOSED: The InterconnectLocation is closed and is unavailable for provisioning new Interconnects. - AVAILABLE: The InterconnectLocation is available for provisioning new Interconnects. * Check the Status enum for the list of possible values. * * Generated from protobuf field optional string status = 181260274; */ - private $status = null; + protected $status = null; /** * [Output Only] Reserved for future use. * * Generated from protobuf field optional bool supports_pzs = 83983214; */ - private $supports_pzs = null; + protected $supports_pzs = null; /** * Constructor. diff --git a/Compute/src/V1/InterconnectLocationList.php b/Compute/src/V1/InterconnectLocationList.php index 6c0e52200a9c..d5c5543a0f81 100644 --- a/Compute/src/V1/InterconnectLocationList.php +++ b/Compute/src/V1/InterconnectLocationList.php @@ -20,7 +20,7 @@ class InterconnectLocationList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of InterconnectLocation resources. * @@ -32,25 +32,25 @@ class InterconnectLocationList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/InterconnectLocationRegionInfo.php b/Compute/src/V1/InterconnectLocationRegionInfo.php index c87ceb0fd0db..ce9bc70d6661 100644 --- a/Compute/src/V1/InterconnectLocationRegionInfo.php +++ b/Compute/src/V1/InterconnectLocationRegionInfo.php @@ -20,20 +20,20 @@ class InterconnectLocationRegionInfo extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int64 expected_rtt_ms = 422543866; */ - private $expected_rtt_ms = null; + protected $expected_rtt_ms = null; /** * Identifies the network presence of this location. * Check the LocationPresence enum for the list of possible values. * * Generated from protobuf field optional string location_presence = 101517893; */ - private $location_presence = null; + protected $location_presence = null; /** * URL for the region of this location. * * Generated from protobuf field optional string region = 138946292; */ - private $region = null; + protected $region = null; /** * Constructor. diff --git a/Compute/src/V1/InterconnectLocationsClient.php b/Compute/src/V1/InterconnectLocationsClient.php deleted file mode 100644 index 9abdd0c9d3da..000000000000 --- a/Compute/src/V1/InterconnectLocationsClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional bool fail_open = 532597451; */ - private $fail_open = null; + protected $fail_open = null; /** * Required. A keychain placeholder describing a set of named key objects along with their start times. A MACsec CKN/CAK is generated for each key in the key chain. Google router automatically picks the key with the most recent startTime when establishing or re-establishing a MACsec secure link. * diff --git a/Compute/src/V1/InterconnectMacsecConfigPreSharedKey.php b/Compute/src/V1/InterconnectMacsecConfigPreSharedKey.php index 7073f4778a5a..fe1ef37ab2b9 100644 --- a/Compute/src/V1/InterconnectMacsecConfigPreSharedKey.php +++ b/Compute/src/V1/InterconnectMacsecConfigPreSharedKey.php @@ -20,25 +20,25 @@ class InterconnectMacsecConfigPreSharedKey extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field optional string cak = 98253; */ - private $cak = null; + protected $cak = null; /** * An auto-generated Connectivity Association Key Name (CKN) for this key. * * Generated from protobuf field optional string ckn = 98566; */ - private $ckn = null; + protected $ckn = null; /** * User provided name for this pre-shared key. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * User provided timestamp on or after which this key is valid. * * Generated from protobuf field optional string start_time = 37467274; */ - private $start_time = null; + protected $start_time = null; /** * Constructor. diff --git a/Compute/src/V1/InterconnectMacsecPreSharedKey.php b/Compute/src/V1/InterconnectMacsecPreSharedKey.php index 190a4e45112c..9f68258b29ab 100644 --- a/Compute/src/V1/InterconnectMacsecPreSharedKey.php +++ b/Compute/src/V1/InterconnectMacsecPreSharedKey.php @@ -20,13 +20,13 @@ class InterconnectMacsecPreSharedKey extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * A RFC3339 timestamp on or after which the key is valid. startTime can be in the future. If the keychain has a single key, startTime can be omitted. If the keychain has multiple keys, startTime is mandatory for each key. The start times of keys must be in increasing order. The start times of two consecutive keys must be at least 6 hours apart. * * Generated from protobuf field optional string start_time = 37467274; */ - private $start_time = null; + protected $start_time = null; /** * Constructor. diff --git a/Compute/src/V1/InterconnectOutageNotification.php b/Compute/src/V1/InterconnectOutageNotification.php index a5f04f04f375..74617f327513 100644 --- a/Compute/src/V1/InterconnectOutageNotification.php +++ b/Compute/src/V1/InterconnectOutageNotification.php @@ -26,46 +26,46 @@ class InterconnectOutageNotification extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * Scheduled end time for the outage (milliseconds since Unix epoch). * * Generated from protobuf field optional int64 end_time = 114938801; */ - private $end_time = null; + protected $end_time = null; /** * Form this outage is expected to take, which can take one of the following values: - OUTAGE: The Interconnect may be completely out of service for some or all of the specified window. - PARTIAL_OUTAGE: Some circuits comprising the Interconnect as a whole should remain up, but with reduced bandwidth. Note that the versions of this enum prefixed with "IT_" have been deprecated in favor of the unprefixed values. * Check the IssueType enum for the list of possible values. * * Generated from protobuf field optional string issue_type = 369639136; */ - private $issue_type = null; + protected $issue_type = null; /** * Unique identifier for this outage notification. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * The party that generated this notification, which can take the following value: - GOOGLE: this notification as generated by Google. Note that the value of NSRC_GOOGLE has been deprecated in favor of GOOGLE. * Check the Source enum for the list of possible values. * * Generated from protobuf field optional string source = 177235995; */ - private $source = null; + protected $source = null; /** * Scheduled start time for the outage (milliseconds since Unix epoch). * * Generated from protobuf field optional int64 start_time = 37467274; */ - private $start_time = null; + protected $start_time = null; /** * State of this notification, which can take one of the following values: - ACTIVE: This outage notification is active. The event could be in the past, present, or future. See start_time and end_time for scheduling. - CANCELLED: The outage associated with this notification was cancelled before the outage was due to start. - COMPLETED: The outage associated with this notification is complete. Note that the versions of this enum prefixed with "NS_" have been deprecated in favor of the unprefixed values. * Check the State enum for the list of possible values. * * Generated from protobuf field optional string state = 109757585; */ - private $state = null; + protected $state = null; /** * Constructor. diff --git a/Compute/src/V1/InterconnectRemoteLocation.php b/Compute/src/V1/InterconnectRemoteLocation.php index a0dc63ee7750..b57f4a69c605 100644 --- a/Compute/src/V1/InterconnectRemoteLocation.php +++ b/Compute/src/V1/InterconnectRemoteLocation.php @@ -20,99 +20,99 @@ class InterconnectRemoteLocation extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string address = 462920692; */ - private $address = null; + protected $address = null; /** * [Output Only] Subset of fields from InterconnectAttachment's |configurationConstraints| field that apply to all attachments for this remote location. * * Generated from protobuf field optional .google.cloud.compute.v1.InterconnectAttachmentConfigurationConstraints attachment_configuration_constraints = 326825041; */ - private $attachment_configuration_constraints = null; + protected $attachment_configuration_constraints = null; /** * [Output Only] Metropolitan area designator that indicates which city an interconnect is located. For example: "Chicago, IL", "Amsterdam, Netherlands". * * Generated from protobuf field optional string city = 3053931; */ - private $city = null; + protected $city = null; /** * [Output Only] Constraints on the parameters for creating Cross-Cloud Interconnect and associated InterconnectAttachments. * * Generated from protobuf field optional .google.cloud.compute.v1.InterconnectRemoteLocationConstraints constraints = 3909174; */ - private $constraints = null; + protected $constraints = null; /** * [Output Only] Continent for this location, which can take one of the following values: - AFRICA - ASIA_PAC - EUROPE - NORTH_AMERICA - SOUTH_AMERICA * Check the Continent enum for the list of possible values. * * Generated from protobuf field optional string continent = 133442996; */ - private $continent = null; + protected $continent = null; /** * [Output Only] Creation timestamp in RFC3339 text format. * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * [Output Only] An optional description of the resource. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * [Output Only] The name of the provider for this facility (e.g., EQUINIX). * * Generated from protobuf field optional string facility_provider = 533303309; */ - private $facility_provider = null; + protected $facility_provider = null; /** * [Output Only] A provider-assigned Identifier for this facility (e.g., Ashburn-DC1). * * Generated from protobuf field optional string facility_provider_facility_id = 87269125; */ - private $facility_provider_facility_id = null; + protected $facility_provider_facility_id = null; /** * [Output Only] The unique identifier for the resource. This identifier is defined by the server. * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * [Output Only] Type of the resource. Always compute#interconnectRemoteLocation for interconnect remote locations. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] Link Aggregation Control Protocol (LACP) constraints, which can take one of the following values: LACP_SUPPORTED, LACP_UNSUPPORTED * Check the Lacp enum for the list of possible values. * * Generated from protobuf field optional string lacp = 3313826; */ - private $lacp = null; + protected $lacp = null; /** * [Output Only] The maximum number of 100 Gbps ports supported in a link aggregation group (LAG). When linkType is 100 Gbps, requestedLinkCount cannot exceed max_lag_size_100_gbps. * * Generated from protobuf field optional int32 max_lag_size100_gbps = 245219253; */ - private $max_lag_size100_gbps = null; + protected $max_lag_size100_gbps = null; /** * [Output Only] The maximum number of 10 Gbps ports supported in a link aggregation group (LAG). When linkType is 10 Gbps, requestedLinkCount cannot exceed max_lag_size_10_gbps. * * Generated from protobuf field optional int32 max_lag_size10_gbps = 294007573; */ - private $max_lag_size10_gbps = null; + protected $max_lag_size10_gbps = null; /** * [Output Only] Name of the resource. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * [Output Only] The peeringdb identifier for this facility (corresponding with a netfac type in peeringdb). * * Generated from protobuf field optional string peeringdb_facility_id = 536567094; */ - private $peeringdb_facility_id = null; + protected $peeringdb_facility_id = null; /** * [Output Only] Permitted connections. * @@ -124,20 +124,20 @@ class InterconnectRemoteLocation extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string remote_service = 391954364; */ - private $remote_service = null; + protected $remote_service = null; /** * [Output Only] Server-defined URL for the resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] The status of this InterconnectRemoteLocation, which can take one of the following values: - CLOSED: The InterconnectRemoteLocation is closed and is unavailable for provisioning new Cross-Cloud Interconnects. - AVAILABLE: The InterconnectRemoteLocation is available for provisioning new Cross-Cloud Interconnects. * Check the Status enum for the list of possible values. * * Generated from protobuf field optional string status = 181260274; */ - private $status = null; + protected $status = null; /** * Constructor. diff --git a/Compute/src/V1/InterconnectRemoteLocationConstraints.php b/Compute/src/V1/InterconnectRemoteLocationConstraints.php index 42c3de96fb8a..11246431223d 100644 --- a/Compute/src/V1/InterconnectRemoteLocationConstraints.php +++ b/Compute/src/V1/InterconnectRemoteLocationConstraints.php @@ -20,20 +20,20 @@ class InterconnectRemoteLocationConstraints extends \Google\Protobuf\Internal\Me * * Generated from protobuf field optional string port_pair_remote_location = 495917351; */ - private $port_pair_remote_location = null; + protected $port_pair_remote_location = null; /** * [Output Only] Port pair VLAN constraints, which can take one of the following values: PORT_PAIR_UNCONSTRAINED_VLAN, PORT_PAIR_MATCHING_VLAN * Check the PortPairVlan enum for the list of possible values. * * Generated from protobuf field optional string port_pair_vlan = 478214506; */ - private $port_pair_vlan = null; + protected $port_pair_vlan = null; /** * [Output Only] [min-length, max-length] The minimum and maximum value (inclusive) for the IPv4 subnet length. For example, an interconnectRemoteLocation for Azure has {min: 30, max: 30} because Azure requires /30 subnets. This range specifies the values supported by both cloud providers. Interconnect currently supports /29 and /30 IPv4 subnet lengths. If a remote cloud has no constraint on IPv4 subnet length, the range would thus be {min: 29, max: 30}. * * Generated from protobuf field optional .google.cloud.compute.v1.InterconnectRemoteLocationConstraintsSubnetLengthRange subnet_length_range = 184473670; */ - private $subnet_length_range = null; + protected $subnet_length_range = null; /** * Constructor. diff --git a/Compute/src/V1/InterconnectRemoteLocationConstraintsSubnetLengthRange.php b/Compute/src/V1/InterconnectRemoteLocationConstraintsSubnetLengthRange.php index 10b806fddb1b..d922974f1c92 100644 --- a/Compute/src/V1/InterconnectRemoteLocationConstraintsSubnetLengthRange.php +++ b/Compute/src/V1/InterconnectRemoteLocationConstraintsSubnetLengthRange.php @@ -17,11 +17,11 @@ class InterconnectRemoteLocationConstraintsSubnetLengthRange extends \Google\Pro /** * Generated from protobuf field optional int32 max = 107876; */ - private $max = null; + protected $max = null; /** * Generated from protobuf field optional int32 min = 108114; */ - private $min = null; + protected $min = null; /** * Constructor. diff --git a/Compute/src/V1/InterconnectRemoteLocationList.php b/Compute/src/V1/InterconnectRemoteLocationList.php index e6fbe9f75462..459b895aa566 100644 --- a/Compute/src/V1/InterconnectRemoteLocationList.php +++ b/Compute/src/V1/InterconnectRemoteLocationList.php @@ -20,7 +20,7 @@ class InterconnectRemoteLocationList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of InterconnectRemoteLocation resources. * @@ -32,25 +32,25 @@ class InterconnectRemoteLocationList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token lets you get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/InterconnectRemoteLocationPermittedConnections.php b/Compute/src/V1/InterconnectRemoteLocationPermittedConnections.php index bf053b3422a6..0e67b4f616c3 100644 --- a/Compute/src/V1/InterconnectRemoteLocationPermittedConnections.php +++ b/Compute/src/V1/InterconnectRemoteLocationPermittedConnections.php @@ -19,7 +19,7 @@ class InterconnectRemoteLocationPermittedConnections extends \Google\Protobuf\In * * Generated from protobuf field optional string interconnect_location = 492235846; */ - private $interconnect_location = null; + protected $interconnect_location = null; /** * Constructor. diff --git a/Compute/src/V1/InterconnectRemoteLocationsClient.php b/Compute/src/V1/InterconnectRemoteLocationsClient.php deleted file mode 100644 index db024d418f6d..000000000000 --- a/Compute/src/V1/InterconnectRemoteLocationsClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional .google.cloud.compute.v1.InterconnectDiagnostics result = 139315229; */ - private $result = null; + protected $result = null; /** * Constructor. diff --git a/Compute/src/V1/InterconnectsGetMacsecConfigResponse.php b/Compute/src/V1/InterconnectsGetMacsecConfigResponse.php index 84517400cd42..dcf69aae9bb5 100644 --- a/Compute/src/V1/InterconnectsGetMacsecConfigResponse.php +++ b/Compute/src/V1/InterconnectsGetMacsecConfigResponse.php @@ -20,11 +20,11 @@ class InterconnectsGetMacsecConfigResponse extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field optional string etag = 3123477; */ - private $etag = null; + protected $etag = null; /** * Generated from protobuf field optional .google.cloud.compute.v1.InterconnectMacsecConfig result = 139315229; */ - private $result = null; + protected $result = null; /** * Constructor. diff --git a/Compute/src/V1/InvalidateCacheUrlMapRequest.php b/Compute/src/V1/InvalidateCacheUrlMapRequest.php index 77814b13bca0..16b88d157bb6 100644 --- a/Compute/src/V1/InvalidateCacheUrlMapRequest.php +++ b/Compute/src/V1/InvalidateCacheUrlMapRequest.php @@ -20,25 +20,25 @@ class InvalidateCacheUrlMapRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.compute.v1.CacheInvalidationRule cache_invalidation_rule_resource = 312795565 [(.google.api.field_behavior) = REQUIRED]; */ - private $cache_invalidation_rule_resource = null; + protected $cache_invalidation_rule_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name of the UrlMap scoping this request. * * Generated from protobuf field string url_map = 367020684 [(.google.api.field_behavior) = REQUIRED]; */ - private $url_map = ''; + protected $url_map = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/Items.php b/Compute/src/V1/Items.php index 1c1a468c3ab1..63a13da325f5 100644 --- a/Compute/src/V1/Items.php +++ b/Compute/src/V1/Items.php @@ -20,13 +20,13 @@ class Items extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string key = 106079; */ - private $key = null; + protected $key = null; /** * Value for the metadata entry. These are free-form strings, and only have meaning as interpreted by the image running in the instance. The only restriction placed on values is that their size must be less than or equal to 262144 bytes (256 KiB). * * Generated from protobuf field optional string value = 111972721; */ - private $value = null; + protected $value = null; /** * Constructor. diff --git a/Compute/src/V1/License.php b/Compute/src/V1/License.php index 5a36f63254ac..9aab1796eea1 100644 --- a/Compute/src/V1/License.php +++ b/Compute/src/V1/License.php @@ -26,31 +26,31 @@ class License extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional bool appendable_to_disk = 16959254; */ - private $appendable_to_disk = null; + protected $appendable_to_disk = null; /** * [Output Only] Deprecated. This field no longer reflects whether a license charges a usage fee. * * Generated from protobuf field optional bool charges_use_fee = 372412622; */ - private $charges_use_fee = null; + protected $charges_use_fee = null; /** * [Output Only] Creation timestamp in RFC3339 text format. * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * An optional textual description of the resource; provided by the client when the resource is created. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * [Output Only] The unique identifier for the resource. This identifier is defined by the server. * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * Specifies licenseCodes of licenses that are incompatible with this license. If a license is incompatible with this license, it cannot be attached to the same disk or image. * @@ -62,43 +62,43 @@ class License extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] The unique code used to attach this license to images, snapshots, and disks. * * Generated from protobuf field optional uint64 license_code = 1467179; */ - private $license_code = null; + protected $license_code = null; /** * If set, this license will be unable to be removed or replaced once attached to a disk until the minimum_retention period has passed. * * Generated from protobuf field optional .google.cloud.compute.v1.Duration minimum_retention = 155398189; */ - private $minimum_retention = null; + protected $minimum_retention = null; /** * If true, this license can only be used on VMs on multi tenant nodes. * * Generated from protobuf field optional bool multi_tenant_only = 274395163; */ - private $multi_tenant_only = null; + protected $multi_tenant_only = null; /** * Name of the resource. The name must be 1-63 characters long and comply with RFC1035. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * If true, indicates this is an OS license. Only one OS license can be attached to a disk or image at a time. * * Generated from protobuf field optional bool os_license = 487986406; */ - private $os_license = null; + protected $os_license = null; /** * If true, this license can be removed from a disk's set of licenses, with no replacement license needed. * * Generated from protobuf field optional bool removable_from_disk = 25854638; */ - private $removable_from_disk = null; + protected $removable_from_disk = null; /** * Specifies the set of permissible coattached licenseCodes of licenses that satisfy the coattachment requirement of this license. At least one license from the set must be attached to the same disk or image as this license. * @@ -110,37 +110,37 @@ class License extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.LicenseResourceRequirements resource_requirements = 214292769; */ - private $resource_requirements = null; + protected $resource_requirements = null; /** * [Output Only] Server-defined URL for the resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Server-defined URL for this resource with the resource id. * * Generated from protobuf field optional string self_link_with_id = 44520962; */ - private $self_link_with_id = null; + protected $self_link_with_id = null; /** * If true, this license can only be used on VMs on sole tenant nodes. * * Generated from protobuf field optional bool sole_tenant_only = 427525559; */ - private $sole_tenant_only = null; + protected $sole_tenant_only = null; /** * If false, licenses will not be copied from the source resource when creating an image from a disk, disk from snapshot, or snapshot from disk. * * Generated from protobuf field optional bool transferable = 4349893; */ - private $transferable = null; + protected $transferable = null; /** * [Output Only] Last update timestamp in RFC3339 text format. * * Generated from protobuf field optional string update_timestamp = 120894752; */ - private $update_timestamp = null; + protected $update_timestamp = null; /** * Constructor. diff --git a/Compute/src/V1/LicenseCode.php b/Compute/src/V1/LicenseCode.php index 152a702a9ac1..bf1e88e4bc73 100644 --- a/Compute/src/V1/LicenseCode.php +++ b/Compute/src/V1/LicenseCode.php @@ -20,25 +20,25 @@ class LicenseCode extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * [Output Only] Description of this License Code. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * [Output Only] The unique identifier for the resource. This identifier is defined by the server. * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * [Output Only] Type of resource. Always compute#licenseCode for licenses. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] URL and description aliases of Licenses with the same License Code. * @@ -50,26 +50,26 @@ class LicenseCode extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * [Output Only] Server-defined URL for the resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Current state of this License Code. * Check the State enum for the list of possible values. * * Generated from protobuf field optional string state = 109757585; */ - private $state = null; + protected $state = null; /** * [Output Only] If true, the license will remain attached when creating images or snapshots from disks. Otherwise, the license is not transferred. * * Generated from protobuf field optional bool transferable = 4349893; */ - private $transferable = null; + protected $transferable = null; /** * Constructor. diff --git a/Compute/src/V1/LicenseCodeLicenseAlias.php b/Compute/src/V1/LicenseCodeLicenseAlias.php index b1c1644bbb5d..f1e0ff5a1026 100644 --- a/Compute/src/V1/LicenseCodeLicenseAlias.php +++ b/Compute/src/V1/LicenseCodeLicenseAlias.php @@ -19,13 +19,13 @@ class LicenseCodeLicenseAlias extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * [Output Only] URL of license corresponding to this License Code. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * Constructor. diff --git a/Compute/src/V1/LicenseCodesClient.php b/Compute/src/V1/LicenseCodesClient.php deleted file mode 100644 index 62c672df1576..000000000000 --- a/Compute/src/V1/LicenseCodesClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional int64 amount = 196759640; */ - private $amount = null; + protected $amount = null; /** * The number of cores per license. * * Generated from protobuf field optional string cores_per_license = 32482324; */ - private $cores_per_license = null; + protected $cores_per_license = null; /** * The applicable license URI. * * Generated from protobuf field optional string license = 166757441; */ - private $license = null; + protected $license = null; /** * Constructor. diff --git a/Compute/src/V1/LicenseResourceRequirements.php b/Compute/src/V1/LicenseResourceRequirements.php index 0dc699cb2abc..7ddcf0591af2 100644 --- a/Compute/src/V1/LicenseResourceRequirements.php +++ b/Compute/src/V1/LicenseResourceRequirements.php @@ -19,13 +19,13 @@ class LicenseResourceRequirements extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int32 min_guest_cpu_count = 477964836; */ - private $min_guest_cpu_count = null; + protected $min_guest_cpu_count = null; /** * [Input Only] Deprecated. This field no longer reflects the minimum memory required to use the Instance. * * Generated from protobuf field optional int32 min_memory_mb = 504785894; */ - private $min_memory_mb = null; + protected $min_memory_mb = null; /** * Constructor. diff --git a/Compute/src/V1/LicensesClient.php b/Compute/src/V1/LicensesClient.php deleted file mode 100644 index 894db950fe8c..000000000000 --- a/Compute/src/V1/LicensesClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of License resources. * @@ -31,19 +31,19 @@ class LicensesListResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/ListAcceleratorTypesRequest.php b/Compute/src/V1/ListAcceleratorTypesRequest.php index 7d55004c82ce..74a7cc24e213 100644 --- a/Compute/src/V1/ListAcceleratorTypesRequest.php +++ b/Compute/src/V1/ListAcceleratorTypesRequest.php @@ -20,43 +20,43 @@ class ListAcceleratorTypesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListAddressesRequest.php b/Compute/src/V1/ListAddressesRequest.php index 6bdb3a97c43c..921669735ce3 100644 --- a/Compute/src/V1/ListAddressesRequest.php +++ b/Compute/src/V1/ListAddressesRequest.php @@ -20,43 +20,43 @@ class ListAddressesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListAssociationsFirewallPolicyRequest.php b/Compute/src/V1/ListAssociationsFirewallPolicyRequest.php index 39b3bce76ab6..1288003172eb 100644 --- a/Compute/src/V1/ListAssociationsFirewallPolicyRequest.php +++ b/Compute/src/V1/ListAssociationsFirewallPolicyRequest.php @@ -20,7 +20,7 @@ class ListAssociationsFirewallPolicyRequest extends \Google\Protobuf\Internal\Me * * Generated from protobuf field optional string target_resource = 467318524; */ - private $target_resource = null; + protected $target_resource = null; /** * Constructor. diff --git a/Compute/src/V1/ListAutoscalersRequest.php b/Compute/src/V1/ListAutoscalersRequest.php index 81ac72603a71..945a6cde7bc2 100644 --- a/Compute/src/V1/ListAutoscalersRequest.php +++ b/Compute/src/V1/ListAutoscalersRequest.php @@ -20,43 +20,43 @@ class ListAutoscalersRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * Name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListAvailableFeaturesRegionSslPoliciesRequest.php b/Compute/src/V1/ListAvailableFeaturesRegionSslPoliciesRequest.php index a7977c8545c2..8a5440e1194e 100644 --- a/Compute/src/V1/ListAvailableFeaturesRegionSslPoliciesRequest.php +++ b/Compute/src/V1/ListAvailableFeaturesRegionSslPoliciesRequest.php @@ -20,43 +20,43 @@ class ListAvailableFeaturesRegionSslPoliciesRequest extends \Google\Protobuf\Int * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListAvailableFeaturesSslPoliciesRequest.php b/Compute/src/V1/ListAvailableFeaturesSslPoliciesRequest.php index 70cb928dfb7f..0ea329e82c7d 100644 --- a/Compute/src/V1/ListAvailableFeaturesSslPoliciesRequest.php +++ b/Compute/src/V1/ListAvailableFeaturesSslPoliciesRequest.php @@ -20,37 +20,37 @@ class ListAvailableFeaturesSslPoliciesRequest extends \Google\Protobuf\Internal\ * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListBackendBucketsRequest.php b/Compute/src/V1/ListBackendBucketsRequest.php index f31ea9ed00d5..fa2447588155 100644 --- a/Compute/src/V1/ListBackendBucketsRequest.php +++ b/Compute/src/V1/ListBackendBucketsRequest.php @@ -20,37 +20,37 @@ class ListBackendBucketsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListBackendServicesRequest.php b/Compute/src/V1/ListBackendServicesRequest.php index dfc8c0d64667..c3ab95da319e 100644 --- a/Compute/src/V1/ListBackendServicesRequest.php +++ b/Compute/src/V1/ListBackendServicesRequest.php @@ -20,37 +20,37 @@ class ListBackendServicesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListBgpRoutesRoutersRequest.php b/Compute/src/V1/ListBgpRoutesRoutersRequest.php index 75f2b5c8e947..701a48c9edf5 100644 --- a/Compute/src/V1/ListBgpRoutesRoutersRequest.php +++ b/Compute/src/V1/ListBgpRoutesRoutersRequest.php @@ -21,80 +21,80 @@ class ListBgpRoutesRoutersRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string address_family = 173744655; */ - private $address_family = null; + protected $address_family = null; /** * Limit results to destinations that are subnets of this CIDR range * * Generated from protobuf field optional string destination_prefix = 263872483; */ - private $destination_prefix = null; + protected $destination_prefix = null; /** * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * (Required) limit results to the BGP peer with the given name. Name should conform to RFC1035. * * Generated from protobuf field optional string peer = 3436898; */ - private $peer = null; + protected $peer = null; /** * When true, the method returns post-policy routes. Otherwise, it returns pre-policy routes. * * Generated from protobuf field optional bool policy_applied = 379464304; */ - private $policy_applied = null; + protected $policy_applied = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * (Required) limit results to this type of route (either LEARNED or ADVERTISED) * Check the RouteType enum for the list of possible values. * * Generated from protobuf field optional string route_type = 375888752; */ - private $route_type = null; + protected $route_type = null; /** * Name or id of the resource for this request. Name should conform to RFC1035. * * Generated from protobuf field string router = 148608841 [(.google.api.field_behavior) = REQUIRED]; */ - private $router = ''; + protected $router = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListDiskTypesRequest.php b/Compute/src/V1/ListDiskTypesRequest.php index d6a95a441237..1258610254eb 100644 --- a/Compute/src/V1/ListDiskTypesRequest.php +++ b/Compute/src/V1/ListDiskTypesRequest.php @@ -20,43 +20,43 @@ class ListDiskTypesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListDisksRequest.php b/Compute/src/V1/ListDisksRequest.php index 8b569c8589dd..4014f74ec7dd 100644 --- a/Compute/src/V1/ListDisksRequest.php +++ b/Compute/src/V1/ListDisksRequest.php @@ -20,43 +20,43 @@ class ListDisksRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListDisksStoragePoolsRequest.php b/Compute/src/V1/ListDisksStoragePoolsRequest.php index e446b9a20403..7f906cedf636 100644 --- a/Compute/src/V1/ListDisksStoragePoolsRequest.php +++ b/Compute/src/V1/ListDisksStoragePoolsRequest.php @@ -20,49 +20,49 @@ class ListDisksStoragePoolsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * Name of the storage pool to list disks of. * * Generated from protobuf field string storage_pool = 360473440 [(.google.api.field_behavior) = REQUIRED]; */ - private $storage_pool = ''; + protected $storage_pool = ''; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListErrorsInstanceGroupManagersRequest.php b/Compute/src/V1/ListErrorsInstanceGroupManagersRequest.php index 543c5a2c7917..4aa568422089 100644 --- a/Compute/src/V1/ListErrorsInstanceGroupManagersRequest.php +++ b/Compute/src/V1/ListErrorsInstanceGroupManagersRequest.php @@ -20,49 +20,49 @@ class ListErrorsInstanceGroupManagersRequest extends \Google\Protobuf\Internal\M * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The name of the managed instance group. It must be a string that meets the requirements in RFC1035, or an unsigned long integer: must match regexp pattern: (?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?)|1-9{0,19}. * * Generated from protobuf field string instance_group_manager = 249363395 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group_manager = ''; + protected $instance_group_manager = ''; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * The name of the zone where the managed instance group is located. It should conform to RFC1035. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListErrorsRegionInstanceGroupManagersRequest.php b/Compute/src/V1/ListErrorsRegionInstanceGroupManagersRequest.php index 88048ae00806..50f23400d350 100644 --- a/Compute/src/V1/ListErrorsRegionInstanceGroupManagersRequest.php +++ b/Compute/src/V1/ListErrorsRegionInstanceGroupManagersRequest.php @@ -20,49 +20,49 @@ class ListErrorsRegionInstanceGroupManagersRequest extends \Google\Protobuf\Inte * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The name of the managed instance group. It must be a string that meets the requirements in RFC1035, or an unsigned long integer: must match regexp pattern: (?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?)|1-9{0,19}. * * Generated from protobuf field string instance_group_manager = 249363395 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group_manager = ''; + protected $instance_group_manager = ''; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. This should conform to RFC1035. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListExternalVpnGatewaysRequest.php b/Compute/src/V1/ListExternalVpnGatewaysRequest.php index 8df82f860012..db77ca224c1a 100644 --- a/Compute/src/V1/ListExternalVpnGatewaysRequest.php +++ b/Compute/src/V1/ListExternalVpnGatewaysRequest.php @@ -20,37 +20,37 @@ class ListExternalVpnGatewaysRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListFirewallPoliciesRequest.php b/Compute/src/V1/ListFirewallPoliciesRequest.php index 4547f7a45b9b..760b8674d943 100644 --- a/Compute/src/V1/ListFirewallPoliciesRequest.php +++ b/Compute/src/V1/ListFirewallPoliciesRequest.php @@ -20,37 +20,37 @@ class ListFirewallPoliciesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Parent ID for this request. The ID can be either be "folders/[FOLDER_ID]" if the parent is a folder or "organizations/[ORGANIZATION_ID]" if the parent is an organization. * * Generated from protobuf field optional string parent_id = 459714768; */ - private $parent_id = null; + protected $parent_id = null; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * Constructor. diff --git a/Compute/src/V1/ListFirewallsRequest.php b/Compute/src/V1/ListFirewallsRequest.php index 9112e46ac3ee..0799c237ce71 100644 --- a/Compute/src/V1/ListFirewallsRequest.php +++ b/Compute/src/V1/ListFirewallsRequest.php @@ -20,37 +20,37 @@ class ListFirewallsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListForwardingRulesRequest.php b/Compute/src/V1/ListForwardingRulesRequest.php index 11acaf1f5590..1ba7dd7a13c7 100644 --- a/Compute/src/V1/ListForwardingRulesRequest.php +++ b/Compute/src/V1/ListForwardingRulesRequest.php @@ -20,43 +20,43 @@ class ListForwardingRulesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListGlobalAddressesRequest.php b/Compute/src/V1/ListGlobalAddressesRequest.php index 8fd85278f04d..cc2513d3798c 100644 --- a/Compute/src/V1/ListGlobalAddressesRequest.php +++ b/Compute/src/V1/ListGlobalAddressesRequest.php @@ -20,37 +20,37 @@ class ListGlobalAddressesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListGlobalForwardingRulesRequest.php b/Compute/src/V1/ListGlobalForwardingRulesRequest.php index ea9de5003e78..e804e31b6ff2 100644 --- a/Compute/src/V1/ListGlobalForwardingRulesRequest.php +++ b/Compute/src/V1/ListGlobalForwardingRulesRequest.php @@ -20,37 +20,37 @@ class ListGlobalForwardingRulesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListGlobalNetworkEndpointGroupsRequest.php b/Compute/src/V1/ListGlobalNetworkEndpointGroupsRequest.php index 9db5542cab43..a69a715d4fa6 100644 --- a/Compute/src/V1/ListGlobalNetworkEndpointGroupsRequest.php +++ b/Compute/src/V1/ListGlobalNetworkEndpointGroupsRequest.php @@ -20,37 +20,37 @@ class ListGlobalNetworkEndpointGroupsRequest extends \Google\Protobuf\Internal\M * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListGlobalOperationsRequest.php b/Compute/src/V1/ListGlobalOperationsRequest.php index d849cb1a0ba9..e8d28ecf8298 100644 --- a/Compute/src/V1/ListGlobalOperationsRequest.php +++ b/Compute/src/V1/ListGlobalOperationsRequest.php @@ -20,37 +20,37 @@ class ListGlobalOperationsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListGlobalOrganizationOperationsRequest.php b/Compute/src/V1/ListGlobalOrganizationOperationsRequest.php index a12854e809d1..27eb17ea00c1 100644 --- a/Compute/src/V1/ListGlobalOrganizationOperationsRequest.php +++ b/Compute/src/V1/ListGlobalOrganizationOperationsRequest.php @@ -20,37 +20,37 @@ class ListGlobalOrganizationOperationsRequest extends \Google\Protobuf\Internal\ * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Parent ID for this request. * * Generated from protobuf field optional string parent_id = 459714768; */ - private $parent_id = null; + protected $parent_id = null; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * Constructor. diff --git a/Compute/src/V1/ListGlobalPublicDelegatedPrefixesRequest.php b/Compute/src/V1/ListGlobalPublicDelegatedPrefixesRequest.php index 73c3bac150c8..ffe88dd042a8 100644 --- a/Compute/src/V1/ListGlobalPublicDelegatedPrefixesRequest.php +++ b/Compute/src/V1/ListGlobalPublicDelegatedPrefixesRequest.php @@ -20,37 +20,37 @@ class ListGlobalPublicDelegatedPrefixesRequest extends \Google\Protobuf\Internal * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListHealthChecksRequest.php b/Compute/src/V1/ListHealthChecksRequest.php index 8fc01a8bc1ae..70801cb8bbb9 100644 --- a/Compute/src/V1/ListHealthChecksRequest.php +++ b/Compute/src/V1/ListHealthChecksRequest.php @@ -20,37 +20,37 @@ class ListHealthChecksRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListImagesRequest.php b/Compute/src/V1/ListImagesRequest.php index 3af1b930792e..667a8affff17 100644 --- a/Compute/src/V1/ListImagesRequest.php +++ b/Compute/src/V1/ListImagesRequest.php @@ -20,37 +20,37 @@ class ListImagesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListInstanceGroupManagerResizeRequestsRequest.php b/Compute/src/V1/ListInstanceGroupManagerResizeRequestsRequest.php index 6ff30e73a3dc..48e48be47d2b 100644 --- a/Compute/src/V1/ListInstanceGroupManagerResizeRequestsRequest.php +++ b/Compute/src/V1/ListInstanceGroupManagerResizeRequestsRequest.php @@ -20,49 +20,49 @@ class ListInstanceGroupManagerResizeRequestsRequest extends \Google\Protobuf\Int * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The name of the managed instance group. The name should conform to RFC1035. * * Generated from protobuf field string instance_group_manager = 249363395 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group_manager = ''; + protected $instance_group_manager = ''; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * The name of the zone where the managed instance group is located. The name should conform to RFC1035. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListInstanceGroupManagersRequest.php b/Compute/src/V1/ListInstanceGroupManagersRequest.php index 36997cbb87fb..737d68ab7e9f 100644 --- a/Compute/src/V1/ListInstanceGroupManagersRequest.php +++ b/Compute/src/V1/ListInstanceGroupManagersRequest.php @@ -20,43 +20,43 @@ class ListInstanceGroupManagersRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * The name of the zone where the managed instance group is located. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListInstanceGroupsRequest.php b/Compute/src/V1/ListInstanceGroupsRequest.php index 670d3ce57fbd..117824f3b3ba 100644 --- a/Compute/src/V1/ListInstanceGroupsRequest.php +++ b/Compute/src/V1/ListInstanceGroupsRequest.php @@ -20,43 +20,43 @@ class ListInstanceGroupsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * The name of the zone where the instance group is located. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListInstanceTemplatesRequest.php b/Compute/src/V1/ListInstanceTemplatesRequest.php index e8b1f8f04a9c..c78396944faf 100644 --- a/Compute/src/V1/ListInstanceTemplatesRequest.php +++ b/Compute/src/V1/ListInstanceTemplatesRequest.php @@ -20,37 +20,37 @@ class ListInstanceTemplatesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListInstancesInstanceGroupsRequest.php b/Compute/src/V1/ListInstancesInstanceGroupsRequest.php index 3fd31980d859..6535930b3074 100644 --- a/Compute/src/V1/ListInstancesInstanceGroupsRequest.php +++ b/Compute/src/V1/ListInstancesInstanceGroupsRequest.php @@ -20,55 +20,55 @@ class ListInstancesInstanceGroupsRequest extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The name of the instance group from which you want to generate a list of included instances. * * Generated from protobuf field string instance_group = 81095253 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group = ''; + protected $instance_group = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.InstanceGroupsListInstancesRequest instance_groups_list_instances_request_resource = 476255263 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_groups_list_instances_request_resource = null; + protected $instance_groups_list_instances_request_resource = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * The name of the zone where the instance group is located. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListInstancesRegionInstanceGroupsRequest.php b/Compute/src/V1/ListInstancesRegionInstanceGroupsRequest.php index 12381e17b849..cc9291c2a0d1 100644 --- a/Compute/src/V1/ListInstancesRegionInstanceGroupsRequest.php +++ b/Compute/src/V1/ListInstancesRegionInstanceGroupsRequest.php @@ -20,55 +20,55 @@ class ListInstancesRegionInstanceGroupsRequest extends \Google\Protobuf\Internal * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * Name of the regional instance group for which we want to list the instances. * * Generated from protobuf field string instance_group = 81095253 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group = ''; + protected $instance_group = ''; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.RegionInstanceGroupsListInstancesRequest region_instance_groups_list_instances_request_resource = 48239828 [(.google.api.field_behavior) = REQUIRED]; */ - private $region_instance_groups_list_instances_request_resource = null; + protected $region_instance_groups_list_instances_request_resource = null; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListInstancesRequest.php b/Compute/src/V1/ListInstancesRequest.php index 711884b8dade..96831a1794e2 100644 --- a/Compute/src/V1/ListInstancesRequest.php +++ b/Compute/src/V1/ListInstancesRequest.php @@ -20,43 +20,43 @@ class ListInstancesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListInstantSnapshotsRequest.php b/Compute/src/V1/ListInstantSnapshotsRequest.php index cb2651009fbc..4dd5e4ec023c 100644 --- a/Compute/src/V1/ListInstantSnapshotsRequest.php +++ b/Compute/src/V1/ListInstantSnapshotsRequest.php @@ -20,43 +20,43 @@ class ListInstantSnapshotsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListInterconnectAttachmentGroupsRequest.php b/Compute/src/V1/ListInterconnectAttachmentGroupsRequest.php index 27830837009d..d12772207030 100644 --- a/Compute/src/V1/ListInterconnectAttachmentGroupsRequest.php +++ b/Compute/src/V1/ListInterconnectAttachmentGroupsRequest.php @@ -20,37 +20,37 @@ class ListInterconnectAttachmentGroupsRequest extends \Google\Protobuf\Internal\ * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListInterconnectAttachmentsRequest.php b/Compute/src/V1/ListInterconnectAttachmentsRequest.php index 72948d6dcfc0..d359167ce977 100644 --- a/Compute/src/V1/ListInterconnectAttachmentsRequest.php +++ b/Compute/src/V1/ListInterconnectAttachmentsRequest.php @@ -20,43 +20,43 @@ class ListInterconnectAttachmentsRequest extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListInterconnectGroupsRequest.php b/Compute/src/V1/ListInterconnectGroupsRequest.php index 8b02fd3d642c..5d914aee6344 100644 --- a/Compute/src/V1/ListInterconnectGroupsRequest.php +++ b/Compute/src/V1/ListInterconnectGroupsRequest.php @@ -20,37 +20,37 @@ class ListInterconnectGroupsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListInterconnectLocationsRequest.php b/Compute/src/V1/ListInterconnectLocationsRequest.php index 67ba20141b0f..b6c0762f167d 100644 --- a/Compute/src/V1/ListInterconnectLocationsRequest.php +++ b/Compute/src/V1/ListInterconnectLocationsRequest.php @@ -20,37 +20,37 @@ class ListInterconnectLocationsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListInterconnectRemoteLocationsRequest.php b/Compute/src/V1/ListInterconnectRemoteLocationsRequest.php index 73fe4b4077e9..f25d40521b88 100644 --- a/Compute/src/V1/ListInterconnectRemoteLocationsRequest.php +++ b/Compute/src/V1/ListInterconnectRemoteLocationsRequest.php @@ -20,37 +20,37 @@ class ListInterconnectRemoteLocationsRequest extends \Google\Protobuf\Internal\M * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListInterconnectsRequest.php b/Compute/src/V1/ListInterconnectsRequest.php index 79e2ae01e3fc..47c06928bc77 100644 --- a/Compute/src/V1/ListInterconnectsRequest.php +++ b/Compute/src/V1/ListInterconnectsRequest.php @@ -20,37 +20,37 @@ class ListInterconnectsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListLicensesRequest.php b/Compute/src/V1/ListLicensesRequest.php index 550b269ea1a4..53f2618a69ce 100644 --- a/Compute/src/V1/ListLicensesRequest.php +++ b/Compute/src/V1/ListLicensesRequest.php @@ -20,37 +20,37 @@ class ListLicensesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListMachineImagesRequest.php b/Compute/src/V1/ListMachineImagesRequest.php index fca7376a9e19..466c80b452f8 100644 --- a/Compute/src/V1/ListMachineImagesRequest.php +++ b/Compute/src/V1/ListMachineImagesRequest.php @@ -20,37 +20,37 @@ class ListMachineImagesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListMachineTypesRequest.php b/Compute/src/V1/ListMachineTypesRequest.php index d2611f85b365..5f7c044fd729 100644 --- a/Compute/src/V1/ListMachineTypesRequest.php +++ b/Compute/src/V1/ListMachineTypesRequest.php @@ -20,43 +20,43 @@ class ListMachineTypesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListManagedInstancesInstanceGroupManagersRequest.php b/Compute/src/V1/ListManagedInstancesInstanceGroupManagersRequest.php index 36bc0f8159ec..b951a55c6874 100644 --- a/Compute/src/V1/ListManagedInstancesInstanceGroupManagersRequest.php +++ b/Compute/src/V1/ListManagedInstancesInstanceGroupManagersRequest.php @@ -20,49 +20,49 @@ class ListManagedInstancesInstanceGroupManagersRequest extends \Google\Protobuf\ * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The name of the managed instance group. * * Generated from protobuf field string instance_group_manager = 249363395 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group_manager = ''; + protected $instance_group_manager = ''; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * The name of the zone where the managed instance group is located. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListManagedInstancesRegionInstanceGroupManagersRequest.php b/Compute/src/V1/ListManagedInstancesRegionInstanceGroupManagersRequest.php index daeb5de790cc..3a1ea5c19484 100644 --- a/Compute/src/V1/ListManagedInstancesRegionInstanceGroupManagersRequest.php +++ b/Compute/src/V1/ListManagedInstancesRegionInstanceGroupManagersRequest.php @@ -20,49 +20,49 @@ class ListManagedInstancesRegionInstanceGroupManagersRequest extends \Google\Pro * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The name of the managed instance group. * * Generated from protobuf field string instance_group_manager = 249363395 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group_manager = ''; + protected $instance_group_manager = ''; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListNetworkAttachmentsRequest.php b/Compute/src/V1/ListNetworkAttachmentsRequest.php index 88888745ec02..10aca8092a60 100644 --- a/Compute/src/V1/ListNetworkAttachmentsRequest.php +++ b/Compute/src/V1/ListNetworkAttachmentsRequest.php @@ -20,43 +20,43 @@ class ListNetworkAttachmentsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region of this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListNetworkEndpointGroupsRequest.php b/Compute/src/V1/ListNetworkEndpointGroupsRequest.php index ba9386519992..db4b5e86cdfa 100644 --- a/Compute/src/V1/ListNetworkEndpointGroupsRequest.php +++ b/Compute/src/V1/ListNetworkEndpointGroupsRequest.php @@ -20,43 +20,43 @@ class ListNetworkEndpointGroupsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * The name of the zone where the network endpoint group is located. It should comply with RFC1035. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListNetworkEndpointsGlobalNetworkEndpointGroupsRequest.php b/Compute/src/V1/ListNetworkEndpointsGlobalNetworkEndpointGroupsRequest.php index d7e1320a86ac..b970f278b22c 100644 --- a/Compute/src/V1/ListNetworkEndpointsGlobalNetworkEndpointGroupsRequest.php +++ b/Compute/src/V1/ListNetworkEndpointsGlobalNetworkEndpointGroupsRequest.php @@ -20,43 +20,43 @@ class ListNetworkEndpointsGlobalNetworkEndpointGroupsRequest extends \Google\Pro * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * The name of the network endpoint group from which you want to generate a list of included network endpoints. It should comply with RFC1035. * * Generated from protobuf field string network_endpoint_group = 433907078 [(.google.api.field_behavior) = REQUIRED]; */ - private $network_endpoint_group = ''; + protected $network_endpoint_group = ''; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListNetworkEndpointsNetworkEndpointGroupsRequest.php b/Compute/src/V1/ListNetworkEndpointsNetworkEndpointGroupsRequest.php index 9142df31aabf..c59430ca6c58 100644 --- a/Compute/src/V1/ListNetworkEndpointsNetworkEndpointGroupsRequest.php +++ b/Compute/src/V1/ListNetworkEndpointsNetworkEndpointGroupsRequest.php @@ -20,55 +20,55 @@ class ListNetworkEndpointsNetworkEndpointGroupsRequest extends \Google\Protobuf\ * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * The name of the network endpoint group from which you want to generate a list of included network endpoints. It should comply with RFC1035. * * Generated from protobuf field string network_endpoint_group = 433907078 [(.google.api.field_behavior) = REQUIRED]; */ - private $network_endpoint_group = ''; + protected $network_endpoint_group = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.NetworkEndpointGroupsListEndpointsRequest network_endpoint_groups_list_endpoints_request_resource = 59493390 [(.google.api.field_behavior) = REQUIRED]; */ - private $network_endpoint_groups_list_endpoints_request_resource = null; + protected $network_endpoint_groups_list_endpoints_request_resource = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * The name of the zone where the network endpoint group is located. It should comply with RFC1035. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListNetworkEndpointsRegionNetworkEndpointGroupsRequest.php b/Compute/src/V1/ListNetworkEndpointsRegionNetworkEndpointGroupsRequest.php index c81d604f53db..ba1f50c3a5ee 100644 --- a/Compute/src/V1/ListNetworkEndpointsRegionNetworkEndpointGroupsRequest.php +++ b/Compute/src/V1/ListNetworkEndpointsRegionNetworkEndpointGroupsRequest.php @@ -20,49 +20,49 @@ class ListNetworkEndpointsRegionNetworkEndpointGroupsRequest extends \Google\Pro * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * The name of the network endpoint group from which you want to generate a list of included network endpoints. It should comply with RFC1035. * * Generated from protobuf field string network_endpoint_group = 433907078 [(.google.api.field_behavior) = REQUIRED]; */ - private $network_endpoint_group = ''; + protected $network_endpoint_group = ''; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * The name of the region where the network endpoint group is located. It should comply with RFC1035. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListNetworkFirewallPoliciesRequest.php b/Compute/src/V1/ListNetworkFirewallPoliciesRequest.php index b9bdc75be0f9..986c27084bec 100644 --- a/Compute/src/V1/ListNetworkFirewallPoliciesRequest.php +++ b/Compute/src/V1/ListNetworkFirewallPoliciesRequest.php @@ -20,37 +20,37 @@ class ListNetworkFirewallPoliciesRequest extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListNetworkProfilesRequest.php b/Compute/src/V1/ListNetworkProfilesRequest.php index 7659feaa5900..48833fae6b18 100644 --- a/Compute/src/V1/ListNetworkProfilesRequest.php +++ b/Compute/src/V1/ListNetworkProfilesRequest.php @@ -20,37 +20,37 @@ class ListNetworkProfilesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListNetworksRequest.php b/Compute/src/V1/ListNetworksRequest.php index b0ebc01abc18..39aa0e53e1d9 100644 --- a/Compute/src/V1/ListNetworksRequest.php +++ b/Compute/src/V1/ListNetworksRequest.php @@ -20,37 +20,37 @@ class ListNetworksRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListNodeGroupsRequest.php b/Compute/src/V1/ListNodeGroupsRequest.php index 5db00ffc43e5..1ad30681e36b 100644 --- a/Compute/src/V1/ListNodeGroupsRequest.php +++ b/Compute/src/V1/ListNodeGroupsRequest.php @@ -20,43 +20,43 @@ class ListNodeGroupsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListNodeTemplatesRequest.php b/Compute/src/V1/ListNodeTemplatesRequest.php index 0b4758bc07f7..baea0e87ecd6 100644 --- a/Compute/src/V1/ListNodeTemplatesRequest.php +++ b/Compute/src/V1/ListNodeTemplatesRequest.php @@ -20,43 +20,43 @@ class ListNodeTemplatesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * The name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListNodeTypesRequest.php b/Compute/src/V1/ListNodeTypesRequest.php index fb68cd7f9e74..b8142ecf3112 100644 --- a/Compute/src/V1/ListNodeTypesRequest.php +++ b/Compute/src/V1/ListNodeTypesRequest.php @@ -20,43 +20,43 @@ class ListNodeTypesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListNodesNodeGroupsRequest.php b/Compute/src/V1/ListNodesNodeGroupsRequest.php index 51fcdc520625..1c6401b781d4 100644 --- a/Compute/src/V1/ListNodesNodeGroupsRequest.php +++ b/Compute/src/V1/ListNodesNodeGroupsRequest.php @@ -20,49 +20,49 @@ class ListNodesNodeGroupsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Name of the NodeGroup resource whose nodes you want to list. * * Generated from protobuf field string node_group = 469958146 [(.google.api.field_behavior) = REQUIRED]; */ - private $node_group = ''; + protected $node_group = ''; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListPacketMirroringsRequest.php b/Compute/src/V1/ListPacketMirroringsRequest.php index 23d52215ca67..b30deb82c186 100644 --- a/Compute/src/V1/ListPacketMirroringsRequest.php +++ b/Compute/src/V1/ListPacketMirroringsRequest.php @@ -20,43 +20,43 @@ class ListPacketMirroringsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListPeeringRoutesNetworksRequest.php b/Compute/src/V1/ListPeeringRoutesNetworksRequest.php index 2ee1b3318c32..ea21682f5935 100644 --- a/Compute/src/V1/ListPeeringRoutesNetworksRequest.php +++ b/Compute/src/V1/ListPeeringRoutesNetworksRequest.php @@ -21,61 +21,61 @@ class ListPeeringRoutesNetworksRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string direction = 111150975; */ - private $direction = null; + protected $direction = null; /** * A filter expression that filters resources listed in the response. Most Compute resources support two types of filter expressions: expressions that support regular expressions and expressions that follow API improvement proposal AIP-160. These two types of filter expressions cannot be mixed in one request. If you want to use AIP-160, your expression must specify the field name, an operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. The `:*` comparison can be used to test whether a key has been defined. For example, to find all objects with `owner` label use: ``` labels.owner:* ``` You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` If you want to use a regular expression, use the `eq` (equal) or `ne` (not equal) operator against a single un-parenthesized expression with or without quotes or against multiple parenthesized expressions. Examples: `fieldname eq unquoted literal` `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"` `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is interpreted as a regular expression using Google RE2 library syntax. The literal value must match the entire field. For example, to filter for instances that do not end with name "instance", you would use `name ne .*instance`. You cannot combine constraints on multiple fields using regular expressions. * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Name of the network for this request. * * Generated from protobuf field string network = 232872494 [(.google.api.field_behavior) = REQUIRED]; */ - private $network = ''; + protected $network = ''; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * The response will show routes exchanged over the given peering connection. * * Generated from protobuf field optional string peering_name = 249571370; */ - private $peering_name = null; + protected $peering_name = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * The region of the request. The response will include all subnet routes, static routes and dynamic routes in the region. * * Generated from protobuf field optional string region = 138946292; */ - private $region = null; + protected $region = null; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListPerInstanceConfigsInstanceGroupManagersRequest.php b/Compute/src/V1/ListPerInstanceConfigsInstanceGroupManagersRequest.php index 88878ce3a7e3..a4da68ebf6be 100644 --- a/Compute/src/V1/ListPerInstanceConfigsInstanceGroupManagersRequest.php +++ b/Compute/src/V1/ListPerInstanceConfigsInstanceGroupManagersRequest.php @@ -20,49 +20,49 @@ class ListPerInstanceConfigsInstanceGroupManagersRequest extends \Google\Protobu * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The name of the managed instance group. It should conform to RFC1035. * * Generated from protobuf field string instance_group_manager = 249363395 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group_manager = ''; + protected $instance_group_manager = ''; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * The name of the zone where the managed instance group is located. It should conform to RFC1035. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListPerInstanceConfigsRegionInstanceGroupManagersRequest.php b/Compute/src/V1/ListPerInstanceConfigsRegionInstanceGroupManagersRequest.php index a092968ab206..f22324e5d69e 100644 --- a/Compute/src/V1/ListPerInstanceConfigsRegionInstanceGroupManagersRequest.php +++ b/Compute/src/V1/ListPerInstanceConfigsRegionInstanceGroupManagersRequest.php @@ -20,49 +20,49 @@ class ListPerInstanceConfigsRegionInstanceGroupManagersRequest extends \Google\P * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The name of the managed instance group. It should conform to RFC1035. * * Generated from protobuf field string instance_group_manager = 249363395 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group_manager = ''; + protected $instance_group_manager = ''; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request, should conform to RFC1035. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListPreconfiguredExpressionSetsSecurityPoliciesRequest.php b/Compute/src/V1/ListPreconfiguredExpressionSetsSecurityPoliciesRequest.php index 8f41e3162572..dc3e536f13fb 100644 --- a/Compute/src/V1/ListPreconfiguredExpressionSetsSecurityPoliciesRequest.php +++ b/Compute/src/V1/ListPreconfiguredExpressionSetsSecurityPoliciesRequest.php @@ -20,37 +20,37 @@ class ListPreconfiguredExpressionSetsSecurityPoliciesRequest extends \Google\Pro * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListPublicAdvertisedPrefixesRequest.php b/Compute/src/V1/ListPublicAdvertisedPrefixesRequest.php index 165239f1fca7..5b3464cb0194 100644 --- a/Compute/src/V1/ListPublicAdvertisedPrefixesRequest.php +++ b/Compute/src/V1/ListPublicAdvertisedPrefixesRequest.php @@ -20,37 +20,37 @@ class ListPublicAdvertisedPrefixesRequest extends \Google\Protobuf\Internal\Mess * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListPublicDelegatedPrefixesRequest.php b/Compute/src/V1/ListPublicDelegatedPrefixesRequest.php index f26911b20fdd..3212d31313d9 100644 --- a/Compute/src/V1/ListPublicDelegatedPrefixesRequest.php +++ b/Compute/src/V1/ListPublicDelegatedPrefixesRequest.php @@ -20,43 +20,43 @@ class ListPublicDelegatedPrefixesRequest extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region of this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListReferrersInstancesRequest.php b/Compute/src/V1/ListReferrersInstancesRequest.php index 5a0db300ca8f..a49bf6580a1d 100644 --- a/Compute/src/V1/ListReferrersInstancesRequest.php +++ b/Compute/src/V1/ListReferrersInstancesRequest.php @@ -20,49 +20,49 @@ class ListReferrersInstancesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * Name of the target instance scoping this request, or '-' if the request should span over all instances in the container. * * Generated from protobuf field string instance = 18257045 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance = ''; + protected $instance = ''; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListRegionAutoscalersRequest.php b/Compute/src/V1/ListRegionAutoscalersRequest.php index 0826909de8da..b8f15dc5e4e4 100644 --- a/Compute/src/V1/ListRegionAutoscalersRequest.php +++ b/Compute/src/V1/ListRegionAutoscalersRequest.php @@ -20,43 +20,43 @@ class ListRegionAutoscalersRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListRegionBackendServicesRequest.php b/Compute/src/V1/ListRegionBackendServicesRequest.php index 948e898d0e2c..e5c342c400e5 100644 --- a/Compute/src/V1/ListRegionBackendServicesRequest.php +++ b/Compute/src/V1/ListRegionBackendServicesRequest.php @@ -20,43 +20,43 @@ class ListRegionBackendServicesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListRegionCommitmentsRequest.php b/Compute/src/V1/ListRegionCommitmentsRequest.php index f213da4860ea..ca4362086407 100644 --- a/Compute/src/V1/ListRegionCommitmentsRequest.php +++ b/Compute/src/V1/ListRegionCommitmentsRequest.php @@ -20,43 +20,43 @@ class ListRegionCommitmentsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListRegionDiskTypesRequest.php b/Compute/src/V1/ListRegionDiskTypesRequest.php index e610c49e66d4..a73ee89c0ab3 100644 --- a/Compute/src/V1/ListRegionDiskTypesRequest.php +++ b/Compute/src/V1/ListRegionDiskTypesRequest.php @@ -20,43 +20,43 @@ class ListRegionDiskTypesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * The name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListRegionDisksRequest.php b/Compute/src/V1/ListRegionDisksRequest.php index 56fd587d3afc..cfe0c8cd6023 100644 --- a/Compute/src/V1/ListRegionDisksRequest.php +++ b/Compute/src/V1/ListRegionDisksRequest.php @@ -20,43 +20,43 @@ class ListRegionDisksRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListRegionHealthCheckServicesRequest.php b/Compute/src/V1/ListRegionHealthCheckServicesRequest.php index 13ab5f503aa4..01c06176a646 100644 --- a/Compute/src/V1/ListRegionHealthCheckServicesRequest.php +++ b/Compute/src/V1/ListRegionHealthCheckServicesRequest.php @@ -20,43 +20,43 @@ class ListRegionHealthCheckServicesRequest extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListRegionHealthChecksRequest.php b/Compute/src/V1/ListRegionHealthChecksRequest.php index 7eaf7bd2bf33..d4ba6aeebb9b 100644 --- a/Compute/src/V1/ListRegionHealthChecksRequest.php +++ b/Compute/src/V1/ListRegionHealthChecksRequest.php @@ -20,43 +20,43 @@ class ListRegionHealthChecksRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListRegionInstanceGroupManagersRequest.php b/Compute/src/V1/ListRegionInstanceGroupManagersRequest.php index 3136af9128a0..5995f2ef465b 100644 --- a/Compute/src/V1/ListRegionInstanceGroupManagersRequest.php +++ b/Compute/src/V1/ListRegionInstanceGroupManagersRequest.php @@ -20,43 +20,43 @@ class ListRegionInstanceGroupManagersRequest extends \Google\Protobuf\Internal\M * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListRegionInstanceGroupsRequest.php b/Compute/src/V1/ListRegionInstanceGroupsRequest.php index 79d60341ff6f..e5f44af5d0f4 100644 --- a/Compute/src/V1/ListRegionInstanceGroupsRequest.php +++ b/Compute/src/V1/ListRegionInstanceGroupsRequest.php @@ -20,43 +20,43 @@ class ListRegionInstanceGroupsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListRegionInstanceTemplatesRequest.php b/Compute/src/V1/ListRegionInstanceTemplatesRequest.php index 6b339e1f1e17..81f48b3f0fe4 100644 --- a/Compute/src/V1/ListRegionInstanceTemplatesRequest.php +++ b/Compute/src/V1/ListRegionInstanceTemplatesRequest.php @@ -20,43 +20,43 @@ class ListRegionInstanceTemplatesRequest extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * The name of the regions for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListRegionInstantSnapshotsRequest.php b/Compute/src/V1/ListRegionInstantSnapshotsRequest.php index 6cfbbb1c6727..0938b406667d 100644 --- a/Compute/src/V1/ListRegionInstantSnapshotsRequest.php +++ b/Compute/src/V1/ListRegionInstantSnapshotsRequest.php @@ -20,43 +20,43 @@ class ListRegionInstantSnapshotsRequest extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * The name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListRegionNetworkEndpointGroupsRequest.php b/Compute/src/V1/ListRegionNetworkEndpointGroupsRequest.php index eaf4ee8634d0..a6c6c3f78ee9 100644 --- a/Compute/src/V1/ListRegionNetworkEndpointGroupsRequest.php +++ b/Compute/src/V1/ListRegionNetworkEndpointGroupsRequest.php @@ -20,43 +20,43 @@ class ListRegionNetworkEndpointGroupsRequest extends \Google\Protobuf\Internal\M * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * The name of the region where the network endpoint group is located. It should comply with RFC1035. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListRegionNetworkFirewallPoliciesRequest.php b/Compute/src/V1/ListRegionNetworkFirewallPoliciesRequest.php index b8e7817c6275..5004e5a88ac5 100644 --- a/Compute/src/V1/ListRegionNetworkFirewallPoliciesRequest.php +++ b/Compute/src/V1/ListRegionNetworkFirewallPoliciesRequest.php @@ -20,43 +20,43 @@ class ListRegionNetworkFirewallPoliciesRequest extends \Google\Protobuf\Internal * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListRegionNotificationEndpointsRequest.php b/Compute/src/V1/ListRegionNotificationEndpointsRequest.php index be2958d14cf9..3c3c86333ba8 100644 --- a/Compute/src/V1/ListRegionNotificationEndpointsRequest.php +++ b/Compute/src/V1/ListRegionNotificationEndpointsRequest.php @@ -20,43 +20,43 @@ class ListRegionNotificationEndpointsRequest extends \Google\Protobuf\Internal\M * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListRegionOperationsRequest.php b/Compute/src/V1/ListRegionOperationsRequest.php index a18b9c7bfdb8..af55a58032e7 100644 --- a/Compute/src/V1/ListRegionOperationsRequest.php +++ b/Compute/src/V1/ListRegionOperationsRequest.php @@ -20,43 +20,43 @@ class ListRegionOperationsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListRegionSecurityPoliciesRequest.php b/Compute/src/V1/ListRegionSecurityPoliciesRequest.php index aad4f6750dd6..21ee41641241 100644 --- a/Compute/src/V1/ListRegionSecurityPoliciesRequest.php +++ b/Compute/src/V1/ListRegionSecurityPoliciesRequest.php @@ -20,43 +20,43 @@ class ListRegionSecurityPoliciesRequest extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListRegionSslCertificatesRequest.php b/Compute/src/V1/ListRegionSslCertificatesRequest.php index ab40a3b3ea30..c735791ddc27 100644 --- a/Compute/src/V1/ListRegionSslCertificatesRequest.php +++ b/Compute/src/V1/ListRegionSslCertificatesRequest.php @@ -20,43 +20,43 @@ class ListRegionSslCertificatesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListRegionSslPoliciesRequest.php b/Compute/src/V1/ListRegionSslPoliciesRequest.php index dd0c072d6fa8..c015a934c39d 100644 --- a/Compute/src/V1/ListRegionSslPoliciesRequest.php +++ b/Compute/src/V1/ListRegionSslPoliciesRequest.php @@ -20,43 +20,43 @@ class ListRegionSslPoliciesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListRegionTargetHttpProxiesRequest.php b/Compute/src/V1/ListRegionTargetHttpProxiesRequest.php index bcca83f4801d..27b97bbda890 100644 --- a/Compute/src/V1/ListRegionTargetHttpProxiesRequest.php +++ b/Compute/src/V1/ListRegionTargetHttpProxiesRequest.php @@ -20,43 +20,43 @@ class ListRegionTargetHttpProxiesRequest extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListRegionTargetHttpsProxiesRequest.php b/Compute/src/V1/ListRegionTargetHttpsProxiesRequest.php index 7fdadcfcf76d..7fb002d3983a 100644 --- a/Compute/src/V1/ListRegionTargetHttpsProxiesRequest.php +++ b/Compute/src/V1/ListRegionTargetHttpsProxiesRequest.php @@ -20,43 +20,43 @@ class ListRegionTargetHttpsProxiesRequest extends \Google\Protobuf\Internal\Mess * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListRegionTargetTcpProxiesRequest.php b/Compute/src/V1/ListRegionTargetTcpProxiesRequest.php index aeb1d7a0e8e0..726637e34eef 100644 --- a/Compute/src/V1/ListRegionTargetTcpProxiesRequest.php +++ b/Compute/src/V1/ListRegionTargetTcpProxiesRequest.php @@ -20,43 +20,43 @@ class ListRegionTargetTcpProxiesRequest extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListRegionUrlMapsRequest.php b/Compute/src/V1/ListRegionUrlMapsRequest.php index 1c1b8f9458c0..3bf359a0e1a4 100644 --- a/Compute/src/V1/ListRegionUrlMapsRequest.php +++ b/Compute/src/V1/ListRegionUrlMapsRequest.php @@ -20,43 +20,43 @@ class ListRegionUrlMapsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListRegionZonesRequest.php b/Compute/src/V1/ListRegionZonesRequest.php index cd8ebce6044f..a3ea570d9561 100644 --- a/Compute/src/V1/ListRegionZonesRequest.php +++ b/Compute/src/V1/ListRegionZonesRequest.php @@ -20,43 +20,43 @@ class ListRegionZonesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListRegionsRequest.php b/Compute/src/V1/ListRegionsRequest.php index 271677d677ea..ed9bbf043a27 100644 --- a/Compute/src/V1/ListRegionsRequest.php +++ b/Compute/src/V1/ListRegionsRequest.php @@ -20,37 +20,37 @@ class ListRegionsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListReservationBlocksRequest.php b/Compute/src/V1/ListReservationBlocksRequest.php index 154ae2326e09..f3fbb287efbd 100644 --- a/Compute/src/V1/ListReservationBlocksRequest.php +++ b/Compute/src/V1/ListReservationBlocksRequest.php @@ -20,49 +20,49 @@ class ListReservationBlocksRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * The name of the reservation. Name should conform to RFC1035 or be a resource ID. * * Generated from protobuf field string reservation = 47530956 [(.google.api.field_behavior) = REQUIRED]; */ - private $reservation = ''; + protected $reservation = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * Name of the zone for this request. Zone name should conform to RFC1035. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListReservationSubBlocksRequest.php b/Compute/src/V1/ListReservationSubBlocksRequest.php index b59a1cc86075..dbaf6ff0dc51 100644 --- a/Compute/src/V1/ListReservationSubBlocksRequest.php +++ b/Compute/src/V1/ListReservationSubBlocksRequest.php @@ -20,49 +20,49 @@ class ListReservationSubBlocksRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * The name of the parent reservation and parent block. In the format of reservations/{reservation_name}/reservationBlocks/{reservation_block_name} * * Generated from protobuf field string parent_name = 478151936 [(.google.api.field_behavior) = REQUIRED]; */ - private $parent_name = ''; + protected $parent_name = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * Name of the zone for this request. Zone name should conform to RFC1035. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListReservationsRequest.php b/Compute/src/V1/ListReservationsRequest.php index 42b5f5aae8a6..7b83d9d0bd1c 100644 --- a/Compute/src/V1/ListReservationsRequest.php +++ b/Compute/src/V1/ListReservationsRequest.php @@ -20,43 +20,43 @@ class ListReservationsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * Name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListResourcePoliciesRequest.php b/Compute/src/V1/ListResourcePoliciesRequest.php index 3c5e94cc460e..f88a19617577 100644 --- a/Compute/src/V1/ListResourcePoliciesRequest.php +++ b/Compute/src/V1/ListResourcePoliciesRequest.php @@ -20,43 +20,43 @@ class ListResourcePoliciesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListRoutePoliciesRoutersRequest.php b/Compute/src/V1/ListRoutePoliciesRoutersRequest.php index 22e5cc7d79f4..392297563cdd 100644 --- a/Compute/src/V1/ListRoutePoliciesRoutersRequest.php +++ b/Compute/src/V1/ListRoutePoliciesRoutersRequest.php @@ -20,49 +20,49 @@ class ListRoutePoliciesRoutersRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * Name or id of the resource for this request. Name should conform to RFC1035. * * Generated from protobuf field string router = 148608841 [(.google.api.field_behavior) = REQUIRED]; */ - private $router = ''; + protected $router = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListRoutersRequest.php b/Compute/src/V1/ListRoutersRequest.php index 5ef1883d3598..c8ee80df82e9 100644 --- a/Compute/src/V1/ListRoutersRequest.php +++ b/Compute/src/V1/ListRoutersRequest.php @@ -20,43 +20,43 @@ class ListRoutersRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListRoutesRequest.php b/Compute/src/V1/ListRoutesRequest.php index 566b64bd1b89..c43a36598d23 100644 --- a/Compute/src/V1/ListRoutesRequest.php +++ b/Compute/src/V1/ListRoutesRequest.php @@ -20,37 +20,37 @@ class ListRoutesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListSecurityPoliciesRequest.php b/Compute/src/V1/ListSecurityPoliciesRequest.php index 4d2e6347d96a..3cbc09205eb8 100644 --- a/Compute/src/V1/ListSecurityPoliciesRequest.php +++ b/Compute/src/V1/ListSecurityPoliciesRequest.php @@ -20,37 +20,37 @@ class ListSecurityPoliciesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListServiceAttachmentsRequest.php b/Compute/src/V1/ListServiceAttachmentsRequest.php index 38b86e286b55..7c85bc6f53f1 100644 --- a/Compute/src/V1/ListServiceAttachmentsRequest.php +++ b/Compute/src/V1/ListServiceAttachmentsRequest.php @@ -20,43 +20,43 @@ class ListServiceAttachmentsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region of this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListSnapshotsRequest.php b/Compute/src/V1/ListSnapshotsRequest.php index 2136f2699f22..ca61701d4f9c 100644 --- a/Compute/src/V1/ListSnapshotsRequest.php +++ b/Compute/src/V1/ListSnapshotsRequest.php @@ -20,37 +20,37 @@ class ListSnapshotsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListSslCertificatesRequest.php b/Compute/src/V1/ListSslCertificatesRequest.php index 2ad4a08f343b..abd9b6caf7ca 100644 --- a/Compute/src/V1/ListSslCertificatesRequest.php +++ b/Compute/src/V1/ListSslCertificatesRequest.php @@ -20,37 +20,37 @@ class ListSslCertificatesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListSslPoliciesRequest.php b/Compute/src/V1/ListSslPoliciesRequest.php index 5a9e34020706..f5cb2b4cf316 100644 --- a/Compute/src/V1/ListSslPoliciesRequest.php +++ b/Compute/src/V1/ListSslPoliciesRequest.php @@ -20,37 +20,37 @@ class ListSslPoliciesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListStoragePoolTypesRequest.php b/Compute/src/V1/ListStoragePoolTypesRequest.php index ac7e68627039..30059f2b667e 100644 --- a/Compute/src/V1/ListStoragePoolTypesRequest.php +++ b/Compute/src/V1/ListStoragePoolTypesRequest.php @@ -20,43 +20,43 @@ class ListStoragePoolTypesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListStoragePoolsRequest.php b/Compute/src/V1/ListStoragePoolsRequest.php index 575842de4f02..c509861733a6 100644 --- a/Compute/src/V1/ListStoragePoolsRequest.php +++ b/Compute/src/V1/ListStoragePoolsRequest.php @@ -20,43 +20,43 @@ class ListStoragePoolsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListSubnetworksRequest.php b/Compute/src/V1/ListSubnetworksRequest.php index f2ec7765ecbc..2ff2aa735d74 100644 --- a/Compute/src/V1/ListSubnetworksRequest.php +++ b/Compute/src/V1/ListSubnetworksRequest.php @@ -20,43 +20,43 @@ class ListSubnetworksRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListTargetGrpcProxiesRequest.php b/Compute/src/V1/ListTargetGrpcProxiesRequest.php index 5ff081a9cc37..04fa1d142e50 100644 --- a/Compute/src/V1/ListTargetGrpcProxiesRequest.php +++ b/Compute/src/V1/ListTargetGrpcProxiesRequest.php @@ -20,37 +20,37 @@ class ListTargetGrpcProxiesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListTargetHttpProxiesRequest.php b/Compute/src/V1/ListTargetHttpProxiesRequest.php index ecd59bd2a3eb..b68b8e1b0920 100644 --- a/Compute/src/V1/ListTargetHttpProxiesRequest.php +++ b/Compute/src/V1/ListTargetHttpProxiesRequest.php @@ -20,37 +20,37 @@ class ListTargetHttpProxiesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListTargetHttpsProxiesRequest.php b/Compute/src/V1/ListTargetHttpsProxiesRequest.php index 547be3ca056b..837c13efc9bb 100644 --- a/Compute/src/V1/ListTargetHttpsProxiesRequest.php +++ b/Compute/src/V1/ListTargetHttpsProxiesRequest.php @@ -20,37 +20,37 @@ class ListTargetHttpsProxiesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListTargetInstancesRequest.php b/Compute/src/V1/ListTargetInstancesRequest.php index 503f64e7094a..aab9d93e9064 100644 --- a/Compute/src/V1/ListTargetInstancesRequest.php +++ b/Compute/src/V1/ListTargetInstancesRequest.php @@ -20,43 +20,43 @@ class ListTargetInstancesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * Name of the zone scoping this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListTargetPoolsRequest.php b/Compute/src/V1/ListTargetPoolsRequest.php index ab7af8d8998c..17078508d504 100644 --- a/Compute/src/V1/ListTargetPoolsRequest.php +++ b/Compute/src/V1/ListTargetPoolsRequest.php @@ -20,43 +20,43 @@ class ListTargetPoolsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListTargetSslProxiesRequest.php b/Compute/src/V1/ListTargetSslProxiesRequest.php index 4ed6e5bb8166..a23a676b1231 100644 --- a/Compute/src/V1/ListTargetSslProxiesRequest.php +++ b/Compute/src/V1/ListTargetSslProxiesRequest.php @@ -20,37 +20,37 @@ class ListTargetSslProxiesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListTargetTcpProxiesRequest.php b/Compute/src/V1/ListTargetTcpProxiesRequest.php index 3ab03586ab07..03b1be115703 100644 --- a/Compute/src/V1/ListTargetTcpProxiesRequest.php +++ b/Compute/src/V1/ListTargetTcpProxiesRequest.php @@ -20,37 +20,37 @@ class ListTargetTcpProxiesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListTargetVpnGatewaysRequest.php b/Compute/src/V1/ListTargetVpnGatewaysRequest.php index 4e153c47a991..aeff9329739b 100644 --- a/Compute/src/V1/ListTargetVpnGatewaysRequest.php +++ b/Compute/src/V1/ListTargetVpnGatewaysRequest.php @@ -20,43 +20,43 @@ class ListTargetVpnGatewaysRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListUrlMapsRequest.php b/Compute/src/V1/ListUrlMapsRequest.php index 7eed4b8ebad1..df34e7227dbe 100644 --- a/Compute/src/V1/ListUrlMapsRequest.php +++ b/Compute/src/V1/ListUrlMapsRequest.php @@ -20,37 +20,37 @@ class ListUrlMapsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListUsableBackendServicesRequest.php b/Compute/src/V1/ListUsableBackendServicesRequest.php index 0fbe5e188b5e..a279e5975cf5 100644 --- a/Compute/src/V1/ListUsableBackendServicesRequest.php +++ b/Compute/src/V1/ListUsableBackendServicesRequest.php @@ -20,37 +20,37 @@ class ListUsableBackendServicesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListUsableRegionBackendServicesRequest.php b/Compute/src/V1/ListUsableRegionBackendServicesRequest.php index 929f3e537473..53e0157a26a1 100644 --- a/Compute/src/V1/ListUsableRegionBackendServicesRequest.php +++ b/Compute/src/V1/ListUsableRegionBackendServicesRequest.php @@ -20,43 +20,43 @@ class ListUsableRegionBackendServicesRequest extends \Google\Protobuf\Internal\M * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. It must be a string that meets the requirements in RFC1035. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListUsableSubnetworksRequest.php b/Compute/src/V1/ListUsableSubnetworksRequest.php index d7f2edd7e6be..acc930ed4713 100644 --- a/Compute/src/V1/ListUsableSubnetworksRequest.php +++ b/Compute/src/V1/ListUsableSubnetworksRequest.php @@ -20,43 +20,43 @@ class ListUsableSubnetworksRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * The project id or project number in which the subnetwork is intended to be used. Only applied for Shared VPC. See [Shared VPC documentation](https://cloud.google.com/vpc/docs/shared-vpc/) * * Generated from protobuf field optional string service_project = 530592655; */ - private $service_project = null; + protected $service_project = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListVpnGatewaysRequest.php b/Compute/src/V1/ListVpnGatewaysRequest.php index 2476d3ab0e72..b1950cefe12a 100644 --- a/Compute/src/V1/ListVpnGatewaysRequest.php +++ b/Compute/src/V1/ListVpnGatewaysRequest.php @@ -20,43 +20,43 @@ class ListVpnGatewaysRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListVpnTunnelsRequest.php b/Compute/src/V1/ListVpnTunnelsRequest.php index 8d4d27cd06ba..d8a656d4f843 100644 --- a/Compute/src/V1/ListVpnTunnelsRequest.php +++ b/Compute/src/V1/ListVpnTunnelsRequest.php @@ -20,43 +20,43 @@ class ListVpnTunnelsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListXpnHostsProjectsRequest.php b/Compute/src/V1/ListXpnHostsProjectsRequest.php index 9bc8f72413a1..93bdc58d7690 100644 --- a/Compute/src/V1/ListXpnHostsProjectsRequest.php +++ b/Compute/src/V1/ListXpnHostsProjectsRequest.php @@ -20,43 +20,43 @@ class ListXpnHostsProjectsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.ProjectsListXpnHostsRequest projects_list_xpn_hosts_request_resource = 238266391 [(.google.api.field_behavior) = REQUIRED]; */ - private $projects_list_xpn_hosts_request_resource = null; + protected $projects_list_xpn_hosts_request_resource = null; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListZoneOperationsRequest.php b/Compute/src/V1/ListZoneOperationsRequest.php index 2aa71657391d..afb448e842dd 100644 --- a/Compute/src/V1/ListZoneOperationsRequest.php +++ b/Compute/src/V1/ListZoneOperationsRequest.php @@ -20,43 +20,43 @@ class ListZoneOperationsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * Name of the zone for request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ListZonesRequest.php b/Compute/src/V1/ListZonesRequest.php index 4a0ceae5dbd0..3e5638104504 100644 --- a/Compute/src/V1/ListZonesRequest.php +++ b/Compute/src/V1/ListZonesRequest.php @@ -20,37 +20,37 @@ class ListZonesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) * * Generated from protobuf field optional uint32 max_results = 54715419; */ - private $max_results = null; + protected $max_results = null; /** * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. Currently, only sorting by `name` or `creationTimestamp desc` is supported. * * Generated from protobuf field optional string order_by = 160562920; */ - private $order_by = null; + protected $order_by = null; /** * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. * * Generated from protobuf field optional string page_token = 19994697; */ - private $page_token = null; + protected $page_token = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Opt-in for partial success behavior which provides partial results in case of failure. The default value is false. For example, when partial success behavior is enabled, aggregatedList for a single zone scope either returns all resources in the zone or no resources, with an error code. * * Generated from protobuf field optional bool return_partial_success = 517198390; */ - private $return_partial_success = null; + protected $return_partial_success = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/LocalDisk.php b/Compute/src/V1/LocalDisk.php index 10dae6bb1472..a6df8080f3ff 100644 --- a/Compute/src/V1/LocalDisk.php +++ b/Compute/src/V1/LocalDisk.php @@ -19,19 +19,19 @@ class LocalDisk extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int32 disk_count = 182933485; */ - private $disk_count = null; + protected $disk_count = null; /** * Specifies the size of the disk in base-2 GB. * * Generated from protobuf field optional int32 disk_size_gb = 316263735; */ - private $disk_size_gb = null; + protected $disk_size_gb = null; /** * Specifies the desired disk type on the node. This disk type must be a local storage type (e.g.: local-ssd). Note that for nodeTemplates, this should be the name of the disk type and not its URL. * * Generated from protobuf field optional string disk_type = 93009052; */ - private $disk_type = null; + protected $disk_type = null; /** * Constructor. diff --git a/Compute/src/V1/LocalizedMessage.php b/Compute/src/V1/LocalizedMessage.php index b29f8afd1698..135da6c93bea 100644 --- a/Compute/src/V1/LocalizedMessage.php +++ b/Compute/src/V1/LocalizedMessage.php @@ -20,13 +20,13 @@ class LocalizedMessage extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string locale = 513150554; */ - private $locale = null; + protected $locale = null; /** * The localized error message in the above locale. * * Generated from protobuf field optional string message = 418054151; */ - private $message = null; + protected $message = null; /** * Constructor. diff --git a/Compute/src/V1/LocationPolicy.php b/Compute/src/V1/LocationPolicy.php index b2886397a2f7..5f0ae6ade56d 100644 --- a/Compute/src/V1/LocationPolicy.php +++ b/Compute/src/V1/LocationPolicy.php @@ -27,7 +27,7 @@ class LocationPolicy extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string target_shape = 338621299; */ - private $target_shape = null; + protected $target_shape = null; /** * Constructor. diff --git a/Compute/src/V1/LocationPolicyLocation.php b/Compute/src/V1/LocationPolicyLocation.php index 802af7d33ff3..52b801d1d263 100644 --- a/Compute/src/V1/LocationPolicyLocation.php +++ b/Compute/src/V1/LocationPolicyLocation.php @@ -19,14 +19,14 @@ class LocationPolicyLocation extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.LocationPolicyLocationConstraints constraints = 3909174; */ - private $constraints = null; + protected $constraints = null; /** * Preference for a given location. Set to either ALLOW or DENY. * Check the Preference enum for the list of possible values. * * Generated from protobuf field optional string preference = 150781147; */ - private $preference = null; + protected $preference = null; /** * Constructor. diff --git a/Compute/src/V1/LocationPolicyLocationConstraints.php b/Compute/src/V1/LocationPolicyLocationConstraints.php index 3e9e3d0c05e8..c1d1707df15a 100644 --- a/Compute/src/V1/LocationPolicyLocationConstraints.php +++ b/Compute/src/V1/LocationPolicyLocationConstraints.php @@ -20,7 +20,7 @@ class LocationPolicyLocationConstraints extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field optional int32 max_count = 287620724; */ - private $max_count = null; + protected $max_count = null; /** * Constructor. diff --git a/Compute/src/V1/LogConfig.php b/Compute/src/V1/LogConfig.php deleted file mode 100644 index b771cf851168..000000000000 --- a/Compute/src/V1/LogConfig.php +++ /dev/null @@ -1,165 +0,0 @@ -google.cloud.compute.v1.LogConfig - */ -class LogConfig extends \Google\Protobuf\Internal\Message -{ - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf field optional .google.cloud.compute.v1.LogConfigCloudAuditOptions cloud_audit = 412852561; - */ - private $cloud_audit = null; - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf field optional .google.cloud.compute.v1.LogConfigCounterOptions counter = 420959740; - */ - private $counter = null; - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf field optional .google.cloud.compute.v1.LogConfigDataAccessOptions data_access = 286633881; - */ - private $data_access = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Cloud\Compute\V1\LogConfigCloudAuditOptions $cloud_audit - * This is deprecated and has no effect. Do not use. - * @type \Google\Cloud\Compute\V1\LogConfigCounterOptions $counter - * This is deprecated and has no effect. Do not use. - * @type \Google\Cloud\Compute\V1\LogConfigDataAccessOptions $data_access - * This is deprecated and has no effect. Do not use. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Compute\V1\Compute::initOnce(); - parent::__construct($data); - } - - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf field optional .google.cloud.compute.v1.LogConfigCloudAuditOptions cloud_audit = 412852561; - * @return \Google\Cloud\Compute\V1\LogConfigCloudAuditOptions|null - */ - public function getCloudAudit() - { - return $this->cloud_audit; - } - - public function hasCloudAudit() - { - return isset($this->cloud_audit); - } - - public function clearCloudAudit() - { - unset($this->cloud_audit); - } - - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf field optional .google.cloud.compute.v1.LogConfigCloudAuditOptions cloud_audit = 412852561; - * @param \Google\Cloud\Compute\V1\LogConfigCloudAuditOptions $var - * @return $this - */ - public function setCloudAudit($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Compute\V1\LogConfigCloudAuditOptions::class); - $this->cloud_audit = $var; - - return $this; - } - - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf field optional .google.cloud.compute.v1.LogConfigCounterOptions counter = 420959740; - * @return \Google\Cloud\Compute\V1\LogConfigCounterOptions|null - */ - public function getCounter() - { - return $this->counter; - } - - public function hasCounter() - { - return isset($this->counter); - } - - public function clearCounter() - { - unset($this->counter); - } - - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf field optional .google.cloud.compute.v1.LogConfigCounterOptions counter = 420959740; - * @param \Google\Cloud\Compute\V1\LogConfigCounterOptions $var - * @return $this - */ - public function setCounter($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Compute\V1\LogConfigCounterOptions::class); - $this->counter = $var; - - return $this; - } - - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf field optional .google.cloud.compute.v1.LogConfigDataAccessOptions data_access = 286633881; - * @return \Google\Cloud\Compute\V1\LogConfigDataAccessOptions|null - */ - public function getDataAccess() - { - return $this->data_access; - } - - public function hasDataAccess() - { - return isset($this->data_access); - } - - public function clearDataAccess() - { - unset($this->data_access); - } - - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf field optional .google.cloud.compute.v1.LogConfigDataAccessOptions data_access = 286633881; - * @param \Google\Cloud\Compute\V1\LogConfigDataAccessOptions $var - * @return $this - */ - public function setDataAccess($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Compute\V1\LogConfigDataAccessOptions::class); - $this->data_access = $var; - - return $this; - } - -} - diff --git a/Compute/src/V1/LogConfigCloudAuditOptions.php b/Compute/src/V1/LogConfigCloudAuditOptions.php deleted file mode 100644 index 8f6b7b4f0f25..000000000000 --- a/Compute/src/V1/LogConfigCloudAuditOptions.php +++ /dev/null @@ -1,125 +0,0 @@ -google.cloud.compute.v1.LogConfigCloudAuditOptions - */ -class LogConfigCloudAuditOptions extends \Google\Protobuf\Internal\Message -{ - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf field optional .google.cloud.compute.v1.AuthorizationLoggingOptions authorization_logging_options = 217861624; - */ - private $authorization_logging_options = null; - /** - * This is deprecated and has no effect. Do not use. - * Check the LogName enum for the list of possible values. - * - * Generated from protobuf field optional string log_name = 402913958; - */ - private $log_name = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Cloud\Compute\V1\AuthorizationLoggingOptions $authorization_logging_options - * This is deprecated and has no effect. Do not use. - * @type string $log_name - * This is deprecated and has no effect. Do not use. - * Check the LogName enum for the list of possible values. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Compute\V1\Compute::initOnce(); - parent::__construct($data); - } - - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf field optional .google.cloud.compute.v1.AuthorizationLoggingOptions authorization_logging_options = 217861624; - * @return \Google\Cloud\Compute\V1\AuthorizationLoggingOptions|null - */ - public function getAuthorizationLoggingOptions() - { - return $this->authorization_logging_options; - } - - public function hasAuthorizationLoggingOptions() - { - return isset($this->authorization_logging_options); - } - - public function clearAuthorizationLoggingOptions() - { - unset($this->authorization_logging_options); - } - - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf field optional .google.cloud.compute.v1.AuthorizationLoggingOptions authorization_logging_options = 217861624; - * @param \Google\Cloud\Compute\V1\AuthorizationLoggingOptions $var - * @return $this - */ - public function setAuthorizationLoggingOptions($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Compute\V1\AuthorizationLoggingOptions::class); - $this->authorization_logging_options = $var; - - return $this; - } - - /** - * This is deprecated and has no effect. Do not use. - * Check the LogName enum for the list of possible values. - * - * Generated from protobuf field optional string log_name = 402913958; - * @return string - */ - public function getLogName() - { - return isset($this->log_name) ? $this->log_name : ''; - } - - public function hasLogName() - { - return isset($this->log_name); - } - - public function clearLogName() - { - unset($this->log_name); - } - - /** - * This is deprecated and has no effect. Do not use. - * Check the LogName enum for the list of possible values. - * - * Generated from protobuf field optional string log_name = 402913958; - * @param string $var - * @return $this - */ - public function setLogName($var) - { - GPBUtil::checkString($var, True); - $this->log_name = $var; - - return $this; - } - -} - diff --git a/Compute/src/V1/LogConfigCloudAuditOptions/LogName.php b/Compute/src/V1/LogConfigCloudAuditOptions/LogName.php deleted file mode 100644 index b90e67b2f424..000000000000 --- a/Compute/src/V1/LogConfigCloudAuditOptions/LogName.php +++ /dev/null @@ -1,69 +0,0 @@ -google.cloud.compute.v1.LogConfigCloudAuditOptions.LogName - */ -class LogName -{ - /** - * A value indicating that the enum field is not set. - * - * Generated from protobuf enum UNDEFINED_LOG_NAME = 0; - */ - const UNDEFINED_LOG_NAME = 0; - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf enum ADMIN_ACTIVITY = 427503135; - */ - const ADMIN_ACTIVITY = 427503135; - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf enum DATA_ACCESS = 238070681; - */ - const DATA_ACCESS = 238070681; - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf enum UNSPECIFIED_LOG_NAME = 410515182; - */ - const UNSPECIFIED_LOG_NAME = 410515182; - - private static $valueToName = [ - self::UNDEFINED_LOG_NAME => 'UNDEFINED_LOG_NAME', - self::ADMIN_ACTIVITY => 'ADMIN_ACTIVITY', - self::DATA_ACCESS => 'DATA_ACCESS', - self::UNSPECIFIED_LOG_NAME => 'UNSPECIFIED_LOG_NAME', - ]; - - 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/Compute/src/V1/LogConfigCounterOptions.php b/Compute/src/V1/LogConfigCounterOptions.php deleted file mode 100644 index d349e5b0fa00..000000000000 --- a/Compute/src/V1/LogConfigCounterOptions.php +++ /dev/null @@ -1,155 +0,0 @@ -google.cloud.compute.v1.LogConfigCounterOptions - */ -class LogConfigCounterOptions extends \Google\Protobuf\Internal\Message -{ - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf field repeated .google.cloud.compute.v1.LogConfigCounterOptionsCustomField custom_fields = 249651015; - */ - private $custom_fields; - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf field optional string field = 97427706; - */ - private $field = null; - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf field optional string metric = 533067184; - */ - private $metric = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type array<\Google\Cloud\Compute\V1\LogConfigCounterOptionsCustomField>|\Google\Protobuf\Internal\RepeatedField $custom_fields - * This is deprecated and has no effect. Do not use. - * @type string $field - * This is deprecated and has no effect. Do not use. - * @type string $metric - * This is deprecated and has no effect. Do not use. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Compute\V1\Compute::initOnce(); - parent::__construct($data); - } - - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf field repeated .google.cloud.compute.v1.LogConfigCounterOptionsCustomField custom_fields = 249651015; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getCustomFields() - { - return $this->custom_fields; - } - - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf field repeated .google.cloud.compute.v1.LogConfigCounterOptionsCustomField custom_fields = 249651015; - * @param array<\Google\Cloud\Compute\V1\LogConfigCounterOptionsCustomField>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setCustomFields($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Compute\V1\LogConfigCounterOptionsCustomField::class); - $this->custom_fields = $arr; - - return $this; - } - - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf field optional string field = 97427706; - * @return string - */ - public function getField() - { - return isset($this->field) ? $this->field : ''; - } - - public function hasField() - { - return isset($this->field); - } - - public function clearField() - { - unset($this->field); - } - - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf field optional string field = 97427706; - * @param string $var - * @return $this - */ - public function setField($var) - { - GPBUtil::checkString($var, True); - $this->field = $var; - - return $this; - } - - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf field optional string metric = 533067184; - * @return string - */ - public function getMetric() - { - return isset($this->metric) ? $this->metric : ''; - } - - public function hasMetric() - { - return isset($this->metric); - } - - public function clearMetric() - { - unset($this->metric); - } - - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf field optional string metric = 533067184; - * @param string $var - * @return $this - */ - public function setMetric($var) - { - GPBUtil::checkString($var, True); - $this->metric = $var; - - return $this; - } - -} - diff --git a/Compute/src/V1/LogConfigCounterOptionsCustomField.php b/Compute/src/V1/LogConfigCounterOptionsCustomField.php deleted file mode 100644 index c5c88712d006..000000000000 --- a/Compute/src/V1/LogConfigCounterOptionsCustomField.php +++ /dev/null @@ -1,121 +0,0 @@ -google.cloud.compute.v1.LogConfigCounterOptionsCustomField - */ -class LogConfigCounterOptionsCustomField extends \Google\Protobuf\Internal\Message -{ - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf field optional string name = 3373707; - */ - private $name = null; - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf field optional string value = 111972721; - */ - private $value = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * This is deprecated and has no effect. Do not use. - * @type string $value - * This is deprecated and has no effect. Do not use. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Compute\V1\Compute::initOnce(); - parent::__construct($data); - } - - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf field optional string name = 3373707; - * @return string - */ - public function getName() - { - return isset($this->name) ? $this->name : ''; - } - - public function hasName() - { - return isset($this->name); - } - - public function clearName() - { - unset($this->name); - } - - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf field optional string name = 3373707; - * @param string $var - * @return $this - */ - public function setName($var) - { - GPBUtil::checkString($var, True); - $this->name = $var; - - return $this; - } - - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf field optional string value = 111972721; - * @return string - */ - public function getValue() - { - return isset($this->value) ? $this->value : ''; - } - - public function hasValue() - { - return isset($this->value); - } - - public function clearValue() - { - unset($this->value); - } - - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf field optional string value = 111972721; - * @param string $var - * @return $this - */ - public function setValue($var) - { - GPBUtil::checkString($var, True); - $this->value = $var; - - return $this; - } - -} - diff --git a/Compute/src/V1/LogConfigDataAccessOptions.php b/Compute/src/V1/LogConfigDataAccessOptions.php deleted file mode 100644 index de56e0210944..000000000000 --- a/Compute/src/V1/LogConfigDataAccessOptions.php +++ /dev/null @@ -1,81 +0,0 @@ -google.cloud.compute.v1.LogConfigDataAccessOptions - */ -class LogConfigDataAccessOptions extends \Google\Protobuf\Internal\Message -{ - /** - * This is deprecated and has no effect. Do not use. - * Check the LogMode enum for the list of possible values. - * - * Generated from protobuf field optional string log_mode = 402897342; - */ - private $log_mode = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $log_mode - * This is deprecated and has no effect. Do not use. - * Check the LogMode enum for the list of possible values. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Compute\V1\Compute::initOnce(); - parent::__construct($data); - } - - /** - * This is deprecated and has no effect. Do not use. - * Check the LogMode enum for the list of possible values. - * - * Generated from protobuf field optional string log_mode = 402897342; - * @return string - */ - public function getLogMode() - { - return isset($this->log_mode) ? $this->log_mode : ''; - } - - public function hasLogMode() - { - return isset($this->log_mode); - } - - public function clearLogMode() - { - unset($this->log_mode); - } - - /** - * This is deprecated and has no effect. Do not use. - * Check the LogMode enum for the list of possible values. - * - * Generated from protobuf field optional string log_mode = 402897342; - * @param string $var - * @return $this - */ - public function setLogMode($var) - { - GPBUtil::checkString($var, True); - $this->log_mode = $var; - - return $this; - } - -} - diff --git a/Compute/src/V1/LogConfigDataAccessOptions/LogMode.php b/Compute/src/V1/LogConfigDataAccessOptions/LogMode.php deleted file mode 100644 index 80e51e3ae63d..000000000000 --- a/Compute/src/V1/LogConfigDataAccessOptions/LogMode.php +++ /dev/null @@ -1,62 +0,0 @@ -google.cloud.compute.v1.LogConfigDataAccessOptions.LogMode - */ -class LogMode -{ - /** - * A value indicating that the enum field is not set. - * - * Generated from protobuf enum UNDEFINED_LOG_MODE = 0; - */ - const UNDEFINED_LOG_MODE = 0; - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf enum LOG_FAIL_CLOSED = 360469778; - */ - const LOG_FAIL_CLOSED = 360469778; - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf enum LOG_MODE_UNSPECIFIED = 88160822; - */ - const LOG_MODE_UNSPECIFIED = 88160822; - - private static $valueToName = [ - self::UNDEFINED_LOG_MODE => 'UNDEFINED_LOG_MODE', - self::LOG_FAIL_CLOSED => 'LOG_FAIL_CLOSED', - self::LOG_MODE_UNSPECIFIED => 'LOG_MODE_UNSPECIFIED', - ]; - - 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/Compute/src/V1/MachineImage.php b/Compute/src/V1/MachineImage.php index eb6ce54898f5..6df73d5809d3 100644 --- a/Compute/src/V1/MachineImage.php +++ b/Compute/src/V1/MachineImage.php @@ -20,43 +20,43 @@ class MachineImage extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * An optional description of this resource. Provide this property when you create the resource. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * [Input Only] Whether to attempt an application consistent machine image by informing the OS to prepare for the snapshot process. * * Generated from protobuf field optional bool guest_flush = 385550813; */ - private $guest_flush = null; + protected $guest_flush = null; /** * [Output Only] A unique identifier for this machine image. The server defines this identifier. * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * [Output Only] Properties of source instance * * Generated from protobuf field optional .google.cloud.compute.v1.InstanceProperties instance_properties = 215355165; */ - private $instance_properties = null; + protected $instance_properties = null; /** * [Output Only] The resource type, which is always compute#machineImage for machine image. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * A fingerprint for the labels being applied to this machine image, which is essentially a hash of the labels set used for optimistic locking. The fingerprint is initially generated by Compute Engine and changes after every request to modify or update labels. You must always provide an up-to-date fingerprint hash in order to update or change labels. To see the latest fingerprint, make get() request to the machine image. * * Generated from protobuf field optional string label_fingerprint = 178124825; */ - private $label_fingerprint = null; + protected $label_fingerprint = null; /** * Labels to apply to this machine image. These can be later modified by the setLabels method. * @@ -68,25 +68,25 @@ class MachineImage extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.CustomerEncryptionKey machine_image_encryption_key = 528089087; */ - private $machine_image_encryption_key = null; + protected $machine_image_encryption_key = null; /** * Name of the resource; provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * Output only. Reserved for future use. * * Generated from protobuf field optional bool satisfies_pzi = 480964257; */ - private $satisfies_pzi = null; + protected $satisfies_pzi = null; /** * [Output Only] Reserved for future use. * * Generated from protobuf field optional bool satisfies_pzs = 480964267; */ - private $satisfies_pzs = null; + protected $satisfies_pzs = null; /** * An array of Machine Image specific properties for disks attached to the source instance * @@ -98,7 +98,7 @@ class MachineImage extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Input Only] The customer-supplied encryption key of the disks attached to the source instance. Required if the source disk is protected by a customer-supplied encryption key. * @@ -110,20 +110,20 @@ class MachineImage extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string source_instance = 396315705; */ - private $source_instance = null; + protected $source_instance = null; /** * [Output Only] DEPRECATED: Please use instance_properties instead for source instance related properties. New properties will not be added to this field. * * Generated from protobuf field optional .google.cloud.compute.v1.SourceInstanceProperties source_instance_properties = 475195641; */ - private $source_instance_properties = null; + protected $source_instance_properties = null; /** * [Output Only] The status of the machine image. One of the following values: INVALID, CREATING, READY, DELETING, and UPLOADING. * Check the Status enum for the list of possible values. * * Generated from protobuf field optional string status = 181260274; */ - private $status = null; + protected $status = null; /** * The regional or multi-regional Cloud Storage bucket location where the machine image is stored. * @@ -135,7 +135,7 @@ class MachineImage extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int64 total_storage_bytes = 81855468; */ - private $total_storage_bytes = null; + protected $total_storage_bytes = null; /** * Constructor. diff --git a/Compute/src/V1/MachineImageList.php b/Compute/src/V1/MachineImageList.php index d35873185580..39b235425758 100644 --- a/Compute/src/V1/MachineImageList.php +++ b/Compute/src/V1/MachineImageList.php @@ -20,7 +20,7 @@ class MachineImageList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of MachineImage resources. * @@ -32,25 +32,25 @@ class MachineImageList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/MachineImagesClient.php b/Compute/src/V1/MachineImagesClient.php deleted file mode 100644 index 8b798f905e91..000000000000 --- a/Compute/src/V1/MachineImagesClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional string architecture = 302803283; */ - private $architecture = null; + protected $architecture = null; /** * [Output Only] Creation timestamp in RFC3339 text format. * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * [Output Only] The deprecation status associated with this machine type. Only applicable if the machine type is unavailable. * * Generated from protobuf field optional .google.cloud.compute.v1.DeprecationStatus deprecated = 515138995; */ - private $deprecated = null; + protected $deprecated = null; /** * [Output Only] An optional textual description of the resource. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * [Output Only] The number of virtual CPUs that are available to the instance. * * Generated from protobuf field optional int32 guest_cpus = 393356754; */ - private $guest_cpus = null; + protected $guest_cpus = null; /** * [Output Only] The unique identifier for the resource. This identifier is defined by the server. * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * [Deprecated] This property is deprecated and will never be populated with any relevant values. * * Generated from protobuf field optional int32 image_space_gb = 75331864; */ - private $image_space_gb = null; + protected $image_space_gb = null; /** * [Output Only] Whether this machine type has a shared CPU. See Shared-core machine types for more information. * * Generated from protobuf field optional bool is_shared_cpu = 521399555; */ - private $is_shared_cpu = null; + protected $is_shared_cpu = null; /** * [Output Only] The type of the resource. Always compute#machineType for machine types. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] Maximum persistent disks allowed. * * Generated from protobuf field optional int32 maximum_persistent_disks = 496220941; */ - private $maximum_persistent_disks = null; + protected $maximum_persistent_disks = null; /** * [Output Only] Maximum total persistent disks size (GB) allowed. * * Generated from protobuf field optional int64 maximum_persistent_disks_size_gb = 154274471; */ - private $maximum_persistent_disks_size_gb = null; + protected $maximum_persistent_disks_size_gb = null; /** * [Output Only] The amount of physical memory available to the instance, defined in MB. * * Generated from protobuf field optional int32 memory_mb = 116001171; */ - private $memory_mb = null; + protected $memory_mb = null; /** * [Output Only] Name of the resource. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * [Output Only] Server-defined URL for the resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] The name of the zone where the machine type resides, such as us-central1-a. * * Generated from protobuf field optional string zone = 3744684; */ - private $zone = null; + protected $zone = null; /** * Constructor. diff --git a/Compute/src/V1/MachineTypeAggregatedList.php b/Compute/src/V1/MachineTypeAggregatedList.php index c9186edc39f8..ce6bae4eba38 100644 --- a/Compute/src/V1/MachineTypeAggregatedList.php +++ b/Compute/src/V1/MachineTypeAggregatedList.php @@ -19,7 +19,7 @@ class MachineTypeAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of MachineTypesScopedList resources. * @@ -31,19 +31,19 @@ class MachineTypeAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Unreachable resources. * @@ -55,7 +55,7 @@ class MachineTypeAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/MachineTypeList.php b/Compute/src/V1/MachineTypeList.php index 53a56c87410b..2ea972c318b8 100644 --- a/Compute/src/V1/MachineTypeList.php +++ b/Compute/src/V1/MachineTypeList.php @@ -20,7 +20,7 @@ class MachineTypeList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of MachineType resources. * @@ -32,25 +32,25 @@ class MachineTypeList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/MachineTypesClient.php b/Compute/src/V1/MachineTypesClient.php deleted file mode 100644 index 1c33385304e2..000000000000 --- a/Compute/src/V1/MachineTypesClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/ManagedInstance.php b/Compute/src/V1/ManagedInstance.php index c68d4c5af4f7..4a8607ea43b8 100644 --- a/Compute/src/V1/ManagedInstance.php +++ b/Compute/src/V1/ManagedInstance.php @@ -21,19 +21,19 @@ class ManagedInstance extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string current_action = 178475964; */ - private $current_action = null; + protected $current_action = null; /** * [Output only] The unique identifier for this resource. This field is empty when instance does not exist. * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * [Output Only] The URL of the instance. The URL can exist even if the instance has not yet been created. * * Generated from protobuf field optional string instance = 18257045; */ - private $instance = null; + protected $instance = null; /** * [Output Only] Health state of the instance per health-check. * @@ -46,43 +46,43 @@ class ManagedInstance extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string instance_status = 174577372; */ - private $instance_status = null; + protected $instance_status = null; /** * [Output Only] Information about the last attempt to create or delete the instance. * * Generated from protobuf field optional .google.cloud.compute.v1.ManagedInstanceLastAttempt last_attempt = 434771492; */ - private $last_attempt = null; + protected $last_attempt = null; /** * [Output Only] The name of the instance. The name always exists even if the instance has not yet been created. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * [Output Only] Preserved state applied from per-instance config for this instance. * * Generated from protobuf field optional .google.cloud.compute.v1.PreservedState preserved_state_from_config = 98661858; */ - private $preserved_state_from_config = null; + protected $preserved_state_from_config = null; /** * [Output Only] Preserved state generated based on stateful policy for this instance. * * Generated from protobuf field optional .google.cloud.compute.v1.PreservedState preserved_state_from_policy = 470783954; */ - private $preserved_state_from_policy = null; + protected $preserved_state_from_policy = null; /** * [Output Only] Instance properties selected for this instance resulting from InstanceFlexibilityPolicy. * * Generated from protobuf field optional .google.cloud.compute.v1.ManagedInstancePropertiesFromFlexibilityPolicy properties_from_flexibility_policy = 155525825; */ - private $properties_from_flexibility_policy = null; + protected $properties_from_flexibility_policy = null; /** * [Output Only] Intended version of this instance. * * Generated from protobuf field optional .google.cloud.compute.v1.ManagedInstanceVersion version = 351608024; */ - private $version = null; + protected $version = null; /** * Constructor. diff --git a/Compute/src/V1/ManagedInstanceInstanceHealth.php b/Compute/src/V1/ManagedInstanceInstanceHealth.php index 648844439b92..3ce8478f8fb5 100644 --- a/Compute/src/V1/ManagedInstanceInstanceHealth.php +++ b/Compute/src/V1/ManagedInstanceInstanceHealth.php @@ -20,13 +20,13 @@ class ManagedInstanceInstanceHealth extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string detailed_health_state = 510470173; */ - private $detailed_health_state = null; + protected $detailed_health_state = null; /** * [Output Only] The URL for the health check that verifies whether the instance is healthy. * * Generated from protobuf field optional string health_check = 308876645; */ - private $health_check = null; + protected $health_check = null; /** * Constructor. diff --git a/Compute/src/V1/ManagedInstanceLastAttempt.php b/Compute/src/V1/ManagedInstanceLastAttempt.php index dfeb18db69ea..51c7d3a92539 100644 --- a/Compute/src/V1/ManagedInstanceLastAttempt.php +++ b/Compute/src/V1/ManagedInstanceLastAttempt.php @@ -19,7 +19,7 @@ class ManagedInstanceLastAttempt extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.ManagedInstanceLastAttemptErrors errors = 315977579; */ - private $errors = null; + protected $errors = null; /** * Constructor. diff --git a/Compute/src/V1/ManagedInstancePropertiesFromFlexibilityPolicy.php b/Compute/src/V1/ManagedInstancePropertiesFromFlexibilityPolicy.php index fdecb3c08f63..70c523f2bdd5 100644 --- a/Compute/src/V1/ManagedInstancePropertiesFromFlexibilityPolicy.php +++ b/Compute/src/V1/ManagedInstancePropertiesFromFlexibilityPolicy.php @@ -19,7 +19,7 @@ class ManagedInstancePropertiesFromFlexibilityPolicy extends \Google\Protobuf\In * * Generated from protobuf field optional string machine_type = 227711026; */ - private $machine_type = null; + protected $machine_type = null; /** * Constructor. diff --git a/Compute/src/V1/ManagedInstanceVersion.php b/Compute/src/V1/ManagedInstanceVersion.php index 874bddbce0b7..044944d7ec5e 100644 --- a/Compute/src/V1/ManagedInstanceVersion.php +++ b/Compute/src/V1/ManagedInstanceVersion.php @@ -19,13 +19,13 @@ class ManagedInstanceVersion extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string instance_template = 309248228; */ - private $instance_template = null; + protected $instance_template = null; /** * [Output Only] Name of the version. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * Constructor. diff --git a/Compute/src/V1/Metadata.php b/Compute/src/V1/Metadata.php index a4ac5a7b4d5a..ac74cbd159bc 100644 --- a/Compute/src/V1/Metadata.php +++ b/Compute/src/V1/Metadata.php @@ -20,7 +20,7 @@ class Metadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string fingerprint = 234678500; */ - private $fingerprint = null; + protected $fingerprint = null; /** * Array of key/value pairs. The total size of all keys and values must be less than 512 KB. * @@ -32,7 +32,7 @@ class Metadata extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * Constructor. diff --git a/Compute/src/V1/MetadataFilter.php b/Compute/src/V1/MetadataFilter.php index 95441defe3f6..54b785c8aaee 100644 --- a/Compute/src/V1/MetadataFilter.php +++ b/Compute/src/V1/MetadataFilter.php @@ -27,7 +27,7 @@ class MetadataFilter extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string filter_match_criteria = 239970368; */ - private $filter_match_criteria = null; + protected $filter_match_criteria = null; /** * Constructor. diff --git a/Compute/src/V1/MetadataFilterLabelMatch.php b/Compute/src/V1/MetadataFilterLabelMatch.php index 964d030a40cf..2155c11297d9 100644 --- a/Compute/src/V1/MetadataFilterLabelMatch.php +++ b/Compute/src/V1/MetadataFilterLabelMatch.php @@ -20,13 +20,13 @@ class MetadataFilterLabelMatch extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * The value of the label must match the specified value. value can have a maximum length of 1024 characters. * * Generated from protobuf field optional string value = 111972721; */ - private $value = null; + protected $value = null; /** * Constructor. diff --git a/Compute/src/V1/MoveAddressRequest.php b/Compute/src/V1/MoveAddressRequest.php index 5f94211aa98a..16dfe627fc1a 100644 --- a/Compute/src/V1/MoveAddressRequest.php +++ b/Compute/src/V1/MoveAddressRequest.php @@ -20,31 +20,31 @@ class MoveAddressRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string address = 462920692 [(.google.api.field_behavior) = REQUIRED]; */ - private $address = ''; + protected $address = ''; /** * Source project ID which the Address is moved from. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.RegionAddressesMoveRequest region_addresses_move_request_resource = 409081924 [(.google.api.field_behavior) = REQUIRED]; */ - private $region_addresses_move_request_resource = null; + protected $region_addresses_move_request_resource = null; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Source project ID which the Address is moved from. diff --git a/Compute/src/V1/MoveDiskProjectRequest.php b/Compute/src/V1/MoveDiskProjectRequest.php index d876a2911bea..f39fe4901049 100644 --- a/Compute/src/V1/MoveDiskProjectRequest.php +++ b/Compute/src/V1/MoveDiskProjectRequest.php @@ -20,19 +20,19 @@ class MoveDiskProjectRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.compute.v1.DiskMoveRequest disk_move_request_resource = 313008458 [(.google.api.field_behavior) = REQUIRED]; */ - private $disk_move_request_resource = null; + protected $disk_move_request_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/MoveFirewallPolicyRequest.php b/Compute/src/V1/MoveFirewallPolicyRequest.php index e384c19cedae..76912e1d69c0 100644 --- a/Compute/src/V1/MoveFirewallPolicyRequest.php +++ b/Compute/src/V1/MoveFirewallPolicyRequest.php @@ -20,19 +20,19 @@ class MoveFirewallPolicyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string firewall_policy = 498173265 [(.google.api.field_behavior) = REQUIRED]; */ - private $firewall_policy = ''; + protected $firewall_policy = ''; /** * The new parent of the firewall policy. The ID can be either be "folders/[FOLDER_ID]" if the parent is a folder or "organizations/[ORGANIZATION_ID]" if the parent is an organization. * * Generated from protobuf field string parent_id = 459714768 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "parent_id"]; */ - private $parent_id = ''; + protected $parent_id = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $firewallPolicy Name of the firewall policy to update. diff --git a/Compute/src/V1/MoveGlobalAddressRequest.php b/Compute/src/V1/MoveGlobalAddressRequest.php index 3320324416a4..947e4180e9a3 100644 --- a/Compute/src/V1/MoveGlobalAddressRequest.php +++ b/Compute/src/V1/MoveGlobalAddressRequest.php @@ -20,25 +20,25 @@ class MoveGlobalAddressRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string address = 462920692 [(.google.api.field_behavior) = REQUIRED]; */ - private $address = ''; + protected $address = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.GlobalAddressesMoveRequest global_addresses_move_request_resource = 302807283 [(.google.api.field_behavior) = REQUIRED]; */ - private $global_addresses_move_request_resource = null; + protected $global_addresses_move_request_resource = null; /** * Source project ID which the Address is moved from. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Source project ID which the Address is moved from. diff --git a/Compute/src/V1/MoveInstanceProjectRequest.php b/Compute/src/V1/MoveInstanceProjectRequest.php index 6d057b7411c9..91d6b575be6b 100644 --- a/Compute/src/V1/MoveInstanceProjectRequest.php +++ b/Compute/src/V1/MoveInstanceProjectRequest.php @@ -20,19 +20,19 @@ class MoveInstanceProjectRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.compute.v1.InstanceMoveRequest instance_move_request_resource = 311664194 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_move_request_resource = null; + protected $instance_move_request_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/NamedPort.php b/Compute/src/V1/NamedPort.php index ca24fa0c90e6..d007030dbc21 100644 --- a/Compute/src/V1/NamedPort.php +++ b/Compute/src/V1/NamedPort.php @@ -20,13 +20,13 @@ class NamedPort extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * The port number, which can be a value between 1 and 65535. * * Generated from protobuf field optional int32 port = 3446913; */ - private $port = null; + protected $port = null; /** * Constructor. diff --git a/Compute/src/V1/NatIpInfo.php b/Compute/src/V1/NatIpInfo.php index 22fcb0e5f1a5..b49e6deb0e42 100644 --- a/Compute/src/V1/NatIpInfo.php +++ b/Compute/src/V1/NatIpInfo.php @@ -26,7 +26,7 @@ class NatIpInfo extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string nat_name = 425596649; */ - private $nat_name = null; + protected $nat_name = null; /** * Constructor. diff --git a/Compute/src/V1/NatIpInfoNatIpInfoMapping.php b/Compute/src/V1/NatIpInfoNatIpInfoMapping.php index 078cb3c6da86..e84758fc7d20 100644 --- a/Compute/src/V1/NatIpInfoNatIpInfoMapping.php +++ b/Compute/src/V1/NatIpInfoNatIpInfoMapping.php @@ -21,20 +21,20 @@ class NatIpInfoNatIpInfoMapping extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string mode = 3357091; */ - private $mode = null; + protected $mode = null; /** * NAT IP address. For example: 203.0.113.11. * * Generated from protobuf field optional string nat_ip = 21113093; */ - private $nat_ip = null; + protected $nat_ip = null; /** * Specifies whether NAT IP is currently serving at least one endpoint or not. * Check the Usage enum for the list of possible values. * * Generated from protobuf field optional string usage = 111574433; */ - private $usage = null; + protected $usage = null; /** * Constructor. diff --git a/Compute/src/V1/Network.php b/Compute/src/V1/Network.php index 6a6fec841424..11e739f1c5a8 100644 --- a/Compute/src/V1/Network.php +++ b/Compute/src/V1/Network.php @@ -20,92 +20,92 @@ class Network extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string I_pv4_range = 59234358; */ - private $I_pv4_range = null; + protected $I_pv4_range = null; /** * Must be set to create a VPC network. If not set, a legacy network is created. When set to true, the VPC network is created in auto mode. When set to false, the VPC network is created in custom mode. An auto mode VPC network starts with one subnet per region. Each subnet has a predetermined range as described in Auto mode VPC network IP ranges. For custom mode VPC networks, you can add subnets using the subnetworks insert method. * * Generated from protobuf field optional bool auto_create_subnetworks = 256156690; */ - private $auto_create_subnetworks = null; + protected $auto_create_subnetworks = null; /** * [Output Only] Creation timestamp in RFC3339 text format. * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * An optional description of this resource. Provide this field when you create the resource. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * Enable ULA internal ipv6 on this network. Enabling this feature will assign a /48 from google defined ULA prefix fd20::/20. . * * Generated from protobuf field optional bool enable_ula_internal_ipv6 = 423757720; */ - private $enable_ula_internal_ipv6 = null; + protected $enable_ula_internal_ipv6 = null; /** * [Output Only] URL of the firewall policy the network is associated with. * * Generated from protobuf field optional string firewall_policy = 498173265; */ - private $firewall_policy = null; + protected $firewall_policy = null; /** * [Output Only] The gateway address for default routing out of the network, selected by Google Cloud. * * Generated from protobuf field optional string gateway_i_pv4 = 178678877; */ - private $gateway_i_pv4 = null; + protected $gateway_i_pv4 = null; /** * [Output Only] The unique identifier for the resource. This identifier is defined by the server. * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * When enabling ula internal ipv6, caller optionally can specify the /48 range they want from the google defined ULA prefix fd20::/20. The input must be a valid /48 ULA IPv6 address and must be within the fd20::/20. Operation will fail if the speficied /48 is already in used by another resource. If the field is not speficied, then a /48 range will be randomly allocated from fd20::/20 and returned via this field. . * * Generated from protobuf field optional string internal_ipv6_range = 277456807; */ - private $internal_ipv6_range = null; + protected $internal_ipv6_range = null; /** * [Output Only] Type of the resource. Always compute#network for networks. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * Maximum Transmission Unit in bytes. The minimum value for this field is 1300 and the maximum value is 8896. The suggested value is 1500, which is the default MTU used on the Internet, or 8896 if you want to use Jumbo frames. If unspecified, the value defaults to 1460. * * Generated from protobuf field optional int32 mtu = 108462; */ - private $mtu = null; + protected $mtu = null; /** * Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?`. The first character must be a lowercase letter, and all following characters (except for the last character) must be a dash, lowercase letter, or digit. The last character must be a lowercase letter or digit. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * The network firewall policy enforcement order. Can be either AFTER_CLASSIC_FIREWALL or BEFORE_CLASSIC_FIREWALL. Defaults to AFTER_CLASSIC_FIREWALL if the field is not specified. * Check the NetworkFirewallPolicyEnforcementOrder enum for the list of possible values. * * Generated from protobuf field optional string network_firewall_policy_enforcement_order = 6504784; */ - private $network_firewall_policy_enforcement_order = null; + protected $network_firewall_policy_enforcement_order = null; /** * A full or partial URL of the network profile to apply to this network. This field can be set only at resource creation time. For example, the following are valid URLs: - https://www.googleapis.com/compute/{api_version}/projects/{project_id}/global/networkProfiles/{network_profile_name} - projects/{project_id}/global/networkProfiles/{network_profile_name} * * Generated from protobuf field optional string network_profile = 173112472; */ - private $network_profile = null; + protected $network_profile = null; /** * Input only. [Input Only] Additional params passed with the request, but not persisted as part of resource payload. * * Generated from protobuf field optional .google.cloud.compute.v1.NetworkParams params = 78313862; */ - private $params = null; + protected $params = null; /** * [Output Only] A list of network peerings for the resource. * @@ -117,19 +117,19 @@ class Network extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.NetworkRoutingConfig routing_config = 523556059; */ - private $routing_config = null; + protected $routing_config = null; /** * [Output Only] Server-defined URL for the resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Server-defined URL for this resource with the resource id. * * Generated from protobuf field optional string self_link_with_id = 44520962; */ - private $self_link_with_id = null; + protected $self_link_with_id = null; /** * [Output Only] Server-defined fully-qualified URLs for all subnetworks in this VPC network. * diff --git a/Compute/src/V1/NetworkAttachment.php b/Compute/src/V1/NetworkAttachment.php index 5ede036e3510..67a1016c2573 100644 --- a/Compute/src/V1/NetworkAttachment.php +++ b/Compute/src/V1/NetworkAttachment.php @@ -27,49 +27,49 @@ class NetworkAttachment extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string connection_preference = 285818076; */ - private $connection_preference = null; + protected $connection_preference = null; /** * [Output Only] Creation timestamp in RFC3339 text format. * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * An optional description of this resource. Provide this property when you create the resource. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * Fingerprint of this resource. A hash of the contents stored in this object. This field is used in optimistic locking. An up-to-date fingerprint must be provided in order to patch. * * Generated from protobuf field optional string fingerprint = 234678500; */ - private $fingerprint = null; + protected $fingerprint = null; /** * [Output Only] The unique identifier for the resource type. The server generates this identifier. * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * [Output Only] Type of the resource. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * [Output Only] The URL of the network which the Network Attachment belongs to. Practically it is inferred by fetching the network of the first subnetwork associated. Because it is required that all the subnetworks must be from the same network, it is assured that the Network Attachment belongs to the same network as all the subnetworks. * * Generated from protobuf field optional string network = 232872494; */ - private $network = null; + protected $network = null; /** * Projects that are allowed to connect to this network attachment. The project can be specified using its id or number. * @@ -87,19 +87,19 @@ class NetworkAttachment extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string region = 138946292; */ - private $region = null; + protected $region = null; /** * [Output Only] Server-defined URL for the resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Server-defined URL for this resource's resource id. * * Generated from protobuf field optional string self_link_with_id = 44520962; */ - private $self_link_with_id = null; + protected $self_link_with_id = null; /** * An array of URLs where each entry is the URL of a subnet provided by the service consumer to use for endpoints in the producers that connect to this network attachment. * diff --git a/Compute/src/V1/NetworkAttachmentAggregatedList.php b/Compute/src/V1/NetworkAttachmentAggregatedList.php index 508c0cb18e44..8ccccad00faa 100644 --- a/Compute/src/V1/NetworkAttachmentAggregatedList.php +++ b/Compute/src/V1/NetworkAttachmentAggregatedList.php @@ -20,7 +20,7 @@ class NetworkAttachmentAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of NetworkAttachmentsScopedList resources. * @@ -30,25 +30,25 @@ class NetworkAttachmentAggregatedList extends \Google\Protobuf\Internal\Message /** * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/NetworkAttachmentConnectedEndpoint.php b/Compute/src/V1/NetworkAttachmentConnectedEndpoint.php index a57de55c0610..cb4a8dd6ae3b 100644 --- a/Compute/src/V1/NetworkAttachmentConnectedEndpoint.php +++ b/Compute/src/V1/NetworkAttachmentConnectedEndpoint.php @@ -20,19 +20,19 @@ class NetworkAttachmentConnectedEndpoint extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field optional string ip_address = 406272220; */ - private $ip_address = null; + protected $ip_address = null; /** * The IPv6 address assigned to the producer instance network interface. This is only assigned when the stack types of both the instance network interface and the consumer subnet are IPv4_IPv6. * * Generated from protobuf field optional string ipv6_address = 341563804; */ - private $ipv6_address = null; + protected $ipv6_address = null; /** * The project id or number of the interface to which the IP was assigned. * * Generated from protobuf field optional string project_id_or_num = 349783336; */ - private $project_id_or_num = null; + protected $project_id_or_num = null; /** * Alias IP ranges from the same subnetwork. * @@ -45,19 +45,19 @@ class NetworkAttachmentConnectedEndpoint extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field optional string status = 181260274; */ - private $status = null; + protected $status = null; /** * The subnetwork used to assign the IP to the producer instance network interface. * * Generated from protobuf field optional string subnetwork = 307827694; */ - private $subnetwork = null; + protected $subnetwork = null; /** * [Output Only] The CIDR range of the subnet from which the IPv4 internal IP was allocated from. * * Generated from protobuf field optional string subnetwork_cidr_range = 383249827; */ - private $subnetwork_cidr_range = null; + protected $subnetwork_cidr_range = null; /** * Constructor. diff --git a/Compute/src/V1/NetworkAttachmentList.php b/Compute/src/V1/NetworkAttachmentList.php index fc2f089a39c5..be0f96ce8ea1 100644 --- a/Compute/src/V1/NetworkAttachmentList.php +++ b/Compute/src/V1/NetworkAttachmentList.php @@ -19,7 +19,7 @@ class NetworkAttachmentList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of NetworkAttachment resources. * @@ -29,25 +29,25 @@ class NetworkAttachmentList extends \Google\Protobuf\Internal\Message /** * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/NetworkAttachmentsClient.php b/Compute/src/V1/NetworkAttachmentsClient.php deleted file mode 100644 index 5afd75077fb1..000000000000 --- a/Compute/src/V1/NetworkAttachmentsClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/NetworkEdgeSecurityService.php b/Compute/src/V1/NetworkEdgeSecurityService.php index 3b6216258a74..71198249ad4d 100644 --- a/Compute/src/V1/NetworkEdgeSecurityService.php +++ b/Compute/src/V1/NetworkEdgeSecurityService.php @@ -20,61 +20,61 @@ class NetworkEdgeSecurityService extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * An optional description of this resource. Provide this property when you create the resource. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * Fingerprint of this resource. A hash of the contents stored in this object. This field is used in optimistic locking. This field will be ignored when inserting a NetworkEdgeSecurityService. An up-to-date fingerprint must be provided in order to update the NetworkEdgeSecurityService, otherwise the request will fail with error 412 conditionNotMet. To see the latest fingerprint, make a get() request to retrieve a NetworkEdgeSecurityService. * * Generated from protobuf field optional string fingerprint = 234678500; */ - private $fingerprint = null; + protected $fingerprint = null; /** * [Output Only] The unique identifier for the resource. This identifier is defined by the server. * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * [Output only] Type of the resource. Always compute#networkEdgeSecurityService for NetworkEdgeSecurityServices * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * [Output Only] URL of the region where the resource resides. You must specify this field as part of the HTTP request URL. It is not settable as a field in the request body. * * Generated from protobuf field optional string region = 138946292; */ - private $region = null; + protected $region = null; /** * The resource URL for the network edge security service associated with this network edge security service. * * Generated from protobuf field optional string security_policy = 171082513; */ - private $security_policy = null; + protected $security_policy = null; /** * [Output Only] Server-defined URL for the resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Server-defined URL for this resource with the resource id. * * Generated from protobuf field optional string self_link_with_id = 44520962; */ - private $self_link_with_id = null; + protected $self_link_with_id = null; /** * Constructor. diff --git a/Compute/src/V1/NetworkEdgeSecurityServiceAggregatedList.php b/Compute/src/V1/NetworkEdgeSecurityServiceAggregatedList.php index 0fd0ce79c4ce..be37a3508408 100644 --- a/Compute/src/V1/NetworkEdgeSecurityServiceAggregatedList.php +++ b/Compute/src/V1/NetworkEdgeSecurityServiceAggregatedList.php @@ -17,13 +17,13 @@ class NetworkEdgeSecurityServiceAggregatedList extends \Google\Protobuf\Internal /** * Generated from protobuf field optional string etag = 3123477; */ - private $etag = null; + protected $etag = null; /** * [Output Only] Unique identifier for the resource; defined by the server. * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of NetworkEdgeSecurityServicesScopedList resources. * @@ -35,19 +35,19 @@ class NetworkEdgeSecurityServiceAggregatedList extends \Google\Protobuf\Internal * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Unreachable resources. * @@ -59,7 +59,7 @@ class NetworkEdgeSecurityServiceAggregatedList extends \Google\Protobuf\Internal * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/NetworkEdgeSecurityServicesClient.php b/Compute/src/V1/NetworkEdgeSecurityServicesClient.php deleted file mode 100644 index 94505d58eb39..000000000000 --- a/Compute/src/V1/NetworkEdgeSecurityServicesClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/NetworkEndpoint.php b/Compute/src/V1/NetworkEndpoint.php index d56ecc155c89..a1892a36b73b 100644 --- a/Compute/src/V1/NetworkEndpoint.php +++ b/Compute/src/V1/NetworkEndpoint.php @@ -26,37 +26,37 @@ class NetworkEndpoint extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int32 client_destination_port = 123765766; */ - private $client_destination_port = null; + protected $client_destination_port = null; /** * Optional fully qualified domain name of network endpoint. This can only be specified when NetworkEndpointGroup.network_endpoint_type is NON_GCP_FQDN_PORT. * * Generated from protobuf field optional string fqdn = 3150485; */ - private $fqdn = null; + protected $fqdn = null; /** * The name or a URL of VM instance of this network endpoint. Optional, the field presence depends on the network endpoint type. The field is required for network endpoints of type GCE_VM_IP and GCE_VM_IP_PORT. The instance must be in the same zone of network endpoint group (for zonal NEGs) or in the zone within the region of the NEG (for regional NEGs). If the ipAddress is specified, it must belongs to the VM instance. The name must be 1-63 characters long, and comply with RFC1035 or be a valid URL pointing to an existing instance. * * Generated from protobuf field optional string instance = 18257045; */ - private $instance = null; + protected $instance = null; /** * Optional IPv4 address of network endpoint. The IP address must belong to a VM in Compute Engine (either the primary IP or as part of an aliased IP range). If the IP address is not specified, then the primary IP address for the VM instance in the network that the network endpoint group belongs to will be used. This field is redundant and need not be set for network endpoints of type GCE_VM_IP. If set, it must be set to the primary internal IP address of the attached VM instance that matches the subnetwork of the NEG. The primary internal IP address from any NIC of a multi-NIC VM instance can be added to a NEG as long as it matches the NEG subnetwork. * * Generated from protobuf field optional string ip_address = 406272220; */ - private $ip_address = null; + protected $ip_address = null; /** * Optional IPv6 address of network endpoint. * * Generated from protobuf field optional string ipv6_address = 341563804; */ - private $ipv6_address = null; + protected $ipv6_address = null; /** * Optional port number of network endpoint. If not specified, the defaultPort for the network endpoint group will be used. This field can not be set for network endpoints of type GCE_VM_IP. * * Generated from protobuf field optional int32 port = 3446913; */ - private $port = null; + protected $port = null; /** * Constructor. diff --git a/Compute/src/V1/NetworkEndpointGroup.php b/Compute/src/V1/NetworkEndpointGroup.php index 1bafc66879e3..e5ad29eff593 100644 --- a/Compute/src/V1/NetworkEndpointGroup.php +++ b/Compute/src/V1/NetworkEndpointGroup.php @@ -26,110 +26,110 @@ class NetworkEndpointGroup extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.NetworkEndpointGroupAppEngine app_engine = 340788768; */ - private $app_engine = null; + protected $app_engine = null; /** * Optional. Only valid when networkEndpointType is SERVERLESS. Only one of cloudRun, appEngine or cloudFunction may be set. * * Generated from protobuf field optional .google.cloud.compute.v1.NetworkEndpointGroupCloudFunction cloud_function = 519893666; */ - private $cloud_function = null; + protected $cloud_function = null; /** * Optional. Only valid when networkEndpointType is SERVERLESS. Only one of cloudRun, appEngine or cloudFunction may be set. * * Generated from protobuf field optional .google.cloud.compute.v1.NetworkEndpointGroupCloudRun cloud_run = 111060353; */ - private $cloud_run = null; + protected $cloud_run = null; /** * [Output Only] Creation timestamp in RFC3339 text format. * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * The default port used if the port number is not specified in the network endpoint. Optional. If the network endpoint type is either GCE_VM_IP, SERVERLESS or PRIVATE_SERVICE_CONNECT, this field must not be specified. * * Generated from protobuf field optional int32 default_port = 423377855; */ - private $default_port = null; + protected $default_port = null; /** * An optional description of this resource. Provide this property when you create the resource. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * [Output Only] The unique identifier for the resource. This identifier is defined by the server. * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * [Output Only] Type of the resource. Always compute#networkEndpointGroup for network endpoint group. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * Name of the resource; provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * The URL of the network to which all network endpoints in the NEG belong. Uses default project network if unspecified. * * Generated from protobuf field optional string network = 232872494; */ - private $network = null; + protected $network = null; /** * Type of network endpoints in this network endpoint group. Can be one of GCE_VM_IP, GCE_VM_IP_PORT, NON_GCP_PRIVATE_IP_PORT, INTERNET_FQDN_PORT, INTERNET_IP_PORT, SERVERLESS, PRIVATE_SERVICE_CONNECT, GCE_VM_IP_PORTMAP. * Check the NetworkEndpointType enum for the list of possible values. * * Generated from protobuf field optional string network_endpoint_type = 118301523; */ - private $network_endpoint_type = null; + protected $network_endpoint_type = null; /** * Optional. Only valid when networkEndpointType is PRIVATE_SERVICE_CONNECT. * * Generated from protobuf field optional .google.cloud.compute.v1.NetworkEndpointGroupPscData psc_data = 71937481; */ - private $psc_data = null; + protected $psc_data = null; /** * The target service url used to set up private service connection to a Google API or a PSC Producer Service Attachment. An example value is: asia-northeast3-cloudkms.googleapis.com. Optional. Only valid when networkEndpointType is PRIVATE_SERVICE_CONNECT. * * Generated from protobuf field optional string psc_target_service = 269132134; */ - private $psc_target_service = null; + protected $psc_target_service = null; /** * [Output Only] The URL of the region where the network endpoint group is located. * * Generated from protobuf field optional string region = 138946292; */ - private $region = null; + protected $region = null; /** * [Output Only] Server-defined URL for the resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output only] Number of network endpoints in the network endpoint group. * * Generated from protobuf field optional int32 size = 3530753; */ - private $size = null; + protected $size = null; /** * Optional URL of the subnetwork to which all network endpoints in the NEG belong. * * Generated from protobuf field optional string subnetwork = 307827694; */ - private $subnetwork = null; + protected $subnetwork = null; /** * [Output Only] The URL of the zone where the network endpoint group is located. * * Generated from protobuf field optional string zone = 3744684; */ - private $zone = null; + protected $zone = null; /** * Constructor. diff --git a/Compute/src/V1/NetworkEndpointGroupAggregatedList.php b/Compute/src/V1/NetworkEndpointGroupAggregatedList.php index 67a15a5eb049..6d7180bffd41 100644 --- a/Compute/src/V1/NetworkEndpointGroupAggregatedList.php +++ b/Compute/src/V1/NetworkEndpointGroupAggregatedList.php @@ -19,7 +19,7 @@ class NetworkEndpointGroupAggregatedList extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of NetworkEndpointGroupsScopedList resources. * @@ -31,19 +31,19 @@ class NetworkEndpointGroupAggregatedList extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Unreachable resources. * @@ -55,7 +55,7 @@ class NetworkEndpointGroupAggregatedList extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/NetworkEndpointGroupAppEngine.php b/Compute/src/V1/NetworkEndpointGroupAppEngine.php index dcd306db7ce8..c7181f4917fe 100644 --- a/Compute/src/V1/NetworkEndpointGroupAppEngine.php +++ b/Compute/src/V1/NetworkEndpointGroupAppEngine.php @@ -20,19 +20,19 @@ class NetworkEndpointGroupAppEngine extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string service = 373540533; */ - private $service = null; + protected $service = null; /** * An URL mask is one of the main components of the Cloud Function. A template to parse service and version fields from a request URL. URL mask allows for routing to multiple App Engine services without having to create multiple Network Endpoint Groups and backend services. For example, the request URLs foo1-dot-appname.appspot.com/v1 and foo1-dot-appname.appspot.com/v2 can be backed by the same Serverless NEG with URL mask -dot-appname.appspot.com/. The URL mask will parse them to { service = "foo1", version = "v1" } and { service = "foo1", version = "v2" } respectively. * * Generated from protobuf field optional string url_mask = 103352252; */ - private $url_mask = null; + protected $url_mask = null; /** * Optional serving version. The version name is case-sensitive and must be 1-100 characters long. Example value: v1, v2. * * Generated from protobuf field optional string version = 351608024; */ - private $version = null; + protected $version = null; /** * Constructor. diff --git a/Compute/src/V1/NetworkEndpointGroupCloudFunction.php b/Compute/src/V1/NetworkEndpointGroupCloudFunction.php index 95a912917a01..1114f19c43e7 100644 --- a/Compute/src/V1/NetworkEndpointGroupCloudFunction.php +++ b/Compute/src/V1/NetworkEndpointGroupCloudFunction.php @@ -20,13 +20,13 @@ class NetworkEndpointGroupCloudFunction extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field optional string function = 307196888; */ - private $function = null; + protected $function = null; /** * An URL mask is one of the main components of the Cloud Function. A template to parse function field from a request URL. URL mask allows for routing to multiple Cloud Functions without having to create multiple Network Endpoint Groups and backend services. For example, request URLs mydomain.com/function1 and mydomain.com/function2 can be backed by the same Serverless NEG with URL mask /. The URL mask will parse them to { function = "function1" } and { function = "function2" } respectively. * * Generated from protobuf field optional string url_mask = 103352252; */ - private $url_mask = null; + protected $url_mask = null; /** * Constructor. diff --git a/Compute/src/V1/NetworkEndpointGroupCloudRun.php b/Compute/src/V1/NetworkEndpointGroupCloudRun.php index 51d5c157a3e4..d6cb2ea5e6d2 100644 --- a/Compute/src/V1/NetworkEndpointGroupCloudRun.php +++ b/Compute/src/V1/NetworkEndpointGroupCloudRun.php @@ -20,19 +20,19 @@ class NetworkEndpointGroupCloudRun extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string service = 373540533; */ - private $service = null; + protected $service = null; /** * Optional Cloud Run tag represents the "named-revision" to provide additional fine-grained traffic routing information. The tag must be 1-63 characters long, and comply with RFC1035. Example value: "revision-0010". * * Generated from protobuf field optional string tag = 114586; */ - private $tag = null; + protected $tag = null; /** * An URL mask is one of the main components of the Cloud Function. A template to parse and fields from a request URL. URL mask allows for routing to multiple Run services without having to create multiple network endpoint groups and backend services. For example, request URLs foo1.domain.com/bar1 and foo1.domain.com/bar2 can be backed by the same Serverless Network Endpoint Group (NEG) with URL mask .domain.com/. The URL mask will parse them to { service="bar1", tag="foo1" } and { service="bar2", tag="foo2" } respectively. * * Generated from protobuf field optional string url_mask = 103352252; */ - private $url_mask = null; + protected $url_mask = null; /** * Constructor. diff --git a/Compute/src/V1/NetworkEndpointGroupList.php b/Compute/src/V1/NetworkEndpointGroupList.php index 96d2f46ae677..b5d0a1597be7 100644 --- a/Compute/src/V1/NetworkEndpointGroupList.php +++ b/Compute/src/V1/NetworkEndpointGroupList.php @@ -19,7 +19,7 @@ class NetworkEndpointGroupList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of NetworkEndpointGroup resources. * @@ -31,25 +31,25 @@ class NetworkEndpointGroupList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/NetworkEndpointGroupPscData.php b/Compute/src/V1/NetworkEndpointGroupPscData.php index 50c18014ec9c..ce05b8f2ab25 100644 --- a/Compute/src/V1/NetworkEndpointGroupPscData.php +++ b/Compute/src/V1/NetworkEndpointGroupPscData.php @@ -20,26 +20,26 @@ class NetworkEndpointGroupPscData extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string consumer_psc_address = 452646572; */ - private $consumer_psc_address = null; + protected $consumer_psc_address = null; /** * The psc producer port is used to connect PSC NEG with specific port on the PSC Producer side; should only be used for the PRIVATE_SERVICE_CONNECT NEG type * * Generated from protobuf field optional int32 producer_port = 410021134; */ - private $producer_port = null; + protected $producer_port = null; /** * [Output Only] The PSC connection id of the PSC Network Endpoint Group Consumer. * * Generated from protobuf field optional uint64 psc_connection_id = 292082397; */ - private $psc_connection_id = null; + protected $psc_connection_id = null; /** * [Output Only] The connection status of the PSC Forwarding Rule. * Check the PscConnectionStatus enum for the list of possible values. * * Generated from protobuf field optional string psc_connection_status = 184149172; */ - private $psc_connection_status = null; + protected $psc_connection_status = null; /** * Constructor. diff --git a/Compute/src/V1/NetworkEndpointGroupsClient.php b/Compute/src/V1/NetworkEndpointGroupsClient.php deleted file mode 100644 index 1d6934e5fcd8..000000000000 --- a/Compute/src/V1/NetworkEndpointGroupsClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional string health_status = 380545845; */ - private $health_status = null; + protected $health_status = null; /** * Constructor. diff --git a/Compute/src/V1/NetworkEndpointGroupsListNetworkEndpoints.php b/Compute/src/V1/NetworkEndpointGroupsListNetworkEndpoints.php index 70d01bb0eb08..c7190acbb47f 100644 --- a/Compute/src/V1/NetworkEndpointGroupsListNetworkEndpoints.php +++ b/Compute/src/V1/NetworkEndpointGroupsListNetworkEndpoints.php @@ -19,7 +19,7 @@ class NetworkEndpointGroupsListNetworkEndpoints extends \Google\Protobuf\Interna * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of NetworkEndpointWithHealthStatus resources. * @@ -31,19 +31,19 @@ class NetworkEndpointGroupsListNetworkEndpoints extends \Google\Protobuf\Interna * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/NetworkEndpointGroupsScopedList.php b/Compute/src/V1/NetworkEndpointGroupsScopedList.php index efc77959120c..8a2a3e7583fb 100644 --- a/Compute/src/V1/NetworkEndpointGroupsScopedList.php +++ b/Compute/src/V1/NetworkEndpointGroupsScopedList.php @@ -25,7 +25,7 @@ class NetworkEndpointGroupsScopedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/NetworkEndpointWithHealthStatus.php b/Compute/src/V1/NetworkEndpointWithHealthStatus.php index 9adf70d1247b..da558a649bac 100644 --- a/Compute/src/V1/NetworkEndpointWithHealthStatus.php +++ b/Compute/src/V1/NetworkEndpointWithHealthStatus.php @@ -25,7 +25,7 @@ class NetworkEndpointWithHealthStatus extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.NetworkEndpoint network_endpoint = 56789126; */ - private $network_endpoint = null; + protected $network_endpoint = null; /** * Constructor. diff --git a/Compute/src/V1/NetworkFirewallPoliciesClient.php b/Compute/src/V1/NetworkFirewallPoliciesClient.php deleted file mode 100644 index 33e3bc100462..000000000000 --- a/Compute/src/V1/NetworkFirewallPoliciesClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of FirewallPoliciesScopedList resources. * @@ -31,19 +31,19 @@ class NetworkFirewallPolicyAggregatedList extends \Google\Protobuf\Internal\Mess * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Unreachable resources. * @@ -55,7 +55,7 @@ class NetworkFirewallPolicyAggregatedList extends \Google\Protobuf\Internal\Mess * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/NetworkInterface.php b/Compute/src/V1/NetworkInterface.php index d87c52bb7de6..a4cb0ee72f0f 100644 --- a/Compute/src/V1/NetworkInterface.php +++ b/Compute/src/V1/NetworkInterface.php @@ -32,13 +32,13 @@ class NetworkInterface extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string fingerprint = 234678500; */ - private $fingerprint = null; + protected $fingerprint = null; /** * The prefix length of the primary internal IPv6 range. * * Generated from protobuf field optional int32 internal_ipv6_prefix_length = 203833757; */ - private $internal_ipv6_prefix_length = null; + protected $internal_ipv6_prefix_length = null; /** * An array of IPv6 access configurations for this interface. Currently, only one IPv6 access config, DIRECT_IPV6, is supported. If there is no ipv6AccessConfig specified, then this instance will have no external IPv6 Internet access. * @@ -51,69 +51,69 @@ class NetworkInterface extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string ipv6_access_type = 504658653; */ - private $ipv6_access_type = null; + protected $ipv6_access_type = null; /** * An IPv6 internal network address for this network interface. To use a static internal IP address, it must be unused and in the same region as the instance's zone. If not specified, Google Cloud will automatically assign an internal IPv6 address from the instance's subnetwork. * * Generated from protobuf field optional string ipv6_address = 341563804; */ - private $ipv6_address = null; + protected $ipv6_address = null; /** * [Output Only] Type of the resource. Always compute#networkInterface for network interfaces. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] The name of the network interface, which is generated by the server. For a VM, the network interface uses the nicN naming format. Where N is a value between 0 and 7. The default interface value is nic0. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * URL of the VPC network resource for this instance. When creating an instance, if neither the network nor the subnetwork is specified, the default network global/networks/default is used. If the selected project doesn't have the default network, you must specify a network or subnet. If the network is not specified but the subnetwork is specified, the network is inferred. If you specify this property, you can specify the network as a full or partial URL. For example, the following are all valid URLs: - https://www.googleapis.com/compute/v1/projects/project/global/networks/ network - projects/project/global/networks/network - global/networks/default * * Generated from protobuf field optional string network = 232872494; */ - private $network = null; + protected $network = null; /** * The URL of the network attachment that this interface should connect to in the following format: projects/{project_number}/regions/{region_name}/networkAttachments/{network_attachment_name}. * * Generated from protobuf field optional string network_attachment = 224644052; */ - private $network_attachment = null; + protected $network_attachment = null; /** * An IPv4 internal IP address to assign to the instance for this network interface. If not specified by the user, an unused internal IP is assigned by the system. * * Generated from protobuf field optional string network_i_p = 207181961; */ - private $network_i_p = null; + protected $network_i_p = null; /** * The type of vNIC to be used on this interface. This may be gVNIC or VirtioNet. * Check the NicType enum for the list of possible values. * * Generated from protobuf field optional string nic_type = 59810577; */ - private $nic_type = null; + protected $nic_type = null; /** * The networking queue count that's specified by users for the network interface. Both Rx and Tx queues will be set to this number. It'll be empty if not specified by the users. * * Generated from protobuf field optional int32 queue_count = 503708769; */ - private $queue_count = null; + protected $queue_count = null; /** * The stack type for this network interface. To assign only IPv4 addresses, use IPV4_ONLY. To assign both IPv4 and IPv6 addresses, use IPV4_IPV6. If not specified, IPV4_ONLY is used. This field can be both set at instance creation and update network interface operations. * Check the StackType enum for the list of possible values. * * Generated from protobuf field optional string stack_type = 425908881; */ - private $stack_type = null; + protected $stack_type = null; /** * The URL of the Subnetwork resource for this instance. If the network resource is in legacy mode, do not specify this field. If the network is in auto subnet mode, specifying the subnetwork is optional. If the network is in custom subnet mode, specifying the subnetwork is required. If you specify this field, you can specify the subnetwork as a full or partial URL. For example, the following are all valid URLs: - https://www.googleapis.com/compute/v1/projects/project/regions/region /subnetworks/subnetwork - regions/region/subnetworks/subnetwork * * Generated from protobuf field optional string subnetwork = 307827694; */ - private $subnetwork = null; + protected $subnetwork = null; /** * Constructor. diff --git a/Compute/src/V1/NetworkList.php b/Compute/src/V1/NetworkList.php index 6e94e965e215..bdce11a10503 100644 --- a/Compute/src/V1/NetworkList.php +++ b/Compute/src/V1/NetworkList.php @@ -20,7 +20,7 @@ class NetworkList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of Network resources. * @@ -32,25 +32,25 @@ class NetworkList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/NetworkPeering.php b/Compute/src/V1/NetworkPeering.php index 6f05409f571c..7b7b089d910c 100644 --- a/Compute/src/V1/NetworkPeering.php +++ b/Compute/src/V1/NetworkPeering.php @@ -20,88 +20,88 @@ class NetworkPeering extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional bool auto_create_routes = 57454941; */ - private $auto_create_routes = null; + protected $auto_create_routes = null; /** * [Output Only] The effective state of the peering connection as a whole. * * Generated from protobuf field optional .google.cloud.compute.v1.NetworkPeeringConnectionStatus connection_status = 525629555; */ - private $connection_status = null; + protected $connection_status = null; /** * Indicates whether full mesh connectivity is created and managed automatically between peered networks. Currently this field should always be true since Google Compute Engine will automatically create and manage subnetwork routes between two networks when peering state is ACTIVE. * * Generated from protobuf field optional bool exchange_subnet_routes = 26322256; */ - private $exchange_subnet_routes = null; + protected $exchange_subnet_routes = null; /** * Whether to export the custom routes to peer network. The default value is false. * * Generated from protobuf field optional bool export_custom_routes = 60281485; */ - private $export_custom_routes = null; + protected $export_custom_routes = null; /** * Whether subnet routes with public IP range are exported. The default value is true, all subnet routes are exported. IPv4 special-use ranges are always exported to peers and are not controlled by this field. * * Generated from protobuf field optional bool export_subnet_routes_with_public_ip = 97940834; */ - private $export_subnet_routes_with_public_ip = null; + protected $export_subnet_routes_with_public_ip = null; /** * Whether to import the custom routes from peer network. The default value is false. * * Generated from protobuf field optional bool import_custom_routes = 197982398; */ - private $import_custom_routes = null; + protected $import_custom_routes = null; /** * Whether subnet routes with public IP range are imported. The default value is false. IPv4 special-use ranges are always imported from peers and are not controlled by this field. * * Generated from protobuf field optional bool import_subnet_routes_with_public_ip = 14419729; */ - private $import_subnet_routes_with_public_ip = null; + protected $import_subnet_routes_with_public_ip = null; /** * Name of this peering. Provided by the client when the peering is created. The name must comply with RFC1035. Specifically, the name must be 1-63 characters long and match regular expression `[a-z]([-a-z0-9]*[a-z0-9])?`. The first character must be a lowercase letter, and all the following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * The URL of the peer network. It can be either full URL or partial URL. The peer network may belong to a different project. If the partial URL does not contain project, it is assumed that the peer network is in the same project as the current network. * * Generated from protobuf field optional string network = 232872494; */ - private $network = null; + protected $network = null; /** * [Output Only] Maximum Transmission Unit in bytes of the peer network. * * Generated from protobuf field optional int32 peer_mtu = 69584721; */ - private $peer_mtu = null; + protected $peer_mtu = null; /** * Which IP version(s) of traffic and routes are allowed to be imported or exported between peer networks. The default value is IPV4_ONLY. * Check the StackType enum for the list of possible values. * * Generated from protobuf field optional string stack_type = 425908881; */ - private $stack_type = null; + protected $stack_type = null; /** * [Output Only] State for the peering, either `ACTIVE` or `INACTIVE`. The peering is `ACTIVE` when there's a matching configuration in the peer network. * Check the State enum for the list of possible values. * * Generated from protobuf field optional string state = 109757585; */ - private $state = null; + protected $state = null; /** * [Output Only] Details about the current state of the peering. * * Generated from protobuf field optional string state_details = 95566996; */ - private $state_details = null; + protected $state_details = null; /** * The update strategy determines the semantics for updates and deletes to the peering connection configuration. * Check the UpdateStrategy enum for the list of possible values. * * Generated from protobuf field optional string update_strategy = 6123049; */ - private $update_strategy = null; + protected $update_strategy = null; /** * Constructor. diff --git a/Compute/src/V1/NetworkPeeringConnectionStatus.php b/Compute/src/V1/NetworkPeeringConnectionStatus.php index 2cc43ed1034e..5b93a66a8e8c 100644 --- a/Compute/src/V1/NetworkPeeringConnectionStatus.php +++ b/Compute/src/V1/NetworkPeeringConnectionStatus.php @@ -20,20 +20,20 @@ class NetworkPeeringConnectionStatus extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.NetworkPeeringConnectionStatusConsensusState consensus_state = 379772617; */ - private $consensus_state = null; + protected $consensus_state = null; /** * The active connectivity settings for the peering connection based on the settings of the network peerings. * * Generated from protobuf field optional .google.cloud.compute.v1.NetworkPeeringConnectionStatusTrafficConfiguration traffic_configuration = 133016116; */ - private $traffic_configuration = null; + protected $traffic_configuration = null; /** * The update strategy determines the update/delete semantics for this peering connection. * Check the UpdateStrategy enum for the list of possible values. * * Generated from protobuf field optional string update_strategy = 6123049; */ - private $update_strategy = null; + protected $update_strategy = null; /** * Constructor. diff --git a/Compute/src/V1/NetworkPeeringConnectionStatusConsensusState.php b/Compute/src/V1/NetworkPeeringConnectionStatusConsensusState.php index a616b9c481fe..488b5340266d 100644 --- a/Compute/src/V1/NetworkPeeringConnectionStatusConsensusState.php +++ b/Compute/src/V1/NetworkPeeringConnectionStatusConsensusState.php @@ -21,14 +21,14 @@ class NetworkPeeringConnectionStatusConsensusState extends \Google\Protobuf\Inte * * Generated from protobuf field optional string delete_status = 483434758; */ - private $delete_status = null; + protected $delete_status = null; /** * The status of the update request. * Check the UpdateStatus enum for the list of possible values. * * Generated from protobuf field optional string update_status = 265998376; */ - private $update_status = null; + protected $update_status = null; /** * Constructor. diff --git a/Compute/src/V1/NetworkPeeringConnectionStatusTrafficConfiguration.php b/Compute/src/V1/NetworkPeeringConnectionStatusTrafficConfiguration.php index 33daedb9542b..80bd6e4b47b6 100644 --- a/Compute/src/V1/NetworkPeeringConnectionStatusTrafficConfiguration.php +++ b/Compute/src/V1/NetworkPeeringConnectionStatusTrafficConfiguration.php @@ -19,32 +19,32 @@ class NetworkPeeringConnectionStatusTrafficConfiguration extends \Google\Protobu * * Generated from protobuf field optional bool export_custom_routes_to_peer = 286428404; */ - private $export_custom_routes_to_peer = null; + protected $export_custom_routes_to_peer = null; /** * Whether subnet routes with public IP ranges are being exported to the peer network. * * Generated from protobuf field optional bool export_subnet_routes_with_public_ip_to_peer = 8358601; */ - private $export_subnet_routes_with_public_ip_to_peer = null; + protected $export_subnet_routes_with_public_ip_to_peer = null; /** * Whether custom routes are being imported from the peer network. * * Generated from protobuf field optional bool import_custom_routes_from_peer = 398584470; */ - private $import_custom_routes_from_peer = null; + protected $import_custom_routes_from_peer = null; /** * Whether subnet routes with public IP ranges are being imported from the peer network. * * Generated from protobuf field optional bool import_subnet_routes_with_public_ip_from_peer = 234712361; */ - private $import_subnet_routes_with_public_ip_from_peer = null; + protected $import_subnet_routes_with_public_ip_from_peer = null; /** * Which IP version(s) of traffic and routes are being imported or exported between peer networks. * Check the StackType enum for the list of possible values. * * Generated from protobuf field optional string stack_type = 425908881; */ - private $stack_type = null; + protected $stack_type = null; /** * Constructor. diff --git a/Compute/src/V1/NetworkPerformanceConfig.php b/Compute/src/V1/NetworkPerformanceConfig.php index df56e8de210a..03426af1668f 100644 --- a/Compute/src/V1/NetworkPerformanceConfig.php +++ b/Compute/src/V1/NetworkPerformanceConfig.php @@ -20,7 +20,7 @@ class NetworkPerformanceConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string total_egress_bandwidth_tier = 130109439; */ - private $total_egress_bandwidth_tier = null; + protected $total_egress_bandwidth_tier = null; /** * Constructor. diff --git a/Compute/src/V1/NetworkProfile.php b/Compute/src/V1/NetworkProfile.php index 2f3f6ba06ffc..01f5d65c8756 100644 --- a/Compute/src/V1/NetworkProfile.php +++ b/Compute/src/V1/NetworkProfile.php @@ -20,59 +20,59 @@ class NetworkProfile extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * [Output Only] An optional description of this resource. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * [Output Only] Features supported by the network. * * Generated from protobuf field optional .google.cloud.compute.v1.NetworkProfileNetworkFeatures features = 246211645; */ - private $features = null; + protected $features = null; /** * [Output Only] The unique identifier for the resource. This identifier is defined by the server. * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * [Output Only] Type of the resource. Always compute#networkProfile for network profiles. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] Location to which the network is restricted. * * Generated from protobuf field optional .google.cloud.compute.v1.NetworkProfileLocation location = 290430901; */ - private $location = null; + protected $location = null; /** * [Output Only] Name of the resource. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * [Output Only] Server-defined URL for the resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Server-defined URL for this resource with the resource id. * * Generated from protobuf field optional string self_link_with_id = 44520962; */ - private $self_link_with_id = null; + protected $self_link_with_id = null; /** * Generated from protobuf field optional string zone = 3744684; */ - private $zone = null; + protected $zone = null; /** * Constructor. diff --git a/Compute/src/V1/NetworkProfileLocation.php b/Compute/src/V1/NetworkProfileLocation.php index 135d5bce0126..fc8a1b3bef57 100644 --- a/Compute/src/V1/NetworkProfileLocation.php +++ b/Compute/src/V1/NetworkProfileLocation.php @@ -17,14 +17,14 @@ class NetworkProfileLocation extends \Google\Protobuf\Internal\Message /** * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * * Check the Scope enum for the list of possible values. * * Generated from protobuf field optional string scope = 109264468; */ - private $scope = null; + protected $scope = null; /** * Constructor. diff --git a/Compute/src/V1/NetworkProfileNetworkFeatures.php b/Compute/src/V1/NetworkProfileNetworkFeatures.php index f51d937f91cd..9c274cb4860d 100644 --- a/Compute/src/V1/NetworkProfileNetworkFeatures.php +++ b/Compute/src/V1/NetworkProfileNetworkFeatures.php @@ -27,147 +27,147 @@ class NetworkProfileNetworkFeatures extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string allow_alias_ip_ranges = 457984201; */ - private $allow_alias_ip_ranges = null; + protected $allow_alias_ip_ranges = null; /** * Specifies whether auto mode subnet creation is allowed. * Check the AllowAutoModeSubnet enum for the list of possible values. * * Generated from protobuf field optional string allow_auto_mode_subnet = 152191263; */ - private $allow_auto_mode_subnet = null; + protected $allow_auto_mode_subnet = null; /** * Specifies whether firewalls for Class D address ranges are supported. * Check the AllowClassDFirewalls enum for the list of possible values. * * Generated from protobuf field optional string allow_class_d_firewalls = 131608987; */ - private $allow_class_d_firewalls = null; + protected $allow_class_d_firewalls = null; /** * Specifies whether cloud NAT creation is allowed. * Check the AllowCloudNat enum for the list of possible values. * * Generated from protobuf field optional string allow_cloud_nat = 254831265; */ - private $allow_cloud_nat = null; + protected $allow_cloud_nat = null; /** * Specifies whether cloud router creation is allowed. * Check the AllowCloudRouter enum for the list of possible values. * * Generated from protobuf field optional string allow_cloud_router = 451110345; */ - private $allow_cloud_router = null; + protected $allow_cloud_router = null; /** * Specifies whether default NIC attachment is allowed. * Check the AllowDefaultNicAttachment enum for the list of possible values. * * Generated from protobuf field optional string allow_default_nic_attachment = 53917486; */ - private $allow_default_nic_attachment = null; + protected $allow_default_nic_attachment = null; /** * Specifies whether VMs are allowed to have external IP access on network interfaces connected to this VPC. * Check the AllowExternalIpAccess enum for the list of possible values. * * Generated from protobuf field optional string allow_external_ip_access = 131538110; */ - private $allow_external_ip_access = null; + protected $allow_external_ip_access = null; /** * Specifies whether Cloud Interconnect creation is allowed. * Check the AllowInterconnect enum for the list of possible values. * * Generated from protobuf field optional string allow_interconnect = 280512964; */ - private $allow_interconnect = null; + protected $allow_interconnect = null; /** * Specifies whether IP forwarding is allowed. * Check the AllowIpForwarding enum for the list of possible values. * * Generated from protobuf field optional string allow_ip_forwarding = 500838047; */ - private $allow_ip_forwarding = null; + protected $allow_ip_forwarding = null; /** * Specifies whether cloud load balancing is allowed. * Check the AllowLoadBalancing enum for the list of possible values. * * Generated from protobuf field optional string allow_load_balancing = 223366198; */ - private $allow_load_balancing = null; + protected $allow_load_balancing = null; /** * Specifies whether multi-nic in the same network is allowed. * Check the AllowMultiNicInSameNetwork enum for the list of possible values. * * Generated from protobuf field optional string allow_multi_nic_in_same_network = 88251004; */ - private $allow_multi_nic_in_same_network = null; + protected $allow_multi_nic_in_same_network = null; /** * Specifies whether NCC is allowed. * Check the AllowNcc enum for the list of possible values. * * Generated from protobuf field optional string allow_ncc = 372354904; */ - private $allow_ncc = null; + protected $allow_ncc = null; /** * Specifies whether VM network migration is allowed. * Check the AllowNetworkMigration enum for the list of possible values. * * Generated from protobuf field optional string allow_network_migration = 239588231; */ - private $allow_network_migration = null; + protected $allow_network_migration = null; /** * Specifies whether Packet Mirroring 1.0 is supported. * Check the AllowPacketMirroring enum for the list of possible values. * * Generated from protobuf field optional string allow_packet_mirroring = 512227074; */ - private $allow_packet_mirroring = null; + protected $allow_packet_mirroring = null; /** * Specifies whether private Google access is allowed. * Check the AllowPrivateGoogleAccess enum for the list of possible values. * * Generated from protobuf field optional string allow_private_google_access = 374702072; */ - private $allow_private_google_access = null; + protected $allow_private_google_access = null; /** * Specifies whether PSC creation is allowed. * Check the AllowPsc enum for the list of possible values. * * Generated from protobuf field optional string allow_psc = 372357322; */ - private $allow_psc = null; + protected $allow_psc = null; /** * Specifies whether unicast within the same network is allowed. * Check the AllowSameNetworkUnicast enum for the list of possible values. * * Generated from protobuf field optional string allow_same_network_unicast = 167531643; */ - private $allow_same_network_unicast = null; + protected $allow_same_network_unicast = null; /** * Specifies whether static route creation is allowed. * Check the AllowStaticRoutes enum for the list of possible values. * * Generated from protobuf field optional string allow_static_routes = 185257925; */ - private $allow_static_routes = null; + protected $allow_static_routes = null; /** * Specifies whether sub interfaces are allowed. * Check the AllowSubInterfaces enum for the list of possible values. * * Generated from protobuf field optional string allow_sub_interfaces = 247208303; */ - private $allow_sub_interfaces = null; + protected $allow_sub_interfaces = null; /** * Specifies whether VPC peering is allowed. * Check the AllowVpcPeering enum for the list of possible values. * * Generated from protobuf field optional string allow_vpc_peering = 115402228; */ - private $allow_vpc_peering = null; + protected $allow_vpc_peering = null; /** * Specifies whether VPN creation is allowed. * Check the AllowVpn enum for the list of possible values. * * Generated from protobuf field optional string allow_vpn = 372363006; */ - private $allow_vpn = null; + protected $allow_vpn = null; /** * If set, limits the interface types that the network supports. If empty, all interface types are supported. * Check the InterfaceTypes enum for the list of possible values. @@ -209,7 +209,7 @@ class NetworkProfileNetworkFeatures extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string unicast = 249841711; */ - private $unicast = null; + protected $unicast = null; /** * Constructor. diff --git a/Compute/src/V1/NetworkProfilesClient.php b/Compute/src/V1/NetworkProfilesClient.php deleted file mode 100644 index d304e1a9dcae..000000000000 --- a/Compute/src/V1/NetworkProfilesClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional string etag = 3123477; */ - private $etag = null; + protected $etag = null; /** * [Output Only] Unique identifier for the resource; defined by the server. * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of NetworkProfile resources. * @@ -36,19 +36,19 @@ class NetworkProfilesListResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Unreachable resources. end_interface: MixerListResponseWithEtagBuilder * @@ -60,7 +60,7 @@ class NetworkProfilesListResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/NetworkRoutingConfig.php b/Compute/src/V1/NetworkRoutingConfig.php index 327042e17a00..86832b9dd452 100644 --- a/Compute/src/V1/NetworkRoutingConfig.php +++ b/Compute/src/V1/NetworkRoutingConfig.php @@ -20,41 +20,41 @@ class NetworkRoutingConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional bool bgp_always_compare_med = 213102902; */ - private $bgp_always_compare_med = null; + protected $bgp_always_compare_med = null; /** * The BGP best path selection algorithm to be employed within this network for dynamic routes learned by Cloud Routers. Can be LEGACY (default) or STANDARD. * Check the BgpBestPathSelectionMode enum for the list of possible values. * * Generated from protobuf field optional string bgp_best_path_selection_mode = 317816297; */ - private $bgp_best_path_selection_mode = null; + protected $bgp_best_path_selection_mode = null; /** * Allows to define a preferred approach for handling inter-region cost in the selection process when using the STANDARD BGP best path selection algorithm. Can be DEFAULT or ADD_COST_TO_MED. * Check the BgpInterRegionCost enum for the list of possible values. * * Generated from protobuf field optional string bgp_inter_region_cost = 462142689; */ - private $bgp_inter_region_cost = null; + protected $bgp_inter_region_cost = null; /** * [Output Only] Effective value of the bgp_always_compare_med field. * * Generated from protobuf field optional bool effective_bgp_always_compare_med = 214661838; */ - private $effective_bgp_always_compare_med = null; + protected $effective_bgp_always_compare_med = null; /** * [Output Only] Effective value of the bgp_inter_region_cost field. * Check the EffectiveBgpInterRegionCost enum for the list of possible values. * * Generated from protobuf field optional string effective_bgp_inter_region_cost = 185098313; */ - private $effective_bgp_inter_region_cost = null; + protected $effective_bgp_inter_region_cost = null; /** * The network-wide routing mode to use. If set to REGIONAL, this network's Cloud Routers will only advertise routes with subnets of this network in the same region as the router. If set to GLOBAL, this network's Cloud Routers will advertise routes with all subnets of this network, across regions. * Check the RoutingMode enum for the list of possible values. * * Generated from protobuf field optional string routing_mode = 475143548; */ - private $routing_mode = null; + protected $routing_mode = null; /** * Constructor. diff --git a/Compute/src/V1/NetworksAddPeeringRequest.php b/Compute/src/V1/NetworksAddPeeringRequest.php index 086997ba917d..acb5972a02e3 100644 --- a/Compute/src/V1/NetworksAddPeeringRequest.php +++ b/Compute/src/V1/NetworksAddPeeringRequest.php @@ -19,25 +19,25 @@ class NetworksAddPeeringRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional bool auto_create_routes = 57454941; */ - private $auto_create_routes = null; + protected $auto_create_routes = null; /** * Name of the peering, which should conform to RFC1035. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * Network peering parameters. In order to specify route policies for peering using import and export custom routes, you must specify all peering related parameters (name, peer network, exchange_subnet_routes) in the network_peering field. The corresponding fields in NetworksAddPeeringRequest will be deprecated soon. * * Generated from protobuf field optional .google.cloud.compute.v1.NetworkPeering network_peering = 328926767; */ - private $network_peering = null; + protected $network_peering = null; /** * URL of the peer network. It can be either full URL or partial URL. The peer network may belong to a different project. If the partial URL does not contain project, it is assumed that the peer network is in the same project as the current network. * * Generated from protobuf field optional string peer_network = 500625489; */ - private $peer_network = null; + protected $peer_network = null; /** * Constructor. diff --git a/Compute/src/V1/NetworksClient.php b/Compute/src/V1/NetworksClient.php deleted file mode 100644 index 1af4ca965a9d..000000000000 --- a/Compute/src/V1/NetworksClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional string display_name = 4473832; */ - private $display_name = null; + protected $display_name = null; /** * [Output Only] The name of the firewall policy. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * [Output Only] The packet mirroring rules that apply to the network. * @@ -37,7 +37,7 @@ class NetworksGetEffectiveFirewallsResponseEffectiveFirewallPolicy extends \Goog * * Generated from protobuf field optional int32 priority = 445151652; */ - private $priority = null; + protected $priority = null; /** * [Output Only] The rules that apply to the network. * @@ -49,14 +49,14 @@ class NetworksGetEffectiveFirewallsResponseEffectiveFirewallPolicy extends \Goog * * Generated from protobuf field optional string short_name = 492051566; */ - private $short_name = null; + protected $short_name = null; /** * [Output Only] The type of the firewall policy. * Check the Type enum for the list of possible values. * * Generated from protobuf field optional string type = 3575610; */ - private $type = null; + protected $type = null; /** * Constructor. diff --git a/Compute/src/V1/NetworksRemovePeeringRequest.php b/Compute/src/V1/NetworksRemovePeeringRequest.php index ce6e5e73bfbc..75ad9fb8e25e 100644 --- a/Compute/src/V1/NetworksRemovePeeringRequest.php +++ b/Compute/src/V1/NetworksRemovePeeringRequest.php @@ -19,7 +19,7 @@ class NetworksRemovePeeringRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * Constructor. diff --git a/Compute/src/V1/NetworksRequestRemovePeeringRequest.php b/Compute/src/V1/NetworksRequestRemovePeeringRequest.php index 43aaa9499c1f..e398859b6bf6 100644 --- a/Compute/src/V1/NetworksRequestRemovePeeringRequest.php +++ b/Compute/src/V1/NetworksRequestRemovePeeringRequest.php @@ -19,7 +19,7 @@ class NetworksRequestRemovePeeringRequest extends \Google\Protobuf\Internal\Mess * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * Constructor. diff --git a/Compute/src/V1/NetworksUpdatePeeringRequest.php b/Compute/src/V1/NetworksUpdatePeeringRequest.php index cf7320abfca2..8401cbbec22a 100644 --- a/Compute/src/V1/NetworksUpdatePeeringRequest.php +++ b/Compute/src/V1/NetworksUpdatePeeringRequest.php @@ -17,7 +17,7 @@ class NetworksUpdatePeeringRequest extends \Google\Protobuf\Internal\Message /** * Generated from protobuf field optional .google.cloud.compute.v1.NetworkPeering network_peering = 328926767; */ - private $network_peering = null; + protected $network_peering = null; /** * Constructor. diff --git a/Compute/src/V1/NodeGroup.php b/Compute/src/V1/NodeGroup.php index 7e5697b21cde..afe1f13bd874 100644 --- a/Compute/src/V1/NodeGroup.php +++ b/Compute/src/V1/NodeGroup.php @@ -20,102 +20,102 @@ class NodeGroup extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.NodeGroupAutoscalingPolicy autoscaling_policy = 221950041; */ - private $autoscaling_policy = null; + protected $autoscaling_policy = null; /** * [Output Only] Creation timestamp in RFC3339 text format. * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * An optional description of this resource. Provide this property when you create the resource. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * Generated from protobuf field optional string fingerprint = 234678500; */ - private $fingerprint = null; + protected $fingerprint = null; /** * [Output Only] The unique identifier for the resource. This identifier is defined by the server. * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * [Output Only] The type of the resource. Always compute#nodeGroup for node group. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * An opaque location hint used to place the Node close to other resources. This field is for use by internal tools that use the public API. The location hint here on the NodeGroup overrides any location_hint present in the NodeTemplate. * * Generated from protobuf field optional string location_hint = 350519505; */ - private $location_hint = null; + protected $location_hint = null; /** * Specifies the frequency of planned maintenance events. The accepted values are: `AS_NEEDED` and `RECURRENT`. * Check the MaintenanceInterval enum for the list of possible values. * * Generated from protobuf field optional string maintenance_interval = 403368049; */ - private $maintenance_interval = null; + protected $maintenance_interval = null; /** * Specifies how to handle instances when a node in the group undergoes maintenance. Set to one of: DEFAULT, RESTART_IN_PLACE, or MIGRATE_WITHIN_NODE_GROUP. The default value is DEFAULT. For more information, see Maintenance policies. * Check the MaintenancePolicy enum for the list of possible values. * * Generated from protobuf field optional string maintenance_policy = 528327646; */ - private $maintenance_policy = null; + protected $maintenance_policy = null; /** * Generated from protobuf field optional .google.cloud.compute.v1.NodeGroupMaintenanceWindow maintenance_window = 186374812; */ - private $maintenance_window = null; + protected $maintenance_window = null; /** * The name of the resource, provided by the client when initially creating the resource. The resource name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * URL of the node template to create the node group from. * * Generated from protobuf field optional string node_template = 323154455; */ - private $node_template = null; + protected $node_template = null; /** * [Output Only] Server-defined URL for the resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * Share-settings for the node group * * Generated from protobuf field optional .google.cloud.compute.v1.ShareSettings share_settings = 266668163; */ - private $share_settings = null; + protected $share_settings = null; /** * [Output Only] The total number of nodes in the node group. * * Generated from protobuf field optional int32 size = 3530753; */ - private $size = null; + protected $size = null; /** * * Check the Status enum for the list of possible values. * * Generated from protobuf field optional string status = 181260274; */ - private $status = null; + protected $status = null; /** * [Output Only] The name of the zone where the node group resides, such as us-central1-a. * * Generated from protobuf field optional string zone = 3744684; */ - private $zone = null; + protected $zone = null; /** * Constructor. diff --git a/Compute/src/V1/NodeGroupAggregatedList.php b/Compute/src/V1/NodeGroupAggregatedList.php index 2b2c6f021d38..13c89c4c8e8c 100644 --- a/Compute/src/V1/NodeGroupAggregatedList.php +++ b/Compute/src/V1/NodeGroupAggregatedList.php @@ -19,7 +19,7 @@ class NodeGroupAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of NodeGroupsScopedList resources. * @@ -31,19 +31,19 @@ class NodeGroupAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Unreachable resources. * @@ -55,7 +55,7 @@ class NodeGroupAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/NodeGroupAutoscalingPolicy.php b/Compute/src/V1/NodeGroupAutoscalingPolicy.php index 6fec4d7596ce..6ea6106f330b 100644 --- a/Compute/src/V1/NodeGroupAutoscalingPolicy.php +++ b/Compute/src/V1/NodeGroupAutoscalingPolicy.php @@ -19,20 +19,20 @@ class NodeGroupAutoscalingPolicy extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int32 max_nodes = 297762838; */ - private $max_nodes = null; + protected $max_nodes = null; /** * The minimum number of nodes that the group should have. * * Generated from protobuf field optional int32 min_nodes = 533370500; */ - private $min_nodes = null; + protected $min_nodes = null; /** * The autoscaling mode. Set to one of: ON, OFF, or ONLY_SCALE_OUT. For more information, see Autoscaler modes. * Check the Mode enum for the list of possible values. * * Generated from protobuf field optional string mode = 3357091; */ - private $mode = null; + protected $mode = null; /** * Constructor. diff --git a/Compute/src/V1/NodeGroupList.php b/Compute/src/V1/NodeGroupList.php index e288240e4ac6..c0856d85ddaf 100644 --- a/Compute/src/V1/NodeGroupList.php +++ b/Compute/src/V1/NodeGroupList.php @@ -20,7 +20,7 @@ class NodeGroupList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of NodeGroup resources. * @@ -32,25 +32,25 @@ class NodeGroupList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/NodeGroupMaintenanceWindow.php b/Compute/src/V1/NodeGroupMaintenanceWindow.php index c71073494574..b52b69bb2502 100644 --- a/Compute/src/V1/NodeGroupMaintenanceWindow.php +++ b/Compute/src/V1/NodeGroupMaintenanceWindow.php @@ -20,13 +20,13 @@ class NodeGroupMaintenanceWindow extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.Duration maintenance_duration = 525291840; */ - private $maintenance_duration = null; + protected $maintenance_duration = null; /** * Start time of the window. This must be in UTC format that resolves to one of 00:00, 04:00, 08:00, 12:00, 16:00, or 20:00. For example, both 13:00-5 and 08:00 are valid. * * Generated from protobuf field optional string start_time = 37467274; */ - private $start_time = null; + protected $start_time = null; /** * Constructor. diff --git a/Compute/src/V1/NodeGroupNode.php b/Compute/src/V1/NodeGroupNode.php index 9072c985fdaf..edb86b7b4e94 100644 --- a/Compute/src/V1/NodeGroupNode.php +++ b/Compute/src/V1/NodeGroupNode.php @@ -25,14 +25,14 @@ class NodeGroupNode extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.InstanceConsumptionInfo consumed_resources = 334527118; */ - private $consumed_resources = null; + protected $consumed_resources = null; /** * CPU overcommit. * Check the CpuOvercommitType enum for the list of possible values. * * Generated from protobuf field optional string cpu_overcommit_type = 247727959; */ - private $cpu_overcommit_type = null; + protected $cpu_overcommit_type = null; /** * Local disk configurations. * @@ -56,50 +56,50 @@ class NodeGroupNode extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * The type of this node. * * Generated from protobuf field optional string node_type = 465832791; */ - private $node_type = null; + protected $node_type = null; /** * [Output Only] Reserved for future use. * * Generated from protobuf field optional bool satisfies_pzs = 480964267; */ - private $satisfies_pzs = null; + protected $satisfies_pzs = null; /** * Binding properties for the physical server. * * Generated from protobuf field optional .google.cloud.compute.v1.ServerBinding server_binding = 208179593; */ - private $server_binding = null; + protected $server_binding = null; /** * Server ID associated with this node. * * Generated from protobuf field optional string server_id = 339433367; */ - private $server_id = null; + protected $server_id = null; /** * * Check the Status enum for the list of possible values. * * Generated from protobuf field optional string status = 181260274; */ - private $status = null; + protected $status = null; /** * Total amount of available resources on the node. * * Generated from protobuf field optional .google.cloud.compute.v1.InstanceConsumptionInfo total_resources = 97406698; */ - private $total_resources = null; + protected $total_resources = null; /** * [Output Only] The information about an upcoming maintenance event. * * Generated from protobuf field optional .google.cloud.compute.v1.UpcomingMaintenance upcoming_maintenance = 227348592; */ - private $upcoming_maintenance = null; + protected $upcoming_maintenance = null; /** * Constructor. diff --git a/Compute/src/V1/NodeGroupsAddNodesRequest.php b/Compute/src/V1/NodeGroupsAddNodesRequest.php index 7564430640d5..cf42c2bd19b1 100644 --- a/Compute/src/V1/NodeGroupsAddNodesRequest.php +++ b/Compute/src/V1/NodeGroupsAddNodesRequest.php @@ -19,7 +19,7 @@ class NodeGroupsAddNodesRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int32 additional_node_count = 134997930; */ - private $additional_node_count = null; + protected $additional_node_count = null; /** * Constructor. diff --git a/Compute/src/V1/NodeGroupsClient.php b/Compute/src/V1/NodeGroupsClient.php deleted file mode 100644 index 61be5ff8567f..000000000000 --- a/Compute/src/V1/NodeGroupsClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of Node resources. * @@ -31,25 +31,25 @@ class NodeGroupsListNodes extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/NodeGroupsPerformMaintenanceRequest.php b/Compute/src/V1/NodeGroupsPerformMaintenanceRequest.php index 0e92cd0a2978..234dc8196998 100644 --- a/Compute/src/V1/NodeGroupsPerformMaintenanceRequest.php +++ b/Compute/src/V1/NodeGroupsPerformMaintenanceRequest.php @@ -25,7 +25,7 @@ class NodeGroupsPerformMaintenanceRequest extends \Google\Protobuf\Internal\Mess * * Generated from protobuf field optional string start_time = 37467274; */ - private $start_time = null; + protected $start_time = null; /** * Constructor. diff --git a/Compute/src/V1/NodeGroupsScopedList.php b/Compute/src/V1/NodeGroupsScopedList.php index 97d500793e4f..702c8f1d16cf 100644 --- a/Compute/src/V1/NodeGroupsScopedList.php +++ b/Compute/src/V1/NodeGroupsScopedList.php @@ -25,7 +25,7 @@ class NodeGroupsScopedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/NodeGroupsSetNodeTemplateRequest.php b/Compute/src/V1/NodeGroupsSetNodeTemplateRequest.php index 37be3bf9746e..48a0478774a4 100644 --- a/Compute/src/V1/NodeGroupsSetNodeTemplateRequest.php +++ b/Compute/src/V1/NodeGroupsSetNodeTemplateRequest.php @@ -19,7 +19,7 @@ class NodeGroupsSetNodeTemplateRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string node_template = 323154455; */ - private $node_template = null; + protected $node_template = null; /** * Constructor. diff --git a/Compute/src/V1/NodeTemplate.php b/Compute/src/V1/NodeTemplate.php index aa7c964c5013..067c1e33dc32 100644 --- a/Compute/src/V1/NodeTemplate.php +++ b/Compute/src/V1/NodeTemplate.php @@ -25,19 +25,19 @@ class NodeTemplate extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string cpu_overcommit_type = 247727959; */ - private $cpu_overcommit_type = null; + protected $cpu_overcommit_type = null; /** * [Output Only] Creation timestamp in RFC3339 text format. * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * An optional description of this resource. Provide this property when you create the resource. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * Generated from protobuf field repeated .google.cloud.compute.v1.LocalDisk disks = 95594102; */ @@ -47,19 +47,19 @@ class NodeTemplate extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * [Output Only] The type of the resource. Always compute#nodeTemplate for node templates. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * The name of the resource, provided by the client when initially creating the resource. The resource name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * Labels to use for node affinity, which will be used in instance scheduling. * @@ -71,44 +71,44 @@ class NodeTemplate extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string node_type = 465832791; */ - private $node_type = null; + protected $node_type = null; /** * Do not use. Instead, use the node_type property. * * Generated from protobuf field optional .google.cloud.compute.v1.NodeTemplateNodeTypeFlexibility node_type_flexibility = 315257905; */ - private $node_type_flexibility = null; + protected $node_type_flexibility = null; /** * [Output Only] The name of the region where the node template resides, such as us-central1. * * Generated from protobuf field optional string region = 138946292; */ - private $region = null; + protected $region = null; /** * [Output Only] Server-defined URL for the resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * Sets the binding properties for the physical server. Valid values include: - *[Default]* RESTART_NODE_ON_ANY_SERVER: Restarts VMs on any available physical server - RESTART_NODE_ON_MINIMAL_SERVER: Restarts VMs on the same physical server whenever possible See Sole-tenant node options for more information. * * Generated from protobuf field optional .google.cloud.compute.v1.ServerBinding server_binding = 208179593; */ - private $server_binding = null; + protected $server_binding = null; /** * [Output Only] The status of the node template. One of the following values: CREATING, READY, and DELETING. * Check the Status enum for the list of possible values. * * Generated from protobuf field optional string status = 181260274; */ - private $status = null; + protected $status = null; /** * [Output Only] An optional, human-readable explanation of the status. * * Generated from protobuf field optional string status_message = 297428154; */ - private $status_message = null; + protected $status_message = null; /** * Constructor. diff --git a/Compute/src/V1/NodeTemplateAggregatedList.php b/Compute/src/V1/NodeTemplateAggregatedList.php index 2fcf9912948f..97c487e7efc7 100644 --- a/Compute/src/V1/NodeTemplateAggregatedList.php +++ b/Compute/src/V1/NodeTemplateAggregatedList.php @@ -19,7 +19,7 @@ class NodeTemplateAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of NodeTemplatesScopedList resources. * @@ -31,19 +31,19 @@ class NodeTemplateAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Unreachable resources. * @@ -55,7 +55,7 @@ class NodeTemplateAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/NodeTemplateList.php b/Compute/src/V1/NodeTemplateList.php index 9fba86b4b326..4fd1eb587255 100644 --- a/Compute/src/V1/NodeTemplateList.php +++ b/Compute/src/V1/NodeTemplateList.php @@ -20,7 +20,7 @@ class NodeTemplateList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of NodeTemplate resources. * @@ -32,25 +32,25 @@ class NodeTemplateList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/NodeTemplateNodeTypeFlexibility.php b/Compute/src/V1/NodeTemplateNodeTypeFlexibility.php index df06ac4aaebf..ed4ff1e968ed 100644 --- a/Compute/src/V1/NodeTemplateNodeTypeFlexibility.php +++ b/Compute/src/V1/NodeTemplateNodeTypeFlexibility.php @@ -17,15 +17,15 @@ class NodeTemplateNodeTypeFlexibility extends \Google\Protobuf\Internal\Message /** * Generated from protobuf field optional string cpus = 3060683; */ - private $cpus = null; + protected $cpus = null; /** * Generated from protobuf field optional string local_ssd = 405741360; */ - private $local_ssd = null; + protected $local_ssd = null; /** * Generated from protobuf field optional string memory = 532856065; */ - private $memory = null; + protected $memory = null; /** * Constructor. diff --git a/Compute/src/V1/NodeTemplatesClient.php b/Compute/src/V1/NodeTemplatesClient.php deleted file mode 100644 index 29c796357ebb..000000000000 --- a/Compute/src/V1/NodeTemplatesClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/NodeType.php b/Compute/src/V1/NodeType.php index 08f9f7e49367..f018c4951b2c 100644 --- a/Compute/src/V1/NodeType.php +++ b/Compute/src/V1/NodeType.php @@ -20,79 +20,79 @@ class NodeType extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string cpu_platform = 410285354; */ - private $cpu_platform = null; + protected $cpu_platform = null; /** * [Output Only] Creation timestamp in RFC3339 text format. * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * [Output Only] The deprecation status associated with this node type. * * Generated from protobuf field optional .google.cloud.compute.v1.DeprecationStatus deprecated = 515138995; */ - private $deprecated = null; + protected $deprecated = null; /** * [Output Only] An optional textual description of the resource. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * [Output Only] The number of virtual CPUs that are available to the node type. * * Generated from protobuf field optional int32 guest_cpus = 393356754; */ - private $guest_cpus = null; + protected $guest_cpus = null; /** * [Output Only] The unique identifier for the resource. This identifier is defined by the server. * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * [Output Only] The type of the resource. Always compute#nodeType for node types. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] Local SSD available to the node type, defined in GB. * * Generated from protobuf field optional int32 local_ssd_gb = 329237578; */ - private $local_ssd_gb = null; + protected $local_ssd_gb = null; /** * [Output Only] Maximum number of VMs that can be created for this node type. * * Generated from protobuf field optional int32 max_vms = 307579713; */ - private $max_vms = null; + protected $max_vms = null; /** * [Output Only] The amount of physical memory available to the node type, defined in MB. * * Generated from protobuf field optional int32 memory_mb = 116001171; */ - private $memory_mb = null; + protected $memory_mb = null; /** * [Output Only] Name of the resource. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * [Output Only] Server-defined URL for the resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] The name of the zone where the node type resides, such as us-central1-a. * * Generated from protobuf field optional string zone = 3744684; */ - private $zone = null; + protected $zone = null; /** * Constructor. diff --git a/Compute/src/V1/NodeTypeAggregatedList.php b/Compute/src/V1/NodeTypeAggregatedList.php index 99bbd77c97ec..f4f0ac6dda36 100644 --- a/Compute/src/V1/NodeTypeAggregatedList.php +++ b/Compute/src/V1/NodeTypeAggregatedList.php @@ -19,7 +19,7 @@ class NodeTypeAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of NodeTypesScopedList resources. * @@ -31,19 +31,19 @@ class NodeTypeAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Unreachable resources. * @@ -55,7 +55,7 @@ class NodeTypeAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/NodeTypeList.php b/Compute/src/V1/NodeTypeList.php index 2449dd99a05f..d3ad64a3e98a 100644 --- a/Compute/src/V1/NodeTypeList.php +++ b/Compute/src/V1/NodeTypeList.php @@ -20,7 +20,7 @@ class NodeTypeList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of NodeType resources. * @@ -32,25 +32,25 @@ class NodeTypeList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/NodeTypesClient.php b/Compute/src/V1/NodeTypesClient.php deleted file mode 100644 index 63d0e480c277..000000000000 --- a/Compute/src/V1/NodeTypesClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/NotificationEndpoint.php b/Compute/src/V1/NotificationEndpoint.php index 019f31074397..6f2345a2c3d0 100644 --- a/Compute/src/V1/NotificationEndpoint.php +++ b/Compute/src/V1/NotificationEndpoint.php @@ -20,49 +20,49 @@ class NotificationEndpoint extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * An optional description of this resource. Provide this property when you create the resource. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * Settings of the gRPC notification endpoint including the endpoint URL and the retry duration. * * Generated from protobuf field optional .google.cloud.compute.v1.NotificationEndpointGrpcSettings grpc_settings = 456139556; */ - private $grpc_settings = null; + protected $grpc_settings = null; /** * [Output Only] A unique identifier for this resource type. The server generates this identifier. * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * [Output Only] Type of the resource. Always compute#notificationEndpoint for notification endpoints. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * [Output Only] URL of the region where the notification endpoint resides. This field applies only to the regional resource. You must specify this field as part of the HTTP request URL. It is not settable as a field in the request body. * * Generated from protobuf field optional string region = 138946292; */ - private $region = null; + protected $region = null; /** * [Output Only] Server-defined URL for the resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * Constructor. diff --git a/Compute/src/V1/NotificationEndpointGrpcSettings.php b/Compute/src/V1/NotificationEndpointGrpcSettings.php index 765fd21d2ea6..467ea3be1637 100644 --- a/Compute/src/V1/NotificationEndpointGrpcSettings.php +++ b/Compute/src/V1/NotificationEndpointGrpcSettings.php @@ -20,31 +20,31 @@ class NotificationEndpointGrpcSettings extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string authority = 401868611; */ - private $authority = null; + protected $authority = null; /** * Endpoint to which gRPC notifications are sent. This must be a valid gRPCLB DNS name. * * Generated from protobuf field optional string endpoint = 130489749; */ - private $endpoint = null; + protected $endpoint = null; /** * Optional. If specified, this field is used to populate the "name" field in gRPC requests. * * Generated from protobuf field optional string payload_name = 300358300; */ - private $payload_name = null; + protected $payload_name = null; /** * Optional. This field is used to configure how often to send a full update of all non-healthy backends. If unspecified, full updates are not sent. If specified, must be in the range between 600 seconds to 3600 seconds. Nanos are disallowed. Can only be set for regional notification endpoints. * * Generated from protobuf field optional .google.cloud.compute.v1.Duration resend_interval = 478288969; */ - private $resend_interval = null; + protected $resend_interval = null; /** * How much time (in seconds) is spent attempting notification retries until a successful response is received. Default is 30s. Limit is 20m (1200s). Must be a positive number. * * Generated from protobuf field optional uint32 retry_duration_sec = 115681117; */ - private $retry_duration_sec = null; + protected $retry_duration_sec = null; /** * Constructor. diff --git a/Compute/src/V1/NotificationEndpointList.php b/Compute/src/V1/NotificationEndpointList.php index 7e7fb5089db2..64012f6c9434 100644 --- a/Compute/src/V1/NotificationEndpointList.php +++ b/Compute/src/V1/NotificationEndpointList.php @@ -19,7 +19,7 @@ class NotificationEndpointList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of NotificationEndpoint resources. * @@ -31,25 +31,25 @@ class NotificationEndpointList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/Operation.php b/Compute/src/V1/Operation.php index 958c4f7a8385..aa30d650ec02 100644 --- a/Compute/src/V1/Operation.php +++ b/Compute/src/V1/Operation.php @@ -9,7 +9,7 @@ use Google\Protobuf\Internal\GPBUtil; /** - * Represents an Operation resource. Google Compute Engine has three Operation resources: * [Global](/compute/docs/reference/rest/v1/globalOperations) * [Regional](/compute/docs/reference/rest/v1/regionOperations) * [Zonal](https://cloud.google.com/compute/docs/reference/rest/v1/zoneOperations) You can use an operation resource to manage asynchronous API requests. For more information, read Handling API responses. Operations can be global, regional or zonal. - For global operations, use the `globalOperations` resource. - For regional operations, use the `regionOperations` resource. - For zonal operations, use the `zoneOperations` resource. For more information, read Global, Regional, and Zonal Resources. Note that completed Operation resources have a limited retention period. + * Represents an Operation resource. Google Compute Engine has three Operation resources: * [Global](/compute/docs/reference/rest/v1/globalOperations) * [Regional](/compute/docs/reference/rest/v1/regionOperations) * [Zonal](/compute/docs/reference/rest/v1/zoneOperations) You can use an operation resource to manage asynchronous API requests. For more information, read Handling API responses. Operations can be global, regional or zonal. - For global operations, use the `globalOperations` resource. - For regional operations, use the `regionOperations` resource. - For zonal operations, use the `zoneOperations` resource. For more information, read Global, Regional, and Zonal Resources. Note that completed Operation resources have a limited retention period. * * Generated from protobuf message google.cloud.compute.v1.Operation */ @@ -20,143 +20,143 @@ class Operation extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string client_operation_id = 297240295; */ - private $client_operation_id = null; + protected $client_operation_id = null; /** * [Deprecated] This field is deprecated. * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * [Output Only] A textual description of the operation, which is set when the operation is created. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * [Output Only] The time that this operation was completed. This value is in RFC3339 text format. * * Generated from protobuf field optional string end_time = 114938801; */ - private $end_time = null; + protected $end_time = null; /** * [Output Only] If errors are generated during processing of the operation, this field will be populated. * * Generated from protobuf field optional .google.cloud.compute.v1.Error error = 96784904; */ - private $error = null; + protected $error = null; /** * [Output Only] If the operation fails, this field contains the HTTP error message that was returned, such as `NOT FOUND`. * * Generated from protobuf field optional string http_error_message = 202521945 [(.google.cloud.operation_field) = ERROR_MESSAGE]; */ - private $http_error_message = null; + protected $http_error_message = null; /** * [Output Only] If the operation fails, this field contains the HTTP error status code that was returned. For example, a `404` means the resource was not found. * * Generated from protobuf field optional int32 http_error_status_code = 312345196 [(.google.cloud.operation_field) = ERROR_CODE]; */ - private $http_error_status_code = null; + protected $http_error_status_code = null; /** * [Output Only] The unique identifier for the operation. This identifier is defined by the server. * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * [Output Only] The time that this operation was requested. This value is in RFC3339 text format. * * Generated from protobuf field optional string insert_time = 433722515; */ - private $insert_time = null; + protected $insert_time = null; /** * Generated from protobuf field optional .google.cloud.compute.v1.InstancesBulkInsertOperationMetadata instances_bulk_insert_operation_metadata = 89146177; */ - private $instances_bulk_insert_operation_metadata = null; + protected $instances_bulk_insert_operation_metadata = null; /** * [Output Only] Type of the resource. Always `compute#operation` for Operation resources. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] Name of the operation. * * Generated from protobuf field optional string name = 3373707 [(.google.cloud.operation_field) = NAME]; */ - private $name = null; + protected $name = null; /** * [Output Only] An ID that represents a group of operations, such as when a group of operations results from a `bulkInsert` API request. * * Generated from protobuf field optional string operation_group_id = 40171187; */ - private $operation_group_id = null; + protected $operation_group_id = null; /** * [Output Only] The type of operation, such as `insert`, `update`, or `delete`, and so on. * * Generated from protobuf field optional string operation_type = 177650450; */ - private $operation_type = null; + protected $operation_type = null; /** * [Output Only] An optional progress indicator that ranges from 0 to 100. There is no requirement that this be linear or support any granularity of operations. This should not be used to guess when the operation will be complete. This number should monotonically increase as the operation progresses. * * Generated from protobuf field optional int32 progress = 72663597; */ - private $progress = null; + protected $progress = null; /** * [Output Only] The URL of the region where the operation resides. Only applicable when performing regional operations. * * Generated from protobuf field optional string region = 138946292; */ - private $region = null; + protected $region = null; /** * [Output Only] Server-defined URL for the resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] If the operation is for projects.setCommonInstanceMetadata, this field will contain information on all underlying zonal actions and their state. * * Generated from protobuf field optional .google.cloud.compute.v1.SetCommonInstanceMetadataOperationMetadata set_common_instance_metadata_operation_metadata = 490378980; */ - private $set_common_instance_metadata_operation_metadata = null; + protected $set_common_instance_metadata_operation_metadata = null; /** * [Output Only] The time that this operation was started by the server. This value is in RFC3339 text format. * * Generated from protobuf field optional string start_time = 37467274; */ - private $start_time = null; + protected $start_time = null; /** * [Output Only] The status of the operation, which can be one of the following: `PENDING`, `RUNNING`, or `DONE`. * * Generated from protobuf field optional .google.cloud.compute.v1.Operation.Status status = 181260274 [(.google.cloud.operation_field) = STATUS]; */ - private $status = null; + protected $status = null; /** * [Output Only] An optional textual description of the current status of the operation. * * Generated from protobuf field optional string status_message = 297428154; */ - private $status_message = null; + protected $status_message = null; /** * [Output Only] The unique target ID, which identifies a specific incarnation of the target resource. * * Generated from protobuf field optional uint64 target_id = 258165385; */ - private $target_id = null; + protected $target_id = null; /** * [Output Only] The URL of the resource that the operation modifies. For operations related to creating a snapshot, this points to the disk that the snapshot was created from. * * Generated from protobuf field optional string target_link = 62671336; */ - private $target_link = null; + protected $target_link = null; /** * [Output Only] User who requested the operation, for example: `user@example.com` or `alice_smith_identifier (global/workforcePools/example-com-us-employees)`. * * Generated from protobuf field optional string user = 3599307; */ - private $user = null; + protected $user = null; /** * [Output Only] If warning messages are generated during processing of the operation, this field will be populated. * @@ -168,7 +168,7 @@ class Operation extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string zone = 3744684; */ - private $zone = null; + protected $zone = null; /** * Constructor. diff --git a/Compute/src/V1/OperationAggregatedList.php b/Compute/src/V1/OperationAggregatedList.php index 154473153f36..b8d11d96277f 100644 --- a/Compute/src/V1/OperationAggregatedList.php +++ b/Compute/src/V1/OperationAggregatedList.php @@ -19,7 +19,7 @@ class OperationAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * [Output Only] A map of scoped operation lists. * @@ -31,19 +31,19 @@ class OperationAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than `maxResults`, use the `nextPageToken` as a value for the query parameter `pageToken` in the next list request. Subsequent list requests will have their own `nextPageToken` to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Unreachable resources. * @@ -55,7 +55,7 @@ class OperationAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/OperationList.php b/Compute/src/V1/OperationList.php index 5a166f1d844b..6cdbe3aaed6e 100644 --- a/Compute/src/V1/OperationList.php +++ b/Compute/src/V1/OperationList.php @@ -20,7 +20,7 @@ class OperationList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * [Output Only] A list of Operation resources. * @@ -32,25 +32,25 @@ class OperationList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than `maxResults`, use the `nextPageToken` as a value for the query parameter `pageToken` in the next list request. Subsequent list requests will have their own `nextPageToken` to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/OperationsScopedList.php b/Compute/src/V1/OperationsScopedList.php index 07103f622ee1..4b6756432425 100644 --- a/Compute/src/V1/OperationsScopedList.php +++ b/Compute/src/V1/OperationsScopedList.php @@ -25,7 +25,7 @@ class OperationsScopedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/OutlierDetection.php b/Compute/src/V1/OutlierDetection.php index 817807d6a6d3..d91a5b4cdbf5 100644 --- a/Compute/src/V1/OutlierDetection.php +++ b/Compute/src/V1/OutlierDetection.php @@ -20,67 +20,67 @@ class OutlierDetection extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.Duration base_ejection_time = 80997255; */ - private $base_ejection_time = null; + protected $base_ejection_time = null; /** * Number of consecutive errors before a backend endpoint is ejected from the load balancing pool. When the backend endpoint is accessed over HTTP, a 5xx return code qualifies as an error. Defaults to 5. * * Generated from protobuf field optional int32 consecutive_errors = 387193248; */ - private $consecutive_errors = null; + protected $consecutive_errors = null; /** * The number of consecutive gateway failures (502, 503, 504 status or connection errors that are mapped to one of those status codes) before a consecutive gateway failure ejection occurs. Defaults to 3. * * Generated from protobuf field optional int32 consecutive_gateway_failure = 417504250; */ - private $consecutive_gateway_failure = null; + protected $consecutive_gateway_failure = null; /** * The percentage chance that a backend endpoint will be ejected when an outlier status is detected through consecutive 5xx. This setting can be used to disable ejection or to ramp it up slowly. Defaults to 0. * * Generated from protobuf field optional int32 enforcing_consecutive_errors = 213133760; */ - private $enforcing_consecutive_errors = null; + protected $enforcing_consecutive_errors = null; /** * The percentage chance that a backend endpoint will be ejected when an outlier status is detected through consecutive gateway failures. This setting can be used to disable ejection or to ramp it up slowly. Defaults to 100. * * Generated from protobuf field optional int32 enforcing_consecutive_gateway_failure = 394440666; */ - private $enforcing_consecutive_gateway_failure = null; + protected $enforcing_consecutive_gateway_failure = null; /** * The percentage chance that a backend endpoint will be ejected when an outlier status is detected through success rate statistics. This setting can be used to disable ejection or to ramp it up slowly. Defaults to 100. Not supported when the backend service uses Serverless NEG. * * Generated from protobuf field optional int32 enforcing_success_rate = 194508732; */ - private $enforcing_success_rate = null; + protected $enforcing_success_rate = null; /** * Time interval between ejection analysis sweeps. This can result in both new ejections and backend endpoints being returned to service. The interval is equal to the number of seconds as defined in outlierDetection.interval.seconds plus the number of nanoseconds as defined in outlierDetection.interval.nanos. Defaults to 1 second. * * Generated from protobuf field optional .google.cloud.compute.v1.Duration interval = 33547461; */ - private $interval = null; + protected $interval = null; /** * Maximum percentage of backend endpoints in the load balancing pool for the backend service that can be ejected if the ejection conditions are met. Defaults to 50%. * * Generated from protobuf field optional int32 max_ejection_percent = 18436888; */ - private $max_ejection_percent = null; + protected $max_ejection_percent = null; /** * The number of backend endpoints in the load balancing pool that must have enough request volume to detect success rate outliers. If the number of backend endpoints is fewer than this setting, outlier detection via success rate statistics is not performed for any backend endpoint in the load balancing pool. Defaults to 5. Not supported when the backend service uses Serverless NEG. * * Generated from protobuf field optional int32 success_rate_minimum_hosts = 525766903; */ - private $success_rate_minimum_hosts = null; + protected $success_rate_minimum_hosts = null; /** * The minimum number of total requests that must be collected in one interval (as defined by the interval duration above) to include this backend endpoint in success rate based outlier detection. If the volume is lower than this setting, outlier detection via success rate statistics is not performed for that backend endpoint. Defaults to 100. Not supported when the backend service uses Serverless NEG. * * Generated from protobuf field optional int32 success_rate_request_volume = 281425357; */ - private $success_rate_request_volume = null; + protected $success_rate_request_volume = null; /** * This factor is used to determine the ejection threshold for success rate outlier ejection. The ejection threshold is the difference between the mean success rate, and the product of this factor and the standard deviation of the mean success rate: mean - (stdev * successRateStdevFactor). This factor is divided by a thousand to get a double. That is, if the desired factor is 1.9, the runtime value should be 1900. Defaults to 1900. Not supported when the backend service uses Serverless NEG. * * Generated from protobuf field optional int32 success_rate_stdev_factor = 174735773; */ - private $success_rate_stdev_factor = null; + protected $success_rate_stdev_factor = null; /** * Constructor. diff --git a/Compute/src/V1/PacketIntervals.php b/Compute/src/V1/PacketIntervals.php index 7a6caf429866..3db89e2bb0a2 100644 --- a/Compute/src/V1/PacketIntervals.php +++ b/Compute/src/V1/PacketIntervals.php @@ -20,39 +20,39 @@ class PacketIntervals extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int64 avg_ms = 204811827; */ - private $avg_ms = null; + protected $avg_ms = null; /** * From how long ago in the past these intervals were observed. * Check the Duration enum for the list of possible values. * * Generated from protobuf field optional string duration = 155471252; */ - private $duration = null; + protected $duration = null; /** * Maximum observed inter-packet interval in milliseconds. * * Generated from protobuf field optional int64 max_ms = 529474145; */ - private $max_ms = null; + protected $max_ms = null; /** * Minimum observed inter-packet interval in milliseconds. * * Generated from protobuf field optional int64 min_ms = 536564403; */ - private $min_ms = null; + protected $min_ms = null; /** * Number of inter-packet intervals from which these statistics were derived. * * Generated from protobuf field optional int64 num_intervals = 186329813; */ - private $num_intervals = null; + protected $num_intervals = null; /** * The type of packets for which inter-packet intervals were computed. * Check the Type enum for the list of possible values. * * Generated from protobuf field optional string type = 3575610; */ - private $type = null; + protected $type = null; /** * Constructor. diff --git a/Compute/src/V1/PacketMirroring.php b/Compute/src/V1/PacketMirroring.php index 6aefbcfd6662..c4f4cc52cbce 100644 --- a/Compute/src/V1/PacketMirroring.php +++ b/Compute/src/V1/PacketMirroring.php @@ -20,80 +20,80 @@ class PacketMirroring extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.PacketMirroringForwardingRuleInfo collector_ilb = 426607853; */ - private $collector_ilb = null; + protected $collector_ilb = null; /** * [Output Only] Creation timestamp in RFC3339 text format. * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * An optional description of this resource. Provide this property when you create the resource. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * Indicates whether or not this packet mirroring takes effect. If set to FALSE, this packet mirroring policy will not be enforced on the network. The default is TRUE. * Check the Enable enum for the list of possible values. * * Generated from protobuf field optional string enable = 311764355; */ - private $enable = null; + protected $enable = null; /** * Filter for mirrored traffic. If unspecified, all IPv4 traffic is mirrored. * * Generated from protobuf field optional .google.cloud.compute.v1.PacketMirroringFilter filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * [Output Only] The unique identifier for the resource. This identifier is defined by the server. * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * [Output Only] Type of the resource. Always compute#packetMirroring for packet mirrorings. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * PacketMirroring mirroredResourceInfos. MirroredResourceInfo specifies a set of mirrored VM instances, subnetworks and/or tags for which traffic from/to all VM instances will be mirrored. * * Generated from protobuf field optional .google.cloud.compute.v1.PacketMirroringMirroredResourceInfo mirrored_resources = 124817348; */ - private $mirrored_resources = null; + protected $mirrored_resources = null; /** * Name of the resource; provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * Specifies the mirrored VPC network. Only packets in this network will be mirrored. All mirrored VMs should have a NIC in the given network. All mirrored subnetworks should belong to the given network. * * Generated from protobuf field optional .google.cloud.compute.v1.PacketMirroringNetworkInfo network = 232872494; */ - private $network = null; + protected $network = null; /** * The priority of applying this configuration. Priority is used to break ties in cases where there is more than one matching rule. In the case of two rules that apply for a given Instance, the one with the lowest-numbered priority value wins. Default value is 1000. Valid range is 0 through 65535. * * Generated from protobuf field optional uint32 priority = 445151652; */ - private $priority = null; + protected $priority = null; /** * [Output Only] URI of the region where the packetMirroring resides. * * Generated from protobuf field optional string region = 138946292; */ - private $region = null; + protected $region = null; /** * [Output Only] Server-defined URL for the resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * Constructor. diff --git a/Compute/src/V1/PacketMirroringAggregatedList.php b/Compute/src/V1/PacketMirroringAggregatedList.php index d29c8348b1de..ead643994c1b 100644 --- a/Compute/src/V1/PacketMirroringAggregatedList.php +++ b/Compute/src/V1/PacketMirroringAggregatedList.php @@ -20,7 +20,7 @@ class PacketMirroringAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of PacketMirroring resources. * @@ -32,19 +32,19 @@ class PacketMirroringAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Unreachable resources. * @@ -56,7 +56,7 @@ class PacketMirroringAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/PacketMirroringFilter.php b/Compute/src/V1/PacketMirroringFilter.php index 8b46a5d69094..bf090dbe9469 100644 --- a/Compute/src/V1/PacketMirroringFilter.php +++ b/Compute/src/V1/PacketMirroringFilter.php @@ -32,7 +32,7 @@ class PacketMirroringFilter extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string direction = 111150975; */ - private $direction = null; + protected $direction = null; /** * Constructor. diff --git a/Compute/src/V1/PacketMirroringForwardingRuleInfo.php b/Compute/src/V1/PacketMirroringForwardingRuleInfo.php index 57558473fe10..85189a4779ab 100644 --- a/Compute/src/V1/PacketMirroringForwardingRuleInfo.php +++ b/Compute/src/V1/PacketMirroringForwardingRuleInfo.php @@ -19,13 +19,13 @@ class PacketMirroringForwardingRuleInfo extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field optional string canonical_url = 512294820; */ - private $canonical_url = null; + protected $canonical_url = null; /** * Resource URL to the forwarding rule representing the ILB configured as destination of the mirrored traffic. * * Generated from protobuf field optional string url = 116079; */ - private $url = null; + protected $url = null; /** * Constructor. diff --git a/Compute/src/V1/PacketMirroringList.php b/Compute/src/V1/PacketMirroringList.php index f031940063a9..4e86d4f62b01 100644 --- a/Compute/src/V1/PacketMirroringList.php +++ b/Compute/src/V1/PacketMirroringList.php @@ -20,7 +20,7 @@ class PacketMirroringList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of PacketMirroring resources. * @@ -32,25 +32,25 @@ class PacketMirroringList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/PacketMirroringMirroredResourceInfoInstanceInfo.php b/Compute/src/V1/PacketMirroringMirroredResourceInfoInstanceInfo.php index fef4b1972d8b..04479faa4362 100644 --- a/Compute/src/V1/PacketMirroringMirroredResourceInfoInstanceInfo.php +++ b/Compute/src/V1/PacketMirroringMirroredResourceInfoInstanceInfo.php @@ -19,13 +19,13 @@ class PacketMirroringMirroredResourceInfoInstanceInfo extends \Google\Protobuf\I * * Generated from protobuf field optional string canonical_url = 512294820; */ - private $canonical_url = null; + protected $canonical_url = null; /** * Resource URL to the virtual machine instance which is being mirrored. * * Generated from protobuf field optional string url = 116079; */ - private $url = null; + protected $url = null; /** * Constructor. diff --git a/Compute/src/V1/PacketMirroringMirroredResourceInfoSubnetInfo.php b/Compute/src/V1/PacketMirroringMirroredResourceInfoSubnetInfo.php index a3127598365c..01c43b97e60c 100644 --- a/Compute/src/V1/PacketMirroringMirroredResourceInfoSubnetInfo.php +++ b/Compute/src/V1/PacketMirroringMirroredResourceInfoSubnetInfo.php @@ -19,13 +19,13 @@ class PacketMirroringMirroredResourceInfoSubnetInfo extends \Google\Protobuf\Int * * Generated from protobuf field optional string canonical_url = 512294820; */ - private $canonical_url = null; + protected $canonical_url = null; /** * Resource URL to the subnetwork for which traffic from/to all VM instances will be mirrored. * * Generated from protobuf field optional string url = 116079; */ - private $url = null; + protected $url = null; /** * Constructor. diff --git a/Compute/src/V1/PacketMirroringNetworkInfo.php b/Compute/src/V1/PacketMirroringNetworkInfo.php index 0bb4b6b8c438..f6d592f09fbd 100644 --- a/Compute/src/V1/PacketMirroringNetworkInfo.php +++ b/Compute/src/V1/PacketMirroringNetworkInfo.php @@ -19,13 +19,13 @@ class PacketMirroringNetworkInfo extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string canonical_url = 512294820; */ - private $canonical_url = null; + protected $canonical_url = null; /** * URL of the network resource. * * Generated from protobuf field optional string url = 116079; */ - private $url = null; + protected $url = null; /** * Constructor. diff --git a/Compute/src/V1/PacketMirroringsClient.php b/Compute/src/V1/PacketMirroringsClient.php deleted file mode 100644 index 8f5a4b26b6cc..000000000000 --- a/Compute/src/V1/PacketMirroringsClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/PatchAutoscalerRequest.php b/Compute/src/V1/PatchAutoscalerRequest.php index 495f1fa9f1b7..1492cf44160a 100644 --- a/Compute/src/V1/PatchAutoscalerRequest.php +++ b/Compute/src/V1/PatchAutoscalerRequest.php @@ -20,31 +20,31 @@ class PatchAutoscalerRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string autoscaler = 517258967; */ - private $autoscaler = null; + protected $autoscaler = null; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.Autoscaler autoscaler_resource = 207616118 [(.google.api.field_behavior) = REQUIRED]; */ - private $autoscaler_resource = null; + protected $autoscaler_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/PatchBackendBucketRequest.php b/Compute/src/V1/PatchBackendBucketRequest.php index faa1ce650b07..707a3e878675 100644 --- a/Compute/src/V1/PatchBackendBucketRequest.php +++ b/Compute/src/V1/PatchBackendBucketRequest.php @@ -20,25 +20,25 @@ class PatchBackendBucketRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string backend_bucket = 91714037 [(.google.api.field_behavior) = REQUIRED]; */ - private $backend_bucket = ''; + protected $backend_bucket = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.BackendBucket backend_bucket_resource = 380757784 [(.google.api.field_behavior) = REQUIRED]; */ - private $backend_bucket_resource = null; + protected $backend_bucket_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/PatchBackendServiceRequest.php b/Compute/src/V1/PatchBackendServiceRequest.php index 47ee2cb6a9c3..3354b0bf2612 100644 --- a/Compute/src/V1/PatchBackendServiceRequest.php +++ b/Compute/src/V1/PatchBackendServiceRequest.php @@ -20,25 +20,25 @@ class PatchBackendServiceRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string backend_service = 306946058 [(.google.api.field_behavior) = REQUIRED]; */ - private $backend_service = ''; + protected $backend_service = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.BackendService backend_service_resource = 347586723 [(.google.api.field_behavior) = REQUIRED]; */ - private $backend_service_resource = null; + protected $backend_service_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/PatchFirewallPolicyRequest.php b/Compute/src/V1/PatchFirewallPolicyRequest.php index 7ff6dbc1cfe4..ce349a9b3e8c 100644 --- a/Compute/src/V1/PatchFirewallPolicyRequest.php +++ b/Compute/src/V1/PatchFirewallPolicyRequest.php @@ -20,19 +20,19 @@ class PatchFirewallPolicyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string firewall_policy = 498173265 [(.google.api.field_behavior) = REQUIRED]; */ - private $firewall_policy = ''; + protected $firewall_policy = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.FirewallPolicy firewall_policy_resource = 495049532 [(.google.api.field_behavior) = REQUIRED]; */ - private $firewall_policy_resource = null; + protected $firewall_policy_resource = null; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $firewallPolicy Name of the firewall policy to update. diff --git a/Compute/src/V1/PatchFirewallRequest.php b/Compute/src/V1/PatchFirewallRequest.php index e0a9913569fe..a7e5845c0f77 100644 --- a/Compute/src/V1/PatchFirewallRequest.php +++ b/Compute/src/V1/PatchFirewallRequest.php @@ -20,25 +20,25 @@ class PatchFirewallRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string firewall = 511016192 [(.google.api.field_behavior) = REQUIRED]; */ - private $firewall = ''; + protected $firewall = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.Firewall firewall_resource = 41425005 [(.google.api.field_behavior) = REQUIRED]; */ - private $firewall_resource = null; + protected $firewall_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/PatchForwardingRuleRequest.php b/Compute/src/V1/PatchForwardingRuleRequest.php index df6b3b06291a..2f7a734b7cc4 100644 --- a/Compute/src/V1/PatchForwardingRuleRequest.php +++ b/Compute/src/V1/PatchForwardingRuleRequest.php @@ -20,31 +20,31 @@ class PatchForwardingRuleRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string forwarding_rule = 269964030 [(.google.api.field_behavior) = REQUIRED]; */ - private $forwarding_rule = ''; + protected $forwarding_rule = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.ForwardingRule forwarding_rule_resource = 301211695 [(.google.api.field_behavior) = REQUIRED]; */ - private $forwarding_rule_resource = null; + protected $forwarding_rule_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/PatchGlobalForwardingRuleRequest.php b/Compute/src/V1/PatchGlobalForwardingRuleRequest.php index 518ce31e5bee..b1fff7eec1c5 100644 --- a/Compute/src/V1/PatchGlobalForwardingRuleRequest.php +++ b/Compute/src/V1/PatchGlobalForwardingRuleRequest.php @@ -20,25 +20,25 @@ class PatchGlobalForwardingRuleRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string forwarding_rule = 269964030 [(.google.api.field_behavior) = REQUIRED]; */ - private $forwarding_rule = ''; + protected $forwarding_rule = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.ForwardingRule forwarding_rule_resource = 301211695 [(.google.api.field_behavior) = REQUIRED]; */ - private $forwarding_rule_resource = null; + protected $forwarding_rule_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/PatchGlobalPublicDelegatedPrefixeRequest.php b/Compute/src/V1/PatchGlobalPublicDelegatedPrefixeRequest.php index e6bce872c8ef..6669cf349717 100644 --- a/Compute/src/V1/PatchGlobalPublicDelegatedPrefixeRequest.php +++ b/Compute/src/V1/PatchGlobalPublicDelegatedPrefixeRequest.php @@ -20,25 +20,25 @@ class PatchGlobalPublicDelegatedPrefixeRequest extends \Google\Protobuf\Internal * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the PublicDelegatedPrefix resource to patch. * * Generated from protobuf field string public_delegated_prefix = 204238440 [(.google.api.field_behavior) = REQUIRED]; */ - private $public_delegated_prefix = ''; + protected $public_delegated_prefix = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.PublicDelegatedPrefix public_delegated_prefix_resource = 47594501 [(.google.api.field_behavior) = REQUIRED]; */ - private $public_delegated_prefix_resource = null; + protected $public_delegated_prefix_resource = null; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/PatchHealthCheckRequest.php b/Compute/src/V1/PatchHealthCheckRequest.php index 49a7ba295bdb..45880c48d005 100644 --- a/Compute/src/V1/PatchHealthCheckRequest.php +++ b/Compute/src/V1/PatchHealthCheckRequest.php @@ -20,25 +20,25 @@ class PatchHealthCheckRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string health_check = 308876645 [(.google.api.field_behavior) = REQUIRED]; */ - private $health_check = ''; + protected $health_check = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.HealthCheck health_check_resource = 201925032 [(.google.api.field_behavior) = REQUIRED]; */ - private $health_check_resource = null; + protected $health_check_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/PatchImageRequest.php b/Compute/src/V1/PatchImageRequest.php index f630547b93ef..2a41a36275c7 100644 --- a/Compute/src/V1/PatchImageRequest.php +++ b/Compute/src/V1/PatchImageRequest.php @@ -20,25 +20,25 @@ class PatchImageRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string image = 100313435 [(.google.api.field_behavior) = REQUIRED]; */ - private $image = ''; + protected $image = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.Image image_resource = 371171954 [(.google.api.field_behavior) = REQUIRED]; */ - private $image_resource = null; + protected $image_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/PatchInstanceGroupManagerRequest.php b/Compute/src/V1/PatchInstanceGroupManagerRequest.php index b97562c9ede9..b1381bef8f5b 100644 --- a/Compute/src/V1/PatchInstanceGroupManagerRequest.php +++ b/Compute/src/V1/PatchInstanceGroupManagerRequest.php @@ -20,31 +20,31 @@ class PatchInstanceGroupManagerRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string instance_group_manager = 249363395 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group_manager = ''; + protected $instance_group_manager = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.InstanceGroupManager instance_group_manager_resource = 261063946 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group_manager_resource = null; + protected $instance_group_manager_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone where you want to create the managed instance group. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/PatchInstanceSettingRequest.php b/Compute/src/V1/PatchInstanceSettingRequest.php index 1dc176d632ca..864daf542411 100644 --- a/Compute/src/V1/PatchInstanceSettingRequest.php +++ b/Compute/src/V1/PatchInstanceSettingRequest.php @@ -20,31 +20,31 @@ class PatchInstanceSettingRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.compute.v1.InstanceSettings instance_settings_resource = 290689920 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_settings_resource = null; + protected $instance_settings_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * update_mask indicates fields to be updated as part of this request. * * Generated from protobuf field optional string update_mask = 500079778; */ - private $update_mask = null; + protected $update_mask = null; /** * The zone scoping this request. It should conform to RFC1035. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/PatchInterconnectAttachmentGroupRequest.php b/Compute/src/V1/PatchInterconnectAttachmentGroupRequest.php index 0bb8e90967bf..50d6beefeb96 100644 --- a/Compute/src/V1/PatchInterconnectAttachmentGroupRequest.php +++ b/Compute/src/V1/PatchInterconnectAttachmentGroupRequest.php @@ -20,31 +20,31 @@ class PatchInterconnectAttachmentGroupRequest extends \Google\Protobuf\Internal\ * * Generated from protobuf field string interconnect_attachment_group = 75905012 [(.google.api.field_behavior) = REQUIRED]; */ - private $interconnect_attachment_group = ''; + protected $interconnect_attachment_group = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.InterconnectAttachmentGroup interconnect_attachment_group_resource = 9990137 [(.google.api.field_behavior) = REQUIRED]; */ - private $interconnect_attachment_group_resource = null; + protected $interconnect_attachment_group_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). end_interface: MixerMutationRequestBuilder * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The list of fields to update. * * Generated from protobuf field optional string update_mask = 500079778; */ - private $update_mask = null; + protected $update_mask = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/PatchInterconnectAttachmentRequest.php b/Compute/src/V1/PatchInterconnectAttachmentRequest.php index 96e2f93a559d..c8d5c15df398 100644 --- a/Compute/src/V1/PatchInterconnectAttachmentRequest.php +++ b/Compute/src/V1/PatchInterconnectAttachmentRequest.php @@ -20,31 +20,31 @@ class PatchInterconnectAttachmentRequest extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field string interconnect_attachment = 308135284 [(.google.api.field_behavior) = REQUIRED]; */ - private $interconnect_attachment = ''; + protected $interconnect_attachment = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.InterconnectAttachment interconnect_attachment_resource = 212341369 [(.google.api.field_behavior) = REQUIRED]; */ - private $interconnect_attachment_resource = null; + protected $interconnect_attachment_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/PatchInterconnectGroupRequest.php b/Compute/src/V1/PatchInterconnectGroupRequest.php index 26284e4618ed..7312fcfa5542 100644 --- a/Compute/src/V1/PatchInterconnectGroupRequest.php +++ b/Compute/src/V1/PatchInterconnectGroupRequest.php @@ -20,31 +20,31 @@ class PatchInterconnectGroupRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string interconnect_group = 388651918 [(.google.api.field_behavior) = REQUIRED]; */ - private $interconnect_group = ''; + protected $interconnect_group = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.InterconnectGroup interconnect_group_resource = 85571999 [(.google.api.field_behavior) = REQUIRED]; */ - private $interconnect_group_resource = null; + protected $interconnect_group_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). end_interface: MixerMutationRequestBuilder * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The list of fields to update. * * Generated from protobuf field optional string update_mask = 500079778; */ - private $update_mask = null; + protected $update_mask = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/PatchInterconnectRequest.php b/Compute/src/V1/PatchInterconnectRequest.php index 7b2adb3127d3..38e58b0a39ca 100644 --- a/Compute/src/V1/PatchInterconnectRequest.php +++ b/Compute/src/V1/PatchInterconnectRequest.php @@ -20,25 +20,25 @@ class PatchInterconnectRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string interconnect = 224601230 [(.google.api.field_behavior) = REQUIRED]; */ - private $interconnect = ''; + protected $interconnect = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.Interconnect interconnect_resource = 397611167 [(.google.api.field_behavior) = REQUIRED]; */ - private $interconnect_resource = null; + protected $interconnect_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/PatchNetworkAttachmentRequest.php b/Compute/src/V1/PatchNetworkAttachmentRequest.php index 650a13eaecd6..83c50305d289 100644 --- a/Compute/src/V1/PatchNetworkAttachmentRequest.php +++ b/Compute/src/V1/PatchNetworkAttachmentRequest.php @@ -20,31 +20,31 @@ class PatchNetworkAttachmentRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string network_attachment = 224644052 [(.google.api.field_behavior) = REQUIRED]; */ - private $network_attachment = ''; + protected $network_attachment = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.NetworkAttachment network_attachment_resource = 210974745 [(.google.api.field_behavior) = REQUIRED]; */ - private $network_attachment_resource = null; + protected $network_attachment_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). end_interface: MixerMutationRequestBuilder * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/PatchNetworkEdgeSecurityServiceRequest.php b/Compute/src/V1/PatchNetworkEdgeSecurityServiceRequest.php index 9c498d4cc890..6919f1f5773d 100644 --- a/Compute/src/V1/PatchNetworkEdgeSecurityServiceRequest.php +++ b/Compute/src/V1/PatchNetworkEdgeSecurityServiceRequest.php @@ -20,41 +20,41 @@ class PatchNetworkEdgeSecurityServiceRequest extends \Google\Protobuf\Internal\M * * Generated from protobuf field string network_edge_security_service = 157011879 [(.google.api.field_behavior) = REQUIRED]; */ - private $network_edge_security_service = ''; + protected $network_edge_security_service = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.NetworkEdgeSecurityService network_edge_security_service_resource = 477548966 [(.google.api.field_behavior) = REQUIRED]; */ - private $network_edge_security_service_resource = null; + protected $network_edge_security_service_resource = null; /** * Generated from protobuf field optional string paths = 106438894; */ - private $paths = null; + protected $paths = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Indicates fields to be updated as part of this request. * * Generated from protobuf field optional string update_mask = 500079778; */ - private $update_mask = null; + protected $update_mask = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/PatchNetworkFirewallPolicyRequest.php b/Compute/src/V1/PatchNetworkFirewallPolicyRequest.php index 82314b5a3e86..1adc5a6116d4 100644 --- a/Compute/src/V1/PatchNetworkFirewallPolicyRequest.php +++ b/Compute/src/V1/PatchNetworkFirewallPolicyRequest.php @@ -20,25 +20,25 @@ class PatchNetworkFirewallPolicyRequest extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field string firewall_policy = 498173265 [(.google.api.field_behavior) = REQUIRED]; */ - private $firewall_policy = ''; + protected $firewall_policy = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.FirewallPolicy firewall_policy_resource = 495049532 [(.google.api.field_behavior) = REQUIRED]; */ - private $firewall_policy_resource = null; + protected $firewall_policy_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/PatchNetworkRequest.php b/Compute/src/V1/PatchNetworkRequest.php index 42ea08b2ac04..566277d28787 100644 --- a/Compute/src/V1/PatchNetworkRequest.php +++ b/Compute/src/V1/PatchNetworkRequest.php @@ -20,25 +20,25 @@ class PatchNetworkRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string network = 232872494 [(.google.api.field_behavior) = REQUIRED]; */ - private $network = ''; + protected $network = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.Network network_resource = 122105599 [(.google.api.field_behavior) = REQUIRED]; */ - private $network_resource = null; + protected $network_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/PatchNodeGroupRequest.php b/Compute/src/V1/PatchNodeGroupRequest.php index 6b2e2e4a64b9..c6f5a77ede8c 100644 --- a/Compute/src/V1/PatchNodeGroupRequest.php +++ b/Compute/src/V1/PatchNodeGroupRequest.php @@ -20,31 +20,31 @@ class PatchNodeGroupRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string node_group = 469958146 [(.google.api.field_behavior) = REQUIRED]; */ - private $node_group = ''; + protected $node_group = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.NodeGroup node_group_resource = 505321899 [(.google.api.field_behavior) = REQUIRED]; */ - private $node_group_resource = null; + protected $node_group_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/PatchPacketMirroringRequest.php b/Compute/src/V1/PatchPacketMirroringRequest.php index 06a6272c4a7c..a9764a6b176e 100644 --- a/Compute/src/V1/PatchPacketMirroringRequest.php +++ b/Compute/src/V1/PatchPacketMirroringRequest.php @@ -20,31 +20,31 @@ class PatchPacketMirroringRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string packet_mirroring = 22305996 [(.google.api.field_behavior) = REQUIRED]; */ - private $packet_mirroring = ''; + protected $packet_mirroring = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.PacketMirroring packet_mirroring_resource = 493501985 [(.google.api.field_behavior) = REQUIRED]; */ - private $packet_mirroring_resource = null; + protected $packet_mirroring_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/PatchPacketMirroringRuleNetworkFirewallPolicyRequest.php b/Compute/src/V1/PatchPacketMirroringRuleNetworkFirewallPolicyRequest.php index ca79ac1a66b4..efc4a7ea7cb3 100644 --- a/Compute/src/V1/PatchPacketMirroringRuleNetworkFirewallPolicyRequest.php +++ b/Compute/src/V1/PatchPacketMirroringRuleNetworkFirewallPolicyRequest.php @@ -20,31 +20,31 @@ class PatchPacketMirroringRuleNetworkFirewallPolicyRequest extends \Google\Proto * * Generated from protobuf field string firewall_policy = 498173265 [(.google.api.field_behavior) = REQUIRED]; */ - private $firewall_policy = ''; + protected $firewall_policy = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.FirewallPolicyRule firewall_policy_rule_resource = 250523523 [(.google.api.field_behavior) = REQUIRED]; */ - private $firewall_policy_rule_resource = null; + protected $firewall_policy_rule_resource = null; /** * The priority of the rule to patch. * * Generated from protobuf field optional int32 priority = 445151652; */ - private $priority = null; + protected $priority = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/PatchPerInstanceConfigsInstanceGroupManagerRequest.php b/Compute/src/V1/PatchPerInstanceConfigsInstanceGroupManagerRequest.php index 2c261ef4ac61..15a8f7d8f243 100644 --- a/Compute/src/V1/PatchPerInstanceConfigsInstanceGroupManagerRequest.php +++ b/Compute/src/V1/PatchPerInstanceConfigsInstanceGroupManagerRequest.php @@ -20,31 +20,31 @@ class PatchPerInstanceConfigsInstanceGroupManagerRequest extends \Google\Protobu * * Generated from protobuf field string instance_group_manager = 249363395 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group_manager = ''; + protected $instance_group_manager = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.InstanceGroupManagersPatchPerInstanceConfigsReq instance_group_managers_patch_per_instance_configs_req_resource = 356650495 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group_managers_patch_per_instance_configs_req_resource = null; + protected $instance_group_managers_patch_per_instance_configs_req_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone where the managed instance group is located. It should conform to RFC1035. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/PatchPerInstanceConfigsRegionInstanceGroupManagerRequest.php b/Compute/src/V1/PatchPerInstanceConfigsRegionInstanceGroupManagerRequest.php index 5c3b448f2750..5b4e5e3cfd81 100644 --- a/Compute/src/V1/PatchPerInstanceConfigsRegionInstanceGroupManagerRequest.php +++ b/Compute/src/V1/PatchPerInstanceConfigsRegionInstanceGroupManagerRequest.php @@ -20,31 +20,31 @@ class PatchPerInstanceConfigsRegionInstanceGroupManagerRequest extends \Google\P * * Generated from protobuf field string instance_group_manager = 249363395 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group_manager = ''; + protected $instance_group_manager = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request, should conform to RFC1035. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.RegionInstanceGroupManagerPatchInstanceConfigReq region_instance_group_manager_patch_instance_config_req_resource = 197682890 [(.google.api.field_behavior) = REQUIRED]; */ - private $region_instance_group_manager_patch_instance_config_req_resource = null; + protected $region_instance_group_manager_patch_instance_config_req_resource = null; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/PatchPublicAdvertisedPrefixeRequest.php b/Compute/src/V1/PatchPublicAdvertisedPrefixeRequest.php index 6a1404ac7950..9d9ae5eff171 100644 --- a/Compute/src/V1/PatchPublicAdvertisedPrefixeRequest.php +++ b/Compute/src/V1/PatchPublicAdvertisedPrefixeRequest.php @@ -20,25 +20,25 @@ class PatchPublicAdvertisedPrefixeRequest extends \Google\Protobuf\Internal\Mess * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the PublicAdvertisedPrefix resource to patch. * * Generated from protobuf field string public_advertised_prefix = 101874590 [(.google.api.field_behavior) = REQUIRED]; */ - private $public_advertised_prefix = ''; + protected $public_advertised_prefix = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.PublicAdvertisedPrefix public_advertised_prefix_resource = 233614223 [(.google.api.field_behavior) = REQUIRED]; */ - private $public_advertised_prefix_resource = null; + protected $public_advertised_prefix_resource = null; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/PatchPublicDelegatedPrefixeRequest.php b/Compute/src/V1/PatchPublicDelegatedPrefixeRequest.php index 06922ff6a1da..c491ea01e575 100644 --- a/Compute/src/V1/PatchPublicDelegatedPrefixeRequest.php +++ b/Compute/src/V1/PatchPublicDelegatedPrefixeRequest.php @@ -20,31 +20,31 @@ class PatchPublicDelegatedPrefixeRequest extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the PublicDelegatedPrefix resource to patch. * * Generated from protobuf field string public_delegated_prefix = 204238440 [(.google.api.field_behavior) = REQUIRED]; */ - private $public_delegated_prefix = ''; + protected $public_delegated_prefix = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.PublicDelegatedPrefix public_delegated_prefix_resource = 47594501 [(.google.api.field_behavior) = REQUIRED]; */ - private $public_delegated_prefix_resource = null; + protected $public_delegated_prefix_resource = null; /** * Name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/PatchRegionAutoscalerRequest.php b/Compute/src/V1/PatchRegionAutoscalerRequest.php index 22509dc03c1f..8ac1b4aaa6d0 100644 --- a/Compute/src/V1/PatchRegionAutoscalerRequest.php +++ b/Compute/src/V1/PatchRegionAutoscalerRequest.php @@ -20,31 +20,31 @@ class PatchRegionAutoscalerRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string autoscaler = 517258967; */ - private $autoscaler = null; + protected $autoscaler = null; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.Autoscaler autoscaler_resource = 207616118 [(.google.api.field_behavior) = REQUIRED]; */ - private $autoscaler_resource = null; + protected $autoscaler_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/PatchRegionBackendServiceRequest.php b/Compute/src/V1/PatchRegionBackendServiceRequest.php index 6798d9e83536..8f0ca79539c5 100644 --- a/Compute/src/V1/PatchRegionBackendServiceRequest.php +++ b/Compute/src/V1/PatchRegionBackendServiceRequest.php @@ -20,31 +20,31 @@ class PatchRegionBackendServiceRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string backend_service = 306946058 [(.google.api.field_behavior) = REQUIRED]; */ - private $backend_service = ''; + protected $backend_service = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.BackendService backend_service_resource = 347586723 [(.google.api.field_behavior) = REQUIRED]; */ - private $backend_service_resource = null; + protected $backend_service_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/PatchRegionHealthCheckRequest.php b/Compute/src/V1/PatchRegionHealthCheckRequest.php index c6cc5fa952cb..bfa319156d75 100644 --- a/Compute/src/V1/PatchRegionHealthCheckRequest.php +++ b/Compute/src/V1/PatchRegionHealthCheckRequest.php @@ -20,31 +20,31 @@ class PatchRegionHealthCheckRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string health_check = 308876645 [(.google.api.field_behavior) = REQUIRED]; */ - private $health_check = ''; + protected $health_check = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.HealthCheck health_check_resource = 201925032 [(.google.api.field_behavior) = REQUIRED]; */ - private $health_check_resource = null; + protected $health_check_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/PatchRegionHealthCheckServiceRequest.php b/Compute/src/V1/PatchRegionHealthCheckServiceRequest.php index adb8caa0aa3d..37c5400938de 100644 --- a/Compute/src/V1/PatchRegionHealthCheckServiceRequest.php +++ b/Compute/src/V1/PatchRegionHealthCheckServiceRequest.php @@ -20,31 +20,31 @@ class PatchRegionHealthCheckServiceRequest extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field string health_check_service = 408374747 [(.google.api.field_behavior) = REQUIRED]; */ - private $health_check_service = ''; + protected $health_check_service = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.HealthCheckService health_check_service_resource = 477367794 [(.google.api.field_behavior) = REQUIRED]; */ - private $health_check_service_resource = null; + protected $health_check_service_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/PatchRegionInstanceGroupManagerRequest.php b/Compute/src/V1/PatchRegionInstanceGroupManagerRequest.php index 054472afb94d..b2ea9d2f7e82 100644 --- a/Compute/src/V1/PatchRegionInstanceGroupManagerRequest.php +++ b/Compute/src/V1/PatchRegionInstanceGroupManagerRequest.php @@ -20,31 +20,31 @@ class PatchRegionInstanceGroupManagerRequest extends \Google\Protobuf\Internal\M * * Generated from protobuf field string instance_group_manager = 249363395 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group_manager = ''; + protected $instance_group_manager = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.InstanceGroupManager instance_group_manager_resource = 261063946 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group_manager_resource = null; + protected $instance_group_manager_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/PatchRegionNetworkFirewallPolicyRequest.php b/Compute/src/V1/PatchRegionNetworkFirewallPolicyRequest.php index 60728451d293..acec419ffbdc 100644 --- a/Compute/src/V1/PatchRegionNetworkFirewallPolicyRequest.php +++ b/Compute/src/V1/PatchRegionNetworkFirewallPolicyRequest.php @@ -20,31 +20,31 @@ class PatchRegionNetworkFirewallPolicyRequest extends \Google\Protobuf\Internal\ * * Generated from protobuf field string firewall_policy = 498173265 [(.google.api.field_behavior) = REQUIRED]; */ - private $firewall_policy = ''; + protected $firewall_policy = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.FirewallPolicy firewall_policy_resource = 495049532 [(.google.api.field_behavior) = REQUIRED]; */ - private $firewall_policy_resource = null; + protected $firewall_policy_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/PatchRegionSecurityPolicyRequest.php b/Compute/src/V1/PatchRegionSecurityPolicyRequest.php index 16f87f3ccb56..072b5d22d11d 100644 --- a/Compute/src/V1/PatchRegionSecurityPolicyRequest.php +++ b/Compute/src/V1/PatchRegionSecurityPolicyRequest.php @@ -20,37 +20,37 @@ class PatchRegionSecurityPolicyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name of the security policy to update. * * Generated from protobuf field string security_policy = 171082513 [(.google.api.field_behavior) = REQUIRED]; */ - private $security_policy = ''; + protected $security_policy = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.SecurityPolicy security_policy_resource = 216159612 [(.google.api.field_behavior) = REQUIRED]; */ - private $security_policy_resource = null; + protected $security_policy_resource = null; /** * Indicates fields to be cleared as part of this request. * * Generated from protobuf field optional string update_mask = 500079778; */ - private $update_mask = null; + protected $update_mask = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/PatchRegionSslPolicyRequest.php b/Compute/src/V1/PatchRegionSslPolicyRequest.php index c7b511697147..6a29b5612717 100644 --- a/Compute/src/V1/PatchRegionSslPolicyRequest.php +++ b/Compute/src/V1/PatchRegionSslPolicyRequest.php @@ -20,31 +20,31 @@ class PatchRegionSslPolicyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name of the SSL policy to update. The name must be 1-63 characters long, and comply with RFC1035. * * Generated from protobuf field string ssl_policy = 295190213 [(.google.api.field_behavior) = REQUIRED]; */ - private $ssl_policy = ''; + protected $ssl_policy = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.SslPolicy ssl_policy_resource = 274891848 [(.google.api.field_behavior) = REQUIRED]; */ - private $ssl_policy_resource = null; + protected $ssl_policy_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/PatchRegionTargetHttpsProxyRequest.php b/Compute/src/V1/PatchRegionTargetHttpsProxyRequest.php index f7c40c592f30..acc635712e9a 100644 --- a/Compute/src/V1/PatchRegionTargetHttpsProxyRequest.php +++ b/Compute/src/V1/PatchRegionTargetHttpsProxyRequest.php @@ -20,31 +20,31 @@ class PatchRegionTargetHttpsProxyRequest extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name of the TargetHttpsProxy resource to patch. * * Generated from protobuf field string target_https_proxy = 52336748 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_https_proxy = ''; + protected $target_https_proxy = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.TargetHttpsProxy target_https_proxy_resource = 433657473 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_https_proxy_resource = null; + protected $target_https_proxy_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/PatchRegionUrlMapRequest.php b/Compute/src/V1/PatchRegionUrlMapRequest.php index f4efd8c31d4e..88da7e5b91fe 100644 --- a/Compute/src/V1/PatchRegionUrlMapRequest.php +++ b/Compute/src/V1/PatchRegionUrlMapRequest.php @@ -20,31 +20,31 @@ class PatchRegionUrlMapRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * begin_interface: MixerMutationRequestBuilder Request ID to support idempotency. * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name of the UrlMap resource to patch. * * Generated from protobuf field string url_map = 367020684 [(.google.api.field_behavior) = REQUIRED]; */ - private $url_map = ''; + protected $url_map = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.UrlMap url_map_resource = 168675425 [(.google.api.field_behavior) = REQUIRED]; */ - private $url_map_resource = null; + protected $url_map_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/PatchResourcePolicyRequest.php b/Compute/src/V1/PatchResourcePolicyRequest.php index ec6862682300..78c668025f25 100644 --- a/Compute/src/V1/PatchResourcePolicyRequest.php +++ b/Compute/src/V1/PatchResourcePolicyRequest.php @@ -20,37 +20,37 @@ class PatchResourcePolicyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Id of the resource policy to patch. * * Generated from protobuf field string resource_policy = 159240835 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource_policy = ''; + protected $resource_policy = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.ResourcePolicy resource_policy_resource = 76826186 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource_policy_resource = null; + protected $resource_policy_resource = null; /** * update_mask indicates fields to be updated as part of this request. * * Generated from protobuf field optional string update_mask = 500079778; */ - private $update_mask = null; + protected $update_mask = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/PatchRoutePolicyRouterRequest.php b/Compute/src/V1/PatchRoutePolicyRouterRequest.php index d6a34db1568f..7efa54170e12 100644 --- a/Compute/src/V1/PatchRoutePolicyRouterRequest.php +++ b/Compute/src/V1/PatchRoutePolicyRouterRequest.php @@ -20,31 +20,31 @@ class PatchRoutePolicyRouterRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.RoutePolicy route_policy_resource = 116219525 [(.google.api.field_behavior) = REQUIRED]; */ - private $route_policy_resource = null; + protected $route_policy_resource = null; /** * Name of the Router resource where Route Policy is defined. * * Generated from protobuf field string router = 148608841 [(.google.api.field_behavior) = REQUIRED]; */ - private $router = ''; + protected $router = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/PatchRouterRequest.php b/Compute/src/V1/PatchRouterRequest.php index 41f01712b1a0..e3bdcd3c4e89 100644 --- a/Compute/src/V1/PatchRouterRequest.php +++ b/Compute/src/V1/PatchRouterRequest.php @@ -20,31 +20,31 @@ class PatchRouterRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name of the Router resource to patch. * * Generated from protobuf field string router = 148608841 [(.google.api.field_behavior) = REQUIRED]; */ - private $router = ''; + protected $router = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.Router router_resource = 155222084 [(.google.api.field_behavior) = REQUIRED]; */ - private $router_resource = null; + protected $router_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/PatchRuleFirewallPolicyRequest.php b/Compute/src/V1/PatchRuleFirewallPolicyRequest.php index dfc867221e27..24cb334fd0ed 100644 --- a/Compute/src/V1/PatchRuleFirewallPolicyRequest.php +++ b/Compute/src/V1/PatchRuleFirewallPolicyRequest.php @@ -20,25 +20,25 @@ class PatchRuleFirewallPolicyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string firewall_policy = 498173265 [(.google.api.field_behavior) = REQUIRED]; */ - private $firewall_policy = ''; + protected $firewall_policy = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.FirewallPolicyRule firewall_policy_rule_resource = 250523523 [(.google.api.field_behavior) = REQUIRED]; */ - private $firewall_policy_rule_resource = null; + protected $firewall_policy_rule_resource = null; /** * The priority of the rule to patch. * * Generated from protobuf field optional int32 priority = 445151652; */ - private $priority = null; + protected $priority = null; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $firewallPolicy Name of the firewall policy to update. diff --git a/Compute/src/V1/PatchRuleNetworkFirewallPolicyRequest.php b/Compute/src/V1/PatchRuleNetworkFirewallPolicyRequest.php index 7f2b813df689..343492b71d4d 100644 --- a/Compute/src/V1/PatchRuleNetworkFirewallPolicyRequest.php +++ b/Compute/src/V1/PatchRuleNetworkFirewallPolicyRequest.php @@ -20,31 +20,31 @@ class PatchRuleNetworkFirewallPolicyRequest extends \Google\Protobuf\Internal\Me * * Generated from protobuf field string firewall_policy = 498173265 [(.google.api.field_behavior) = REQUIRED]; */ - private $firewall_policy = ''; + protected $firewall_policy = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.FirewallPolicyRule firewall_policy_rule_resource = 250523523 [(.google.api.field_behavior) = REQUIRED]; */ - private $firewall_policy_rule_resource = null; + protected $firewall_policy_rule_resource = null; /** * The priority of the rule to patch. * * Generated from protobuf field optional int32 priority = 445151652; */ - private $priority = null; + protected $priority = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/PatchRuleRegionNetworkFirewallPolicyRequest.php b/Compute/src/V1/PatchRuleRegionNetworkFirewallPolicyRequest.php index f987463aee00..0633be72eef7 100644 --- a/Compute/src/V1/PatchRuleRegionNetworkFirewallPolicyRequest.php +++ b/Compute/src/V1/PatchRuleRegionNetworkFirewallPolicyRequest.php @@ -20,37 +20,37 @@ class PatchRuleRegionNetworkFirewallPolicyRequest extends \Google\Protobuf\Inter * * Generated from protobuf field string firewall_policy = 498173265 [(.google.api.field_behavior) = REQUIRED]; */ - private $firewall_policy = ''; + protected $firewall_policy = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.FirewallPolicyRule firewall_policy_rule_resource = 250523523 [(.google.api.field_behavior) = REQUIRED]; */ - private $firewall_policy_rule_resource = null; + protected $firewall_policy_rule_resource = null; /** * The priority of the rule to patch. * * Generated from protobuf field optional int32 priority = 445151652; */ - private $priority = null; + protected $priority = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/PatchRuleRegionSecurityPolicyRequest.php b/Compute/src/V1/PatchRuleRegionSecurityPolicyRequest.php index facf4cd6774d..9fc3827e5071 100644 --- a/Compute/src/V1/PatchRuleRegionSecurityPolicyRequest.php +++ b/Compute/src/V1/PatchRuleRegionSecurityPolicyRequest.php @@ -20,43 +20,43 @@ class PatchRuleRegionSecurityPolicyRequest extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field optional int32 priority = 445151652; */ - private $priority = null; + protected $priority = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * Name of the security policy to update. * * Generated from protobuf field string security_policy = 171082513 [(.google.api.field_behavior) = REQUIRED]; */ - private $security_policy = ''; + protected $security_policy = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.SecurityPolicyRule security_policy_rule_resource = 402693443 [(.google.api.field_behavior) = REQUIRED]; */ - private $security_policy_rule_resource = null; + protected $security_policy_rule_resource = null; /** * Indicates fields to be cleared as part of this request. * * Generated from protobuf field optional string update_mask = 500079778; */ - private $update_mask = null; + protected $update_mask = null; /** * If true, the request will not be committed. * * Generated from protobuf field optional bool validate_only = 242744629; */ - private $validate_only = null; + protected $validate_only = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/PatchRuleSecurityPolicyRequest.php b/Compute/src/V1/PatchRuleSecurityPolicyRequest.php index 1ecaaa8a7ef0..53780ac4fa43 100644 --- a/Compute/src/V1/PatchRuleSecurityPolicyRequest.php +++ b/Compute/src/V1/PatchRuleSecurityPolicyRequest.php @@ -20,37 +20,37 @@ class PatchRuleSecurityPolicyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int32 priority = 445151652; */ - private $priority = null; + protected $priority = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the security policy to update. * * Generated from protobuf field string security_policy = 171082513 [(.google.api.field_behavior) = REQUIRED]; */ - private $security_policy = ''; + protected $security_policy = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.SecurityPolicyRule security_policy_rule_resource = 402693443 [(.google.api.field_behavior) = REQUIRED]; */ - private $security_policy_rule_resource = null; + protected $security_policy_rule_resource = null; /** * Indicates fields to be cleared as part of this request. * * Generated from protobuf field optional string update_mask = 500079778; */ - private $update_mask = null; + protected $update_mask = null; /** * If true, the request will not be committed. * * Generated from protobuf field optional bool validate_only = 242744629; */ - private $validate_only = null; + protected $validate_only = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/PatchSecurityPolicyRequest.php b/Compute/src/V1/PatchSecurityPolicyRequest.php index dc08de30fcb9..0bc6b218bc3e 100644 --- a/Compute/src/V1/PatchSecurityPolicyRequest.php +++ b/Compute/src/V1/PatchSecurityPolicyRequest.php @@ -20,31 +20,31 @@ class PatchSecurityPolicyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name of the security policy to update. * * Generated from protobuf field string security_policy = 171082513 [(.google.api.field_behavior) = REQUIRED]; */ - private $security_policy = ''; + protected $security_policy = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.SecurityPolicy security_policy_resource = 216159612 [(.google.api.field_behavior) = REQUIRED]; */ - private $security_policy_resource = null; + protected $security_policy_resource = null; /** * Indicates fields to be cleared as part of this request. * * Generated from protobuf field optional string update_mask = 500079778; */ - private $update_mask = null; + protected $update_mask = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/PatchServiceAttachmentRequest.php b/Compute/src/V1/PatchServiceAttachmentRequest.php index 731084100847..60edd1a33114 100644 --- a/Compute/src/V1/PatchServiceAttachmentRequest.php +++ b/Compute/src/V1/PatchServiceAttachmentRequest.php @@ -20,31 +20,31 @@ class PatchServiceAttachmentRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * The region scoping this request and should conform to RFC1035. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The resource id of the ServiceAttachment to patch. It should conform to RFC1035 resource name or be a string form on an unsigned long number. * * Generated from protobuf field string service_attachment = 338957549 [(.google.api.field_behavior) = REQUIRED]; */ - private $service_attachment = ''; + protected $service_attachment = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.ServiceAttachment service_attachment_resource = 472980256 [(.google.api.field_behavior) = REQUIRED]; */ - private $service_attachment_resource = null; + protected $service_attachment_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/PatchSnapshotSettingRequest.php b/Compute/src/V1/PatchSnapshotSettingRequest.php index 994882c3bb75..ed475c73285a 100644 --- a/Compute/src/V1/PatchSnapshotSettingRequest.php +++ b/Compute/src/V1/PatchSnapshotSettingRequest.php @@ -20,25 +20,25 @@ class PatchSnapshotSettingRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.SnapshotSettings snapshot_settings_resource = 357664495 [(.google.api.field_behavior) = REQUIRED]; */ - private $snapshot_settings_resource = null; + protected $snapshot_settings_resource = null; /** * update_mask indicates fields to be updated as part of this request. * * Generated from protobuf field optional string update_mask = 500079778; */ - private $update_mask = null; + protected $update_mask = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/PatchSslPolicyRequest.php b/Compute/src/V1/PatchSslPolicyRequest.php index ff58eee9c990..ac80a12205ac 100644 --- a/Compute/src/V1/PatchSslPolicyRequest.php +++ b/Compute/src/V1/PatchSslPolicyRequest.php @@ -20,25 +20,25 @@ class PatchSslPolicyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name of the SSL policy to update. The name must be 1-63 characters long, and comply with RFC1035. * * Generated from protobuf field string ssl_policy = 295190213 [(.google.api.field_behavior) = REQUIRED]; */ - private $ssl_policy = ''; + protected $ssl_policy = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.SslPolicy ssl_policy_resource = 274891848 [(.google.api.field_behavior) = REQUIRED]; */ - private $ssl_policy_resource = null; + protected $ssl_policy_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/PatchSubnetworkRequest.php b/Compute/src/V1/PatchSubnetworkRequest.php index b5d44a35438c..2a1c3e36484d 100644 --- a/Compute/src/V1/PatchSubnetworkRequest.php +++ b/Compute/src/V1/PatchSubnetworkRequest.php @@ -20,37 +20,37 @@ class PatchSubnetworkRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int32 drain_timeout_seconds = 357707098; */ - private $drain_timeout_seconds = null; + protected $drain_timeout_seconds = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name of the Subnetwork resource to patch. * * Generated from protobuf field string subnetwork = 307827694 [(.google.api.field_behavior) = REQUIRED]; */ - private $subnetwork = ''; + protected $subnetwork = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.Subnetwork subnetwork_resource = 42233151 [(.google.api.field_behavior) = REQUIRED]; */ - private $subnetwork_resource = null; + protected $subnetwork_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/PatchTargetGrpcProxyRequest.php b/Compute/src/V1/PatchTargetGrpcProxyRequest.php index 076bb0e4404d..f022fba38f8e 100644 --- a/Compute/src/V1/PatchTargetGrpcProxyRequest.php +++ b/Compute/src/V1/PatchTargetGrpcProxyRequest.php @@ -20,25 +20,25 @@ class PatchTargetGrpcProxyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name of the TargetGrpcProxy resource to patch. * * Generated from protobuf field string target_grpc_proxy = 5020283 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_grpc_proxy = ''; + protected $target_grpc_proxy = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.TargetGrpcProxy target_grpc_proxy_resource = 328922450 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_grpc_proxy_resource = null; + protected $target_grpc_proxy_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/PatchTargetHttpProxyRequest.php b/Compute/src/V1/PatchTargetHttpProxyRequest.php index 4989c4a8cb8d..23b3b49fa078 100644 --- a/Compute/src/V1/PatchTargetHttpProxyRequest.php +++ b/Compute/src/V1/PatchTargetHttpProxyRequest.php @@ -20,25 +20,25 @@ class PatchTargetHttpProxyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name of the TargetHttpProxy resource to patch. * * Generated from protobuf field string target_http_proxy = 206872421 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_http_proxy = ''; + protected $target_http_proxy = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.TargetHttpProxy target_http_proxy_resource = 24696744 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_http_proxy_resource = null; + protected $target_http_proxy_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/PatchTargetHttpsProxyRequest.php b/Compute/src/V1/PatchTargetHttpsProxyRequest.php index 9b69c12a281d..48ffb74e8fad 100644 --- a/Compute/src/V1/PatchTargetHttpsProxyRequest.php +++ b/Compute/src/V1/PatchTargetHttpsProxyRequest.php @@ -20,25 +20,25 @@ class PatchTargetHttpsProxyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name of the TargetHttpsProxy resource to patch. * * Generated from protobuf field string target_https_proxy = 52336748 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_https_proxy = ''; + protected $target_https_proxy = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.TargetHttpsProxy target_https_proxy_resource = 433657473 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_https_proxy_resource = null; + protected $target_https_proxy_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/PatchUrlMapRequest.php b/Compute/src/V1/PatchUrlMapRequest.php index f4422db67463..74477f81941c 100644 --- a/Compute/src/V1/PatchUrlMapRequest.php +++ b/Compute/src/V1/PatchUrlMapRequest.php @@ -20,25 +20,25 @@ class PatchUrlMapRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name of the UrlMap resource to patch. * * Generated from protobuf field string url_map = 367020684 [(.google.api.field_behavior) = REQUIRED]; */ - private $url_map = ''; + protected $url_map = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.UrlMap url_map_resource = 168675425 [(.google.api.field_behavior) = REQUIRED]; */ - private $url_map_resource = null; + protected $url_map_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/PathMatcher.php b/Compute/src/V1/PathMatcher.php index 0e97fee746b1..0b34421db5ce 100644 --- a/Compute/src/V1/PathMatcher.php +++ b/Compute/src/V1/PathMatcher.php @@ -20,43 +20,43 @@ class PathMatcher extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.CustomErrorResponsePolicy default_custom_error_response_policy = 81266089; */ - private $default_custom_error_response_policy = null; + protected $default_custom_error_response_policy = null; /** * defaultRouteAction takes effect when none of the pathRules or routeRules match. The load balancer performs advanced routing actions, such as URL rewrites and header transformations, before forwarding the request to the selected backend. Only one of defaultUrlRedirect, defaultService or defaultRouteAction.weightedBackendService can be set. URL maps for classic Application Load Balancers only support the urlRewrite action within a path matcher's defaultRouteAction. * * Generated from protobuf field optional .google.cloud.compute.v1.HttpRouteAction default_route_action = 378919466; */ - private $default_route_action = null; + protected $default_route_action = null; /** * The full or partial URL to the BackendService resource. This URL is used if none of the pathRules or routeRules defined by this PathMatcher are matched. For example, the following are all valid URLs to a BackendService resource: - https://www.googleapis.com/compute/v1/projects/project /global/backendServices/backendService - compute/v1/projects/project/global/backendServices/backendService - global/backendServices/backendService If defaultRouteAction is also specified, advanced routing actions, such as URL rewrites, take effect before sending the request to the backend. Only one of defaultUrlRedirect, defaultService or defaultRouteAction.weightedBackendService can be set. Authorization requires one or more of the following Google IAM permissions on the specified resource default_service: - compute.backendBuckets.use - compute.backendServices.use * * Generated from protobuf field optional string default_service = 370242231; */ - private $default_service = null; + protected $default_service = null; /** * When none of the specified pathRules or routeRules match, the request is redirected to a URL specified by defaultUrlRedirect. Only one of defaultUrlRedirect, defaultService or defaultRouteAction.weightedBackendService can be set. Not supported when the URL map is bound to a target gRPC proxy. * * Generated from protobuf field optional .google.cloud.compute.v1.HttpRedirectAction default_url_redirect = 359503338; */ - private $default_url_redirect = null; + protected $default_url_redirect = null; /** * An optional description of this resource. Provide this property when you create the resource. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * Specifies changes to request and response headers that need to take effect for the selected backend service. HeaderAction specified here are applied after the matching HttpRouteRule HeaderAction and before the HeaderAction in the UrlMap HeaderAction is not supported for load balancers that have their loadBalancingScheme set to EXTERNAL. Not supported when the URL map is bound to a target gRPC proxy that has validateForProxyless field set to true. * * Generated from protobuf field optional .google.cloud.compute.v1.HttpHeaderAction header_action = 328077352; */ - private $header_action = null; + protected $header_action = null; /** * The name to which this PathMatcher is referred by the HostRule. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * The list of path rules. Use this list instead of routeRules when routing based on simple path matching is all that's required. The order by which path rules are specified does not matter. Matches are always done on the longest-path-first basis. For example: a pathRule with a path /a/b/c/* will match before /a/b/* irrespective of the order in which those paths appear in this list. Within a given pathMatcher, only one of pathRules or routeRules must be set. * diff --git a/Compute/src/V1/PathRule.php b/Compute/src/V1/PathRule.php index 65046bb5b355..c5015ae92f86 100644 --- a/Compute/src/V1/PathRule.php +++ b/Compute/src/V1/PathRule.php @@ -20,7 +20,7 @@ class PathRule extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.CustomErrorResponsePolicy custom_error_response_policy = 202816619; */ - private $custom_error_response_policy = null; + protected $custom_error_response_policy = null; /** * The list of path patterns to match. Each must start with / and the only place a * is allowed is at the end following a /. The string fed to the path matcher does not include any text after the first ? or #, and those chars are not allowed here. * @@ -32,19 +32,19 @@ class PathRule extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.HttpRouteAction route_action = 424563948; */ - private $route_action = null; + protected $route_action = null; /** * The full or partial URL of the backend service resource to which traffic is directed if this rule is matched. If routeAction is also specified, advanced routing actions, such as URL rewrites, take effect before sending the request to the backend. Only one of urlRedirect, service or routeAction.weightedBackendService can be set. * * Generated from protobuf field optional string service = 373540533; */ - private $service = null; + protected $service = null; /** * When a path pattern is matched, the request is redirected to a URL specified by urlRedirect. Only one of urlRedirect, service or routeAction.weightedBackendService can be set. Not supported when the URL map is bound to a target gRPC proxy. * * Generated from protobuf field optional .google.cloud.compute.v1.HttpRedirectAction url_redirect = 405147820; */ - private $url_redirect = null; + protected $url_redirect = null; /** * Constructor. diff --git a/Compute/src/V1/PerInstanceConfig.php b/Compute/src/V1/PerInstanceConfig.php index 1bdbcecb7c8f..b1ae100f728d 100644 --- a/Compute/src/V1/PerInstanceConfig.php +++ b/Compute/src/V1/PerInstanceConfig.php @@ -19,26 +19,26 @@ class PerInstanceConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string fingerprint = 234678500; */ - private $fingerprint = null; + protected $fingerprint = null; /** * The name of a per-instance configuration and its corresponding instance. Serves as a merge key during UpdatePerInstanceConfigs operations, that is, if a per-instance configuration with the same name exists then it will be updated, otherwise a new one will be created for the VM instance with the same name. An attempt to create a per-instance configuration for a VM instance that either doesn't exist or is not part of the group will result in an error. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * The intended preserved state for the given instance. Does not contain preserved state generated from a stateful policy. * * Generated from protobuf field optional .google.cloud.compute.v1.PreservedState preserved_state = 2634026; */ - private $preserved_state = null; + protected $preserved_state = null; /** * The status of applying this per-instance configuration on the corresponding managed instance. * Check the Status enum for the list of possible values. * * Generated from protobuf field optional string status = 181260274; */ - private $status = null; + protected $status = null; /** * Constructor. diff --git a/Compute/src/V1/PerformMaintenanceInstanceRequest.php b/Compute/src/V1/PerformMaintenanceInstanceRequest.php index e09f13c38275..5da61208f55c 100644 --- a/Compute/src/V1/PerformMaintenanceInstanceRequest.php +++ b/Compute/src/V1/PerformMaintenanceInstanceRequest.php @@ -20,25 +20,25 @@ class PerformMaintenanceInstanceRequest extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field string instance = 18257045 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance = ''; + protected $instance = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/PerformMaintenanceNodeGroupRequest.php b/Compute/src/V1/PerformMaintenanceNodeGroupRequest.php index 70610b12be51..e19e485989c9 100644 --- a/Compute/src/V1/PerformMaintenanceNodeGroupRequest.php +++ b/Compute/src/V1/PerformMaintenanceNodeGroupRequest.php @@ -20,31 +20,31 @@ class PerformMaintenanceNodeGroupRequest extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field string node_group = 469958146 [(.google.api.field_behavior) = REQUIRED]; */ - private $node_group = ''; + protected $node_group = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.NodeGroupsPerformMaintenanceRequest node_groups_perform_maintenance_request_resource = 185310294 [(.google.api.field_behavior) = REQUIRED]; */ - private $node_groups_perform_maintenance_request_resource = null; + protected $node_groups_perform_maintenance_request_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/PerformMaintenanceReservationBlockRequest.php b/Compute/src/V1/PerformMaintenanceReservationBlockRequest.php index 6e7872ac7eb2..642ba3e82977 100644 --- a/Compute/src/V1/PerformMaintenanceReservationBlockRequest.php +++ b/Compute/src/V1/PerformMaintenanceReservationBlockRequest.php @@ -20,37 +20,37 @@ class PerformMaintenanceReservationBlockRequest extends \Google\Protobuf\Interna * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the reservation. Name should conform to RFC1035 or be a resource ID. * * Generated from protobuf field string reservation = 47530956 [(.google.api.field_behavior) = REQUIRED]; */ - private $reservation = ''; + protected $reservation = ''; /** * The name of the reservation block. Name should conform to RFC1035 or be a resource ID. * * Generated from protobuf field string reservation_block = 532832858 [(.google.api.field_behavior) = REQUIRED]; */ - private $reservation_block = ''; + protected $reservation_block = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.ReservationsBlocksPerformMaintenanceRequest reservations_blocks_perform_maintenance_request_resource = 485823625 [(.google.api.field_behavior) = REQUIRED]; */ - private $reservations_blocks_perform_maintenance_request_resource = null; + protected $reservations_blocks_perform_maintenance_request_resource = null; /** * Name of the zone for this request. Zone name should conform to RFC1035. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/PerformMaintenanceReservationRequest.php b/Compute/src/V1/PerformMaintenanceReservationRequest.php index 369c16c577e6..faded37bcdaf 100644 --- a/Compute/src/V1/PerformMaintenanceReservationRequest.php +++ b/Compute/src/V1/PerformMaintenanceReservationRequest.php @@ -20,31 +20,31 @@ class PerformMaintenanceReservationRequest extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the reservation. Name should conform to RFC1035 or be a resource ID. * * Generated from protobuf field string reservation = 47530956 [(.google.api.field_behavior) = REQUIRED]; */ - private $reservation = ''; + protected $reservation = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.ReservationsPerformMaintenanceRequest reservations_perform_maintenance_request_resource = 29702816 [(.google.api.field_behavior) = REQUIRED]; */ - private $reservations_perform_maintenance_request_resource = null; + protected $reservations_perform_maintenance_request_resource = null; /** * Name of the zone for this request. Zone name should conform to RFC1035. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/PerformMaintenanceReservationSubBlockRequest.php b/Compute/src/V1/PerformMaintenanceReservationSubBlockRequest.php index 2d83a0cbae37..954cd749cc5c 100644 --- a/Compute/src/V1/PerformMaintenanceReservationSubBlockRequest.php +++ b/Compute/src/V1/PerformMaintenanceReservationSubBlockRequest.php @@ -20,31 +20,31 @@ class PerformMaintenanceReservationSubBlockRequest extends \Google\Protobuf\Inte * * Generated from protobuf field string parent_name = 478151936 [(.google.api.field_behavior) = REQUIRED]; */ - private $parent_name = ''; + protected $parent_name = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the reservation subBlock. Name should conform to RFC1035 or be a resource ID. * * Generated from protobuf field string reservation_sub_block = 22750491 [(.google.api.field_behavior) = REQUIRED]; */ - private $reservation_sub_block = ''; + protected $reservation_sub_block = ''; /** * Name of the zone for this request. Zone name should conform to RFC1035. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/Policy.php b/Compute/src/V1/Policy.php index adfe84f7809e..d43151e82bad 100644 --- a/Compute/src/V1/Policy.php +++ b/Compute/src/V1/Policy.php @@ -32,17 +32,17 @@ class Policy extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string etag = 3123477; */ - private $etag = null; + protected $etag = null; /** * Generated from protobuf field optional bool iam_owned = 450566203; */ - private $iam_owned = null; + protected $iam_owned = null; /** * Specifies the format of the policy. Valid values are `0`, `1`, and `3`. Requests that specify an invalid value are rejected. Any operation that affects conditional role bindings must specify version `3`. This requirement applies to the following operations: * Getting a policy that includes a conditional role binding * Adding a conditional role binding to a policy * Changing a conditional role binding in a policy * Removing any role binding, with or without a condition, from a policy that includes conditions **Important:** If you use IAM Conditions, you must include the `etag` field whenever you call `setIamPolicy`. If you omit this field, then IAM allows you to overwrite a version `3` policy with a version `1` policy, and all of the conditions in the version `3` policy are lost. If a policy does not include any conditions, operations on that policy may specify any valid version or leave the field unset. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies). * * Generated from protobuf field optional int32 version = 351608024; */ - private $version = null; + protected $version = null; /** * Constructor. diff --git a/Compute/src/V1/PreservedStatePreservedDisk.php b/Compute/src/V1/PreservedStatePreservedDisk.php index c3e135e3ea6d..e3fede3c005b 100644 --- a/Compute/src/V1/PreservedStatePreservedDisk.php +++ b/Compute/src/V1/PreservedStatePreservedDisk.php @@ -20,20 +20,20 @@ class PreservedStatePreservedDisk extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string auto_delete = 464761403; */ - private $auto_delete = null; + protected $auto_delete = null; /** * The mode in which to attach this disk, either READ_WRITE or READ_ONLY. If not specified, the default is to attach the disk in READ_WRITE mode. * Check the Mode enum for the list of possible values. * * Generated from protobuf field optional string mode = 3357091; */ - private $mode = null; + protected $mode = null; /** * The URL of the disk resource that is stateful and should be attached to the VM instance. * * Generated from protobuf field optional string source = 177235995; */ - private $source = null; + protected $source = null; /** * Constructor. diff --git a/Compute/src/V1/PreservedStatePreservedNetworkIp.php b/Compute/src/V1/PreservedStatePreservedNetworkIp.php index cad3d41c9b7e..935223c0f9a7 100644 --- a/Compute/src/V1/PreservedStatePreservedNetworkIp.php +++ b/Compute/src/V1/PreservedStatePreservedNetworkIp.php @@ -20,13 +20,13 @@ class PreservedStatePreservedNetworkIp extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string auto_delete = 464761403; */ - private $auto_delete = null; + protected $auto_delete = null; /** * Ip address representation * * Generated from protobuf field optional .google.cloud.compute.v1.PreservedStatePreservedNetworkIpIpAddress ip_address = 406272220; */ - private $ip_address = null; + protected $ip_address = null; /** * Constructor. diff --git a/Compute/src/V1/PreservedStatePreservedNetworkIpIpAddress.php b/Compute/src/V1/PreservedStatePreservedNetworkIpIpAddress.php index 53ba4a0cc3a2..68afad8b1709 100644 --- a/Compute/src/V1/PreservedStatePreservedNetworkIpIpAddress.php +++ b/Compute/src/V1/PreservedStatePreservedNetworkIpIpAddress.php @@ -19,13 +19,13 @@ class PreservedStatePreservedNetworkIpIpAddress extends \Google\Protobuf\Interna * * Generated from protobuf field optional string address = 462920692; */ - private $address = null; + protected $address = null; /** * An IPv4 internal network address to assign to the instance for this network interface. * * Generated from protobuf field optional string literal = 182460591; */ - private $literal = null; + protected $literal = null; /** * Constructor. diff --git a/Compute/src/V1/PreviewRouterRequest.php b/Compute/src/V1/PreviewRouterRequest.php index 2a976ec4959a..abfbbb0df249 100644 --- a/Compute/src/V1/PreviewRouterRequest.php +++ b/Compute/src/V1/PreviewRouterRequest.php @@ -20,25 +20,25 @@ class PreviewRouterRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Name of the Router resource to query. * * Generated from protobuf field string router = 148608841 [(.google.api.field_behavior) = REQUIRED]; */ - private $router = ''; + protected $router = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.Router router_resource = 155222084 [(.google.api.field_behavior) = REQUIRED]; */ - private $router_resource = null; + protected $router_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/Project.php b/Compute/src/V1/Project.php index a943309b6d05..15adc640d920 100644 --- a/Compute/src/V1/Project.php +++ b/Compute/src/V1/Project.php @@ -21,38 +21,38 @@ class Project extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string cloud_armor_tier = 4427052; */ - private $cloud_armor_tier = null; + protected $cloud_armor_tier = null; /** * Metadata key/value pairs available to all instances contained in this project. See Custom metadata for more information. * * Generated from protobuf field optional .google.cloud.compute.v1.Metadata common_instance_metadata = 185794117; */ - private $common_instance_metadata = null; + protected $common_instance_metadata = null; /** * [Output Only] Creation timestamp in RFC3339 text format. * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * This signifies the default network tier used for configuring resources of the project and can only take the following values: PREMIUM, STANDARD. Initially the default network tier is PREMIUM. * Check the DefaultNetworkTier enum for the list of possible values. * * Generated from protobuf field optional string default_network_tier = 471753361; */ - private $default_network_tier = null; + protected $default_network_tier = null; /** * [Output Only] Default service account used by VMs running in this project. * * Generated from protobuf field optional string default_service_account = 298712229; */ - private $default_service_account = null; + protected $default_service_account = null; /** * An optional textual description of the resource. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * An optional list of restricted features enabled for use on this project. * @@ -64,19 +64,19 @@ class Project extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * [Output Only] Type of the resource. Always compute#project for projects. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * The project ID. For example: my-example-project. Use the project ID to make requests to Compute Engine. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * [Output Only] Quotas assigned to this project. * @@ -88,27 +88,27 @@ class Project extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * An optional naming prefix for daily usage reports and the Google Cloud Storage bucket where they are stored. * * Generated from protobuf field optional .google.cloud.compute.v1.UsageExportLocation usage_export_location = 347543874; */ - private $usage_export_location = null; + protected $usage_export_location = null; /** * [Output Only] Default internal DNS setting used by VMs running in this project. * Check the VmDnsSetting enum for the list of possible values. * * Generated from protobuf field optional string vm_dns_setting = 58856370; */ - private $vm_dns_setting = null; + protected $vm_dns_setting = null; /** * [Output Only] The role this project has in a shared VPC configuration. Currently, only projects with the host role, which is specified by the value HOST, are differentiated. * Check the XpnProjectStatus enum for the list of possible values. * * Generated from protobuf field optional string xpn_project_status = 228419265; */ - private $xpn_project_status = null; + protected $xpn_project_status = null; /** * Constructor. diff --git a/Compute/src/V1/ProjectsClient.php b/Compute/src/V1/ProjectsClient.php deleted file mode 100644 index ddbd2629d125..000000000000 --- a/Compute/src/V1/ProjectsClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional .google.cloud.compute.v1.XpnResourceId xpn_resource = 133384631; */ - private $xpn_resource = null; + protected $xpn_resource = null; /** * Constructor. diff --git a/Compute/src/V1/ProjectsEnableXpnResourceRequest.php b/Compute/src/V1/ProjectsEnableXpnResourceRequest.php index e14e6c2c09f6..09f996544384 100644 --- a/Compute/src/V1/ProjectsEnableXpnResourceRequest.php +++ b/Compute/src/V1/ProjectsEnableXpnResourceRequest.php @@ -19,7 +19,7 @@ class ProjectsEnableXpnResourceRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.XpnResourceId xpn_resource = 133384631; */ - private $xpn_resource = null; + protected $xpn_resource = null; /** * Constructor. diff --git a/Compute/src/V1/ProjectsGetXpnResources.php b/Compute/src/V1/ProjectsGetXpnResources.php index 76b4f8f40d52..5bbc5990d129 100644 --- a/Compute/src/V1/ProjectsGetXpnResources.php +++ b/Compute/src/V1/ProjectsGetXpnResources.php @@ -19,13 +19,13 @@ class ProjectsGetXpnResources extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * Service resources (a.k.a service projects) attached to this project as their shared VPC host. * diff --git a/Compute/src/V1/ProjectsListXpnHostsRequest.php b/Compute/src/V1/ProjectsListXpnHostsRequest.php index 18908e83a365..375063e9ac3d 100644 --- a/Compute/src/V1/ProjectsListXpnHostsRequest.php +++ b/Compute/src/V1/ProjectsListXpnHostsRequest.php @@ -19,7 +19,7 @@ class ProjectsListXpnHostsRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string organization = 105180467; */ - private $organization = null; + protected $organization = null; /** * Constructor. diff --git a/Compute/src/V1/ProjectsSetCloudArmorTierRequest.php b/Compute/src/V1/ProjectsSetCloudArmorTierRequest.php index 43fd04f271f7..4cdc40393d33 100644 --- a/Compute/src/V1/ProjectsSetCloudArmorTierRequest.php +++ b/Compute/src/V1/ProjectsSetCloudArmorTierRequest.php @@ -20,7 +20,7 @@ class ProjectsSetCloudArmorTierRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string cloud_armor_tier = 4427052; */ - private $cloud_armor_tier = null; + protected $cloud_armor_tier = null; /** * Constructor. diff --git a/Compute/src/V1/ProjectsSetDefaultNetworkTierRequest.php b/Compute/src/V1/ProjectsSetDefaultNetworkTierRequest.php index 27b67c9145a4..fdfc56d38aab 100644 --- a/Compute/src/V1/ProjectsSetDefaultNetworkTierRequest.php +++ b/Compute/src/V1/ProjectsSetDefaultNetworkTierRequest.php @@ -20,7 +20,7 @@ class ProjectsSetDefaultNetworkTierRequest extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field optional string network_tier = 517397843; */ - private $network_tier = null; + protected $network_tier = null; /** * Constructor. diff --git a/Compute/src/V1/PublicAdvertisedPrefix.php b/Compute/src/V1/PublicAdvertisedPrefix.php index d2f979063d94..7a9b4f9e40db 100644 --- a/Compute/src/V1/PublicAdvertisedPrefix.php +++ b/Compute/src/V1/PublicAdvertisedPrefix.php @@ -21,62 +21,62 @@ class PublicAdvertisedPrefix extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string byoip_api_version = 162683283; */ - private $byoip_api_version = null; + protected $byoip_api_version = null; /** * [Output Only] Creation timestamp in RFC3339 text format. * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * An optional description of this resource. Provide this property when you create the resource. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * The address to be used for reverse DNS verification. * * Generated from protobuf field optional string dns_verification_ip = 241011381; */ - private $dns_verification_ip = null; + protected $dns_verification_ip = null; /** * Fingerprint of this resource. A hash of the contents stored in this object. This field is used in optimistic locking. This field will be ignored when inserting a new PublicAdvertisedPrefix. An up-to-date fingerprint must be provided in order to update the PublicAdvertisedPrefix, otherwise the request will fail with error 412 conditionNotMet. To see the latest fingerprint, make a get() request to retrieve a PublicAdvertisedPrefix. * * Generated from protobuf field optional string fingerprint = 234678500; */ - private $fingerprint = null; + protected $fingerprint = null; /** * [Output Only] The unique identifier for the resource type. The server generates this identifier. * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * The address range, in CIDR format, represented by this public advertised prefix. * * Generated from protobuf field optional string ip_cidr_range = 98117322; */ - private $ip_cidr_range = null; + protected $ip_cidr_range = null; /** * [Output Only] Type of the resource. Always compute#publicAdvertisedPrefix for public advertised prefixes. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * Specifies how child public delegated prefix will be scoped. It could be one of following values: - `REGIONAL`: The public delegated prefix is regional only. The provisioning will take a few minutes. - `GLOBAL`: The public delegated prefix is global only. The provisioning will take ~4 weeks. - `GLOBAL_AND_REGIONAL` [output only]: The public delegated prefixes is BYOIP V1 legacy prefix. This is output only value and no longer supported in BYOIP V2. * Check the PdpScope enum for the list of possible values. * * Generated from protobuf field optional string pdp_scope = 524264785; */ - private $pdp_scope = null; + protected $pdp_scope = null; /** * [Output Only] The list of public delegated prefixes that exist for this public advertised prefix. * @@ -88,20 +88,20 @@ class PublicAdvertisedPrefix extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] The shared secret to be used for reverse DNS verification. * * Generated from protobuf field optional string shared_secret = 381932490; */ - private $shared_secret = null; + protected $shared_secret = null; /** * The status of the public advertised prefix. Possible values include: - `INITIAL`: RPKI validation is complete. - `PTR_CONFIGURED`: User has configured the PTR. - `VALIDATED`: Reverse DNS lookup is successful. - `REVERSE_DNS_LOOKUP_FAILED`: Reverse DNS lookup failed. - `PREFIX_CONFIGURATION_IN_PROGRESS`: The prefix is being configured. - `PREFIX_CONFIGURATION_COMPLETE`: The prefix is fully configured. - `PREFIX_REMOVAL_IN_PROGRESS`: The prefix is being removed. * Check the Status enum for the list of possible values. * * Generated from protobuf field optional string status = 181260274; */ - private $status = null; + protected $status = null; /** * Constructor. diff --git a/Compute/src/V1/PublicAdvertisedPrefixList.php b/Compute/src/V1/PublicAdvertisedPrefixList.php index 1025c652f127..2fcad75d830c 100644 --- a/Compute/src/V1/PublicAdvertisedPrefixList.php +++ b/Compute/src/V1/PublicAdvertisedPrefixList.php @@ -19,7 +19,7 @@ class PublicAdvertisedPrefixList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of PublicAdvertisedPrefix resources. * @@ -31,25 +31,25 @@ class PublicAdvertisedPrefixList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/PublicAdvertisedPrefixPublicDelegatedPrefix.php b/Compute/src/V1/PublicAdvertisedPrefixPublicDelegatedPrefix.php index bf18782c0204..9255ed5a3132 100644 --- a/Compute/src/V1/PublicAdvertisedPrefixPublicDelegatedPrefix.php +++ b/Compute/src/V1/PublicAdvertisedPrefixPublicDelegatedPrefix.php @@ -20,31 +20,31 @@ class PublicAdvertisedPrefixPublicDelegatedPrefix extends \Google\Protobuf\Inter * * Generated from protobuf field optional string ip_range = 145092645; */ - private $ip_range = null; + protected $ip_range = null; /** * The name of the public delegated prefix * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * The project number of the public delegated prefix * * Generated from protobuf field optional string project = 227560217; */ - private $project = null; + protected $project = null; /** * The region of the public delegated prefix if it is regional. If absent, the prefix is global. * * Generated from protobuf field optional string region = 138946292; */ - private $region = null; + protected $region = null; /** * The status of the public delegated prefix. Possible values are: INITIALIZING: The public delegated prefix is being initialized and addresses cannot be created yet. ANNOUNCED: The public delegated prefix is active. * * Generated from protobuf field optional string status = 181260274; */ - private $status = null; + protected $status = null; /** * Constructor. diff --git a/Compute/src/V1/PublicAdvertisedPrefixesClient.php b/Compute/src/V1/PublicAdvertisedPrefixesClient.php deleted file mode 100644 index f73c31bc015f..000000000000 --- a/Compute/src/V1/PublicAdvertisedPrefixesClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional int32 allocatable_prefix_length = 38427446; */ - private $allocatable_prefix_length = null; + protected $allocatable_prefix_length = null; /** * [Output Only] The version of BYOIP API. * Check the ByoipApiVersion enum for the list of possible values. * * Generated from protobuf field optional string byoip_api_version = 162683283; */ - private $byoip_api_version = null; + protected $byoip_api_version = null; /** * [Output Only] Creation timestamp in RFC3339 text format. * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * An optional description of this resource. Provide this property when you create the resource. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * Fingerprint of this resource. A hash of the contents stored in this object. This field is used in optimistic locking. This field will be ignored when inserting a new PublicDelegatedPrefix. An up-to-date fingerprint must be provided in order to update the PublicDelegatedPrefix, otherwise the request will fail with error 412 conditionNotMet. To see the latest fingerprint, make a get() request to retrieve a PublicDelegatedPrefix. * * Generated from protobuf field optional string fingerprint = 234678500; */ - private $fingerprint = null; + protected $fingerprint = null; /** * [Output Only] The unique identifier for the resource type. The server generates this identifier. * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * The IP address range, in CIDR format, represented by this public delegated prefix. * * Generated from protobuf field optional string ip_cidr_range = 98117322; */ - private $ip_cidr_range = null; + protected $ip_cidr_range = null; /** * If true, the prefix will be live migrated. * * Generated from protobuf field optional bool is_live_migration = 511823856; */ - private $is_live_migration = null; + protected $is_live_migration = null; /** * [Output Only] Type of the resource. Always compute#publicDelegatedPrefix for public delegated prefixes. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * The public delegated prefix mode for IPv6 only. * Check the Mode enum for the list of possible values. * * Generated from protobuf field optional string mode = 3357091; */ - private $mode = null; + protected $mode = null; /** * Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * The URL of parent prefix. Either PublicAdvertisedPrefix or PublicDelegatedPrefix. * * Generated from protobuf field optional string parent_prefix = 15233991; */ - private $parent_prefix = null; + protected $parent_prefix = null; /** * The list of sub public delegated prefixes that exist for this public delegated prefix. * @@ -100,20 +100,20 @@ class PublicDelegatedPrefix extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string region = 138946292; */ - private $region = null; + protected $region = null; /** * [Output Only] Server-defined URL for the resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] The status of the public delegated prefix, which can be one of following values: - `INITIALIZING` The public delegated prefix is being initialized and addresses cannot be created yet. - `READY_TO_ANNOUNCE` The public delegated prefix is a live migration prefix and is active. - `ANNOUNCED` The public delegated prefix is announced and ready to use. - `DELETING` The public delegated prefix is being deprovsioned. * Check the Status enum for the list of possible values. * * Generated from protobuf field optional string status = 181260274; */ - private $status = null; + protected $status = null; /** * Constructor. diff --git a/Compute/src/V1/PublicDelegatedPrefixAggregatedList.php b/Compute/src/V1/PublicDelegatedPrefixAggregatedList.php index f0d2418fe310..c6d5cc05bc1b 100644 --- a/Compute/src/V1/PublicDelegatedPrefixAggregatedList.php +++ b/Compute/src/V1/PublicDelegatedPrefixAggregatedList.php @@ -19,7 +19,7 @@ class PublicDelegatedPrefixAggregatedList extends \Google\Protobuf\Internal\Mess * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of PublicDelegatedPrefixesScopedList resources. * @@ -31,19 +31,19 @@ class PublicDelegatedPrefixAggregatedList extends \Google\Protobuf\Internal\Mess * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Unreachable resources. * @@ -55,7 +55,7 @@ class PublicDelegatedPrefixAggregatedList extends \Google\Protobuf\Internal\Mess * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/PublicDelegatedPrefixList.php b/Compute/src/V1/PublicDelegatedPrefixList.php index 616f52149dda..552872b69308 100644 --- a/Compute/src/V1/PublicDelegatedPrefixList.php +++ b/Compute/src/V1/PublicDelegatedPrefixList.php @@ -19,7 +19,7 @@ class PublicDelegatedPrefixList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of PublicDelegatedPrefix resources. * @@ -31,25 +31,25 @@ class PublicDelegatedPrefixList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/PublicDelegatedPrefixPublicDelegatedSubPrefix.php b/Compute/src/V1/PublicDelegatedPrefixPublicDelegatedSubPrefix.php index 1bbb59ce47c5..8f930c25c806 100644 --- a/Compute/src/V1/PublicDelegatedPrefixPublicDelegatedSubPrefix.php +++ b/Compute/src/V1/PublicDelegatedPrefixPublicDelegatedSubPrefix.php @@ -20,57 +20,57 @@ class PublicDelegatedPrefixPublicDelegatedSubPrefix extends \Google\Protobuf\Int * * Generated from protobuf field optional int32 allocatable_prefix_length = 38427446; */ - private $allocatable_prefix_length = null; + protected $allocatable_prefix_length = null; /** * Name of the project scoping this PublicDelegatedSubPrefix. * * Generated from protobuf field optional string delegatee_project = 414860634; */ - private $delegatee_project = null; + protected $delegatee_project = null; /** * An optional description of this resource. Provide this property when you create the resource. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * The IP address range, in CIDR format, represented by this sub public delegated prefix. * * Generated from protobuf field optional string ip_cidr_range = 98117322; */ - private $ip_cidr_range = null; + protected $ip_cidr_range = null; /** * Whether the sub prefix is delegated to create Address resources in the delegatee project. * * Generated from protobuf field optional bool is_address = 352617951; */ - private $is_address = null; + protected $is_address = null; /** * The PublicDelegatedSubPrefix mode for IPv6 only. * Check the Mode enum for the list of possible values. * * Generated from protobuf field optional string mode = 3357091; */ - private $mode = null; + protected $mode = null; /** * The name of the sub public delegated prefix. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * [Output Only] The region of the sub public delegated prefix if it is regional. If absent, the sub prefix is global. * * Generated from protobuf field optional string region = 138946292; */ - private $region = null; + protected $region = null; /** * [Output Only] The status of the sub public delegated prefix. * Check the Status enum for the list of possible values. * * Generated from protobuf field optional string status = 181260274; */ - private $status = null; + protected $status = null; /** * Constructor. diff --git a/Compute/src/V1/PublicDelegatedPrefixesClient.php b/Compute/src/V1/PublicDelegatedPrefixesClient.php deleted file mode 100644 index 72818908a129..000000000000 --- a/Compute/src/V1/PublicDelegatedPrefixesClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/Quota.php b/Compute/src/V1/Quota.php index ec49778722c6..0d72201cecde 100644 --- a/Compute/src/V1/Quota.php +++ b/Compute/src/V1/Quota.php @@ -20,26 +20,26 @@ class Quota extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional double limit = 102976443; */ - private $limit = null; + protected $limit = null; /** * [Output Only] Name of the quota metric. * Check the Metric enum for the list of possible values. * * Generated from protobuf field optional string metric = 533067184; */ - private $metric = null; + protected $metric = null; /** * [Output Only] Owning resource. This is the resource on which this quota is applied. * * Generated from protobuf field optional string owner = 106164915; */ - private $owner = null; + protected $owner = null; /** * [Output Only] Current usage of this metric. * * Generated from protobuf field optional double usage = 111574433; */ - private $usage = null; + protected $usage = null; /** * Constructor. diff --git a/Compute/src/V1/QuotaExceededInfo.php b/Compute/src/V1/QuotaExceededInfo.php index 84ed30661ba4..874d78e3202a 100644 --- a/Compute/src/V1/QuotaExceededInfo.php +++ b/Compute/src/V1/QuotaExceededInfo.php @@ -26,32 +26,32 @@ class QuotaExceededInfo extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional double future_limit = 456564287; */ - private $future_limit = null; + protected $future_limit = null; /** * Current effective quota limit. The limit's unit depends on the quota type or metric. * * Generated from protobuf field optional double limit = 102976443; */ - private $limit = null; + protected $limit = null; /** * The name of the quota limit. * * Generated from protobuf field optional string limit_name = 398197903; */ - private $limit_name = null; + protected $limit_name = null; /** * The Compute Engine quota metric name. * * Generated from protobuf field optional string metric_name = 409881530; */ - private $metric_name = null; + protected $metric_name = null; /** * Rollout status of the future quota limit. * Check the RolloutStatus enum for the list of possible values. * * Generated from protobuf field optional string rollout_status = 476426816; */ - private $rollout_status = null; + protected $rollout_status = null; /** * Constructor. diff --git a/Compute/src/V1/QuotaStatusWarning.php b/Compute/src/V1/QuotaStatusWarning.php index c20f97ac0c26..b81ed5ff0f6d 100644 --- a/Compute/src/V1/QuotaStatusWarning.php +++ b/Compute/src/V1/QuotaStatusWarning.php @@ -21,7 +21,7 @@ class QuotaStatusWarning extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string code = 3059181; */ - private $code = null; + protected $code = null; /** * [Output Only] Metadata about this warning in key: value format. For example: "data": [ { "key": "scope", "value": "zones/us-east1-d" } * @@ -33,7 +33,7 @@ class QuotaStatusWarning extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string message = 418054151; */ - private $message = null; + protected $message = null; /** * Constructor. diff --git a/Compute/src/V1/README.md b/Compute/src/V1/README.md deleted file mode 100644 index b7b14e0934b4..000000000000 --- a/Compute/src/V1/README.md +++ /dev/null @@ -1,15 +0,0 @@ - -# Google Cloud Compute V1 generated client for PHP - -### Sample - -```php -require 'vendor/autoload.php'; - -use Google\Cloud\Compute\V1\InstancesClient; - -$instances = new InstancesClient(); -foreach ($instances->list_('[MY_PROJECT_ID]', 'us-west1') as $instance) { - print($instance->getName() . PHP_EOL); -} -``` diff --git a/Compute/src/V1/RawDisk.php b/Compute/src/V1/RawDisk.php index 59ed2262eca6..c06a523602f8 100644 --- a/Compute/src/V1/RawDisk.php +++ b/Compute/src/V1/RawDisk.php @@ -21,19 +21,19 @@ class RawDisk extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string container_type = 318809144; */ - private $container_type = null; + protected $container_type = null; /** * [Deprecated] This field is deprecated. An optional SHA1 checksum of the disk image before unpackaging provided by the client when the disk image is created. * * Generated from protobuf field optional string sha1_checksum = 314444349; */ - private $sha1_checksum = null; + protected $sha1_checksum = null; /** * The full Google Cloud Storage URL where the raw disk image archive is stored. The following are valid formats for the URL: - https://storage.googleapis.com/bucket_name/image_archive_name - https://storage.googleapis.com/bucket_name/folder_name/ image_archive_name In order to create an image, you must provide the full or partial URL of one of the following: - The rawDisk.source URL - The sourceDisk URL - The sourceImage URL - The sourceSnapshot URL * * Generated from protobuf field optional string source = 177235995; */ - private $source = null; + protected $source = null; /** * Constructor. diff --git a/Compute/src/V1/RecreateInstancesInstanceGroupManagerRequest.php b/Compute/src/V1/RecreateInstancesInstanceGroupManagerRequest.php index 0028a40d56e7..9c0d61e74ecd 100644 --- a/Compute/src/V1/RecreateInstancesInstanceGroupManagerRequest.php +++ b/Compute/src/V1/RecreateInstancesInstanceGroupManagerRequest.php @@ -20,31 +20,31 @@ class RecreateInstancesInstanceGroupManagerRequest extends \Google\Protobuf\Inte * * Generated from protobuf field string instance_group_manager = 249363395 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group_manager = ''; + protected $instance_group_manager = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.InstanceGroupManagersRecreateInstancesRequest instance_group_managers_recreate_instances_request_resource = 21405952 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group_managers_recreate_instances_request_resource = null; + protected $instance_group_managers_recreate_instances_request_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone where the managed instance group is located. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/RecreateInstancesRegionInstanceGroupManagerRequest.php b/Compute/src/V1/RecreateInstancesRegionInstanceGroupManagerRequest.php index fbe6bf170db3..2e63e0860acc 100644 --- a/Compute/src/V1/RecreateInstancesRegionInstanceGroupManagerRequest.php +++ b/Compute/src/V1/RecreateInstancesRegionInstanceGroupManagerRequest.php @@ -20,31 +20,31 @@ class RecreateInstancesRegionInstanceGroupManagerRequest extends \Google\Protobu * * Generated from protobuf field string instance_group_manager = 249363395 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group_manager = ''; + protected $instance_group_manager = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.RegionInstanceGroupManagersRecreateRequest region_instance_group_managers_recreate_request_resource = 170999316 [(.google.api.field_behavior) = REQUIRED]; */ - private $region_instance_group_managers_recreate_request_resource = null; + protected $region_instance_group_managers_recreate_request_resource = null; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/Reference.php b/Compute/src/V1/Reference.php index 2b8c5952f287..827285c61f87 100644 --- a/Compute/src/V1/Reference.php +++ b/Compute/src/V1/Reference.php @@ -20,25 +20,25 @@ class Reference extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * A description of the reference type with no implied semantics. Possible values include: 1. MEMBER_OF * * Generated from protobuf field optional string reference_type = 247521198; */ - private $reference_type = null; + protected $reference_type = null; /** * URL of the resource which refers to the target. * * Generated from protobuf field optional string referrer = 351173663; */ - private $referrer = null; + protected $referrer = null; /** * URL of the resource to which this reference points. * * Generated from protobuf field optional string target = 192835985; */ - private $target = null; + protected $target = null; /** * Constructor. diff --git a/Compute/src/V1/Region.php b/Compute/src/V1/Region.php index 7549761c7c6f..5e8f8b4bacbd 100644 --- a/Compute/src/V1/Region.php +++ b/Compute/src/V1/Region.php @@ -20,43 +20,43 @@ class Region extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * [Output Only] The deprecation status associated with this region. * * Generated from protobuf field optional .google.cloud.compute.v1.DeprecationStatus deprecated = 515138995; */ - private $deprecated = null; + protected $deprecated = null; /** * [Output Only] Textual description of the resource. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * [Output Only] The unique identifier for the resource. This identifier is defined by the server. * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * [Output Only] Type of the resource. Always compute#region for regions. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] Name of the resource. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * [Output Only] Warning of fetching the `quotas` field for this region. This field is populated only if fetching of the `quotas` field fails. * * Generated from protobuf field optional .google.cloud.compute.v1.QuotaStatusWarning quota_status_warning = 302941430; */ - private $quota_status_warning = null; + protected $quota_status_warning = null; /** * [Output Only] Quotas assigned to this region. * @@ -68,20 +68,20 @@ class Region extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Status of the region, either UP or DOWN. * Check the Status enum for the list of possible values. * * Generated from protobuf field optional string status = 181260274; */ - private $status = null; + protected $status = null; /** * [Output Only] Reserved for future use. * * Generated from protobuf field optional bool supports_pzs = 83983214; */ - private $supports_pzs = null; + protected $supports_pzs = null; /** * [Output Only] A list of zones available in this region, in the form of resource URLs. * diff --git a/Compute/src/V1/RegionAddressesMoveRequest.php b/Compute/src/V1/RegionAddressesMoveRequest.php index f5a94293baba..d036b2d45d6c 100644 --- a/Compute/src/V1/RegionAddressesMoveRequest.php +++ b/Compute/src/V1/RegionAddressesMoveRequest.php @@ -19,13 +19,13 @@ class RegionAddressesMoveRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * The URL of the destination address to move to. This can be a full or partial URL. For example, the following are all valid URLs to a address: - https://www.googleapis.com/compute/v1/projects/project/regions/region /addresses/address - projects/project/regions/region/addresses/address Note that destination project must be different from the source project. So /regions/region/addresses/address is not valid partial url. * * Generated from protobuf field optional string destination_address = 371693763; */ - private $destination_address = null; + protected $destination_address = null; /** * Constructor. diff --git a/Compute/src/V1/RegionAutoscalerList.php b/Compute/src/V1/RegionAutoscalerList.php index fcf448bdd826..205e8bab92b2 100644 --- a/Compute/src/V1/RegionAutoscalerList.php +++ b/Compute/src/V1/RegionAutoscalerList.php @@ -20,7 +20,7 @@ class RegionAutoscalerList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of Autoscaler resources. * @@ -32,25 +32,25 @@ class RegionAutoscalerList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/RegionAutoscalersClient.php b/Compute/src/V1/RegionAutoscalersClient.php deleted file mode 100644 index 66dffc7a5cd6..000000000000 --- a/Compute/src/V1/RegionAutoscalersClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of DiskType resources. * @@ -31,25 +31,25 @@ class RegionDiskTypeList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/RegionDiskTypesClient.php b/Compute/src/V1/RegionDiskTypesClient.php deleted file mode 100644 index 1f9b1ee1733f..000000000000 --- a/Compute/src/V1/RegionDiskTypesClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional int64 size_gb = 494929369; */ - private $size_gb = null; + protected $size_gb = null; /** * Constructor. diff --git a/Compute/src/V1/RegionDisksStartAsyncReplicationRequest.php b/Compute/src/V1/RegionDisksStartAsyncReplicationRequest.php index 7e211a00f96e..8e7f39cbbe6a 100644 --- a/Compute/src/V1/RegionDisksStartAsyncReplicationRequest.php +++ b/Compute/src/V1/RegionDisksStartAsyncReplicationRequest.php @@ -19,7 +19,7 @@ class RegionDisksStartAsyncReplicationRequest extends \Google\Protobuf\Internal\ * * Generated from protobuf field optional string async_secondary_disk = 131645867; */ - private $async_secondary_disk = null; + protected $async_secondary_disk = null; /** * Constructor. diff --git a/Compute/src/V1/RegionHealthCheckServicesClient.php b/Compute/src/V1/RegionHealthCheckServicesClient.php deleted file mode 100644 index 6edf04a802fd..000000000000 --- a/Compute/src/V1/RegionHealthCheckServicesClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of InstanceGroup resources. * @@ -32,25 +32,25 @@ class RegionInstanceGroupList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/RegionInstanceGroupManagerList.php b/Compute/src/V1/RegionInstanceGroupManagerList.php index a38ac463eb53..26f1e9443f40 100644 --- a/Compute/src/V1/RegionInstanceGroupManagerList.php +++ b/Compute/src/V1/RegionInstanceGroupManagerList.php @@ -20,7 +20,7 @@ class RegionInstanceGroupManagerList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of InstanceGroupManager resources. * @@ -32,25 +32,25 @@ class RegionInstanceGroupManagerList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/RegionInstanceGroupManagersApplyUpdatesRequest.php b/Compute/src/V1/RegionInstanceGroupManagersApplyUpdatesRequest.php index 6d57e7a29eca..54e83fafea99 100644 --- a/Compute/src/V1/RegionInstanceGroupManagersApplyUpdatesRequest.php +++ b/Compute/src/V1/RegionInstanceGroupManagersApplyUpdatesRequest.php @@ -20,7 +20,7 @@ class RegionInstanceGroupManagersApplyUpdatesRequest extends \Google\Protobuf\In * * Generated from protobuf field optional bool all_instances = 403676512; */ - private $all_instances = null; + protected $all_instances = null; /** * The list of URLs of one or more instances for which you want to apply updates. Each URL can be a full URL or a partial URL, such as zones/[ZONE]/instances/[INSTANCE_NAME]. * @@ -33,14 +33,14 @@ class RegionInstanceGroupManagersApplyUpdatesRequest extends \Google\Protobuf\In * * Generated from protobuf field optional string minimal_action = 270567060; */ - private $minimal_action = null; + protected $minimal_action = null; /** * The most disruptive action that you want to perform on each instance during the update: - REPLACE: Delete the instance and create it again. - RESTART: Stop the instance and start it again. - REFRESH: Do not stop the instance and limit disruption as much as possible. - NONE: Do not disrupt the instance at all. By default, the most disruptive allowed action is REPLACE. If your update requires a more disruptive action than you set with this flag, the update request will fail. * Check the MostDisruptiveAllowedAction enum for the list of possible values. * * Generated from protobuf field optional string most_disruptive_allowed_action = 66103053; */ - private $most_disruptive_allowed_action = null; + protected $most_disruptive_allowed_action = null; /** * Constructor. diff --git a/Compute/src/V1/RegionInstanceGroupManagersClient.php b/Compute/src/V1/RegionInstanceGroupManagersClient.php deleted file mode 100644 index d811194dddcc..000000000000 --- a/Compute/src/V1/RegionInstanceGroupManagersClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional bool skip_instances_on_validation_error = 40631073; */ - private $skip_instances_on_validation_error = null; + protected $skip_instances_on_validation_error = null; /** * Constructor. diff --git a/Compute/src/V1/RegionInstanceGroupManagersListErrorsResponse.php b/Compute/src/V1/RegionInstanceGroupManagersListErrorsResponse.php index 2919c170aeca..370441e2c3db 100644 --- a/Compute/src/V1/RegionInstanceGroupManagersListErrorsResponse.php +++ b/Compute/src/V1/RegionInstanceGroupManagersListErrorsResponse.php @@ -25,7 +25,7 @@ class RegionInstanceGroupManagersListErrorsResponse extends \Google\Protobuf\Int * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * Constructor. diff --git a/Compute/src/V1/RegionInstanceGroupManagersListInstanceConfigsResp.php b/Compute/src/V1/RegionInstanceGroupManagersListInstanceConfigsResp.php index b8d1f15624e9..38237c01f464 100644 --- a/Compute/src/V1/RegionInstanceGroupManagersListInstanceConfigsResp.php +++ b/Compute/src/V1/RegionInstanceGroupManagersListInstanceConfigsResp.php @@ -25,13 +25,13 @@ class RegionInstanceGroupManagersListInstanceConfigsResp extends \Google\Protobu * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/RegionInstanceGroupManagersListInstancesResponse.php b/Compute/src/V1/RegionInstanceGroupManagersListInstancesResponse.php index 8d06193f7ace..802317a23179 100644 --- a/Compute/src/V1/RegionInstanceGroupManagersListInstancesResponse.php +++ b/Compute/src/V1/RegionInstanceGroupManagersListInstancesResponse.php @@ -25,7 +25,7 @@ class RegionInstanceGroupManagersListInstancesResponse extends \Google\Protobuf\ * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * Constructor. diff --git a/Compute/src/V1/RegionInstanceGroupManagersSetTargetPoolsRequest.php b/Compute/src/V1/RegionInstanceGroupManagersSetTargetPoolsRequest.php index 0821cd162f66..ab169af46cd0 100644 --- a/Compute/src/V1/RegionInstanceGroupManagersSetTargetPoolsRequest.php +++ b/Compute/src/V1/RegionInstanceGroupManagersSetTargetPoolsRequest.php @@ -19,7 +19,7 @@ class RegionInstanceGroupManagersSetTargetPoolsRequest extends \Google\Protobuf\ * * Generated from protobuf field optional string fingerprint = 234678500; */ - private $fingerprint = null; + protected $fingerprint = null; /** * The URL of all TargetPool resources to which instances in the instanceGroup field are added. The target pools automatically apply to all of the instances in the managed instance group. * diff --git a/Compute/src/V1/RegionInstanceGroupManagersSetTemplateRequest.php b/Compute/src/V1/RegionInstanceGroupManagersSetTemplateRequest.php index daece00799be..814b33e4649f 100644 --- a/Compute/src/V1/RegionInstanceGroupManagersSetTemplateRequest.php +++ b/Compute/src/V1/RegionInstanceGroupManagersSetTemplateRequest.php @@ -19,7 +19,7 @@ class RegionInstanceGroupManagersSetTemplateRequest extends \Google\Protobuf\Int * * Generated from protobuf field optional string instance_template = 309248228; */ - private $instance_template = null; + protected $instance_template = null; /** * Constructor. diff --git a/Compute/src/V1/RegionInstanceGroupManagersStopInstancesRequest.php b/Compute/src/V1/RegionInstanceGroupManagersStopInstancesRequest.php index 58de31601444..080161f5260e 100644 --- a/Compute/src/V1/RegionInstanceGroupManagersStopInstancesRequest.php +++ b/Compute/src/V1/RegionInstanceGroupManagersStopInstancesRequest.php @@ -19,7 +19,7 @@ class RegionInstanceGroupManagersStopInstancesRequest extends \Google\Protobuf\I * * Generated from protobuf field optional bool force_stop = 134762710; */ - private $force_stop = null; + protected $force_stop = null; /** * The URLs of one or more instances to stop. This can be a full URL or a partial URL, such as zones/[ZONE]/instances/[INSTANCE_NAME]. * diff --git a/Compute/src/V1/RegionInstanceGroupManagersSuspendInstancesRequest.php b/Compute/src/V1/RegionInstanceGroupManagersSuspendInstancesRequest.php index 0b9f6e61043c..0d18c2261d06 100644 --- a/Compute/src/V1/RegionInstanceGroupManagersSuspendInstancesRequest.php +++ b/Compute/src/V1/RegionInstanceGroupManagersSuspendInstancesRequest.php @@ -19,7 +19,7 @@ class RegionInstanceGroupManagersSuspendInstancesRequest extends \Google\Protobu * * Generated from protobuf field optional bool force_suspend = 27637480; */ - private $force_suspend = null; + protected $force_suspend = null; /** * The URLs of one or more instances to suspend. This can be a full URL or a partial URL, such as zones/[ZONE]/instances/[INSTANCE_NAME]. * diff --git a/Compute/src/V1/RegionInstanceGroupsClient.php b/Compute/src/V1/RegionInstanceGroupsClient.php deleted file mode 100644 index 66dd7e111a99..000000000000 --- a/Compute/src/V1/RegionInstanceGroupsClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of InstanceWithNamedPorts resources. * @@ -31,25 +31,25 @@ class RegionInstanceGroupsListInstances extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/RegionInstanceGroupsListInstancesRequest.php b/Compute/src/V1/RegionInstanceGroupsListInstancesRequest.php index 0ec39218f497..9ccc34502461 100644 --- a/Compute/src/V1/RegionInstanceGroupsListInstancesRequest.php +++ b/Compute/src/V1/RegionInstanceGroupsListInstancesRequest.php @@ -20,13 +20,13 @@ class RegionInstanceGroupsListInstancesRequest extends \Google\Protobuf\Internal * * Generated from protobuf field optional string instance_state = 92223591; */ - private $instance_state = null; + protected $instance_state = null; /** * Name of port user is interested in. It is optional. If it is set, only information about this ports will be returned. If it is not set, all the named ports will be returned. Always lists all instances. * * Generated from protobuf field optional string port_name = 41534345; */ - private $port_name = null; + protected $port_name = null; /** * Constructor. diff --git a/Compute/src/V1/RegionInstanceGroupsSetNamedPortsRequest.php b/Compute/src/V1/RegionInstanceGroupsSetNamedPortsRequest.php index bcbcdcfeaff7..6bcf0fabd915 100644 --- a/Compute/src/V1/RegionInstanceGroupsSetNamedPortsRequest.php +++ b/Compute/src/V1/RegionInstanceGroupsSetNamedPortsRequest.php @@ -19,7 +19,7 @@ class RegionInstanceGroupsSetNamedPortsRequest extends \Google\Protobuf\Internal * * Generated from protobuf field optional string fingerprint = 234678500; */ - private $fingerprint = null; + protected $fingerprint = null; /** * The list of named ports to set for this instance group. * diff --git a/Compute/src/V1/RegionInstanceTemplatesClient.php b/Compute/src/V1/RegionInstanceTemplatesClient.php deleted file mode 100644 index 0b764b0a0847..000000000000 --- a/Compute/src/V1/RegionInstanceTemplatesClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of Region resources. * @@ -32,25 +32,25 @@ class RegionList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/RegionNetworkEndpointGroupsClient.php b/Compute/src/V1/RegionNetworkEndpointGroupsClient.php deleted file mode 100644 index f4e8973a0a44..000000000000 --- a/Compute/src/V1/RegionNetworkEndpointGroupsClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional string display_name = 4473832; */ - private $display_name = null; + protected $display_name = null; /** * [Output Only] The name of the firewall policy. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * [Output only] The packet mirroring rules that apply to the network. * @@ -37,7 +37,7 @@ class RegionNetworkFirewallPoliciesGetEffectiveFirewallsResponseEffectiveFirewal * * Generated from protobuf field optional int32 priority = 445151652; */ - private $priority = null; + protected $priority = null; /** * [Output only] The rules that apply to the network. * @@ -50,7 +50,7 @@ class RegionNetworkFirewallPoliciesGetEffectiveFirewallsResponseEffectiveFirewal * * Generated from protobuf field optional string type = 3575610; */ - private $type = null; + protected $type = null; /** * Constructor. diff --git a/Compute/src/V1/RegionNotificationEndpointsClient.php b/Compute/src/V1/RegionNotificationEndpointsClient.php deleted file mode 100644 index d44530511faa..000000000000 --- a/Compute/src/V1/RegionNotificationEndpointsClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional string label_fingerprint = 178124825; */ - private $label_fingerprint = null; + protected $label_fingerprint = null; /** * The labels to set for this resource. * diff --git a/Compute/src/V1/RegionSetPolicyRequest.php b/Compute/src/V1/RegionSetPolicyRequest.php index 4b725b536205..e94a987b507d 100644 --- a/Compute/src/V1/RegionSetPolicyRequest.php +++ b/Compute/src/V1/RegionSetPolicyRequest.php @@ -25,13 +25,13 @@ class RegionSetPolicyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string etag = 3123477; */ - private $etag = null; + protected $etag = null; /** * 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 in general a valid policy but certain services (like Projects) might reject them. * * Generated from protobuf field optional .google.cloud.compute.v1.Policy policy = 91071794; */ - private $policy = null; + protected $policy = null; /** * Constructor. diff --git a/Compute/src/V1/RegionSslCertificatesClient.php b/Compute/src/V1/RegionSslCertificatesClient.php deleted file mode 100644 index d92bb27c4812..000000000000 --- a/Compute/src/V1/RegionSslCertificatesClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional .google.cloud.compute.v1.UrlMap resource = 195806222; */ - private $resource = null; + protected $resource = null; /** * Constructor. diff --git a/Compute/src/V1/RegionZonesClient.php b/Compute/src/V1/RegionZonesClient.php deleted file mode 100644 index 1adb95411910..000000000000 --- a/Compute/src/V1/RegionZonesClient.php +++ /dev/null @@ -1,34 +0,0 @@ -string firewall_policy = 498173265 [(.google.api.field_behavior) = REQUIRED]; */ - private $firewall_policy = ''; + protected $firewall_policy = ''; /** * Name for the attachment that will be removed. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $firewallPolicy Name of the firewall policy to update. diff --git a/Compute/src/V1/RemoveAssociationNetworkFirewallPolicyRequest.php b/Compute/src/V1/RemoveAssociationNetworkFirewallPolicyRequest.php index f79810cb3f09..fdc0ca3fbaac 100644 --- a/Compute/src/V1/RemoveAssociationNetworkFirewallPolicyRequest.php +++ b/Compute/src/V1/RemoveAssociationNetworkFirewallPolicyRequest.php @@ -20,25 +20,25 @@ class RemoveAssociationNetworkFirewallPolicyRequest extends \Google\Protobuf\Int * * Generated from protobuf field string firewall_policy = 498173265 [(.google.api.field_behavior) = REQUIRED]; */ - private $firewall_policy = ''; + protected $firewall_policy = ''; /** * Name for the attachment that will be removed. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/RemoveAssociationRegionNetworkFirewallPolicyRequest.php b/Compute/src/V1/RemoveAssociationRegionNetworkFirewallPolicyRequest.php index 84472d0a21a8..79c3e3d27bd1 100644 --- a/Compute/src/V1/RemoveAssociationRegionNetworkFirewallPolicyRequest.php +++ b/Compute/src/V1/RemoveAssociationRegionNetworkFirewallPolicyRequest.php @@ -20,31 +20,31 @@ class RemoveAssociationRegionNetworkFirewallPolicyRequest extends \Google\Protob * * Generated from protobuf field string firewall_policy = 498173265 [(.google.api.field_behavior) = REQUIRED]; */ - private $firewall_policy = ''; + protected $firewall_policy = ''; /** * Name for the association that will be removed. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/RemoveHealthCheckTargetPoolRequest.php b/Compute/src/V1/RemoveHealthCheckTargetPoolRequest.php index c9cbe1dad468..7a7643ddd26f 100644 --- a/Compute/src/V1/RemoveHealthCheckTargetPoolRequest.php +++ b/Compute/src/V1/RemoveHealthCheckTargetPoolRequest.php @@ -20,31 +20,31 @@ class RemoveHealthCheckTargetPoolRequest extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name of the target pool to remove health checks from. * * Generated from protobuf field string target_pool = 62796298 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_pool = ''; + protected $target_pool = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.TargetPoolsRemoveHealthCheckRequest target_pools_remove_health_check_request_resource = 304985011 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_pools_remove_health_check_request_resource = null; + protected $target_pools_remove_health_check_request_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/RemoveInstanceTargetPoolRequest.php b/Compute/src/V1/RemoveInstanceTargetPoolRequest.php index ce655f50107e..6cbe66e2cf0b 100644 --- a/Compute/src/V1/RemoveInstanceTargetPoolRequest.php +++ b/Compute/src/V1/RemoveInstanceTargetPoolRequest.php @@ -20,31 +20,31 @@ class RemoveInstanceTargetPoolRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name of the TargetPool resource to remove instances from. * * Generated from protobuf field string target_pool = 62796298 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_pool = ''; + protected $target_pool = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.TargetPoolsRemoveInstanceRequest target_pools_remove_instance_request_resource = 29548547 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_pools_remove_instance_request_resource = null; + protected $target_pools_remove_instance_request_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/RemoveInstancesInstanceGroupRequest.php b/Compute/src/V1/RemoveInstancesInstanceGroupRequest.php index 9fdd8ef0df74..6ee2acd66154 100644 --- a/Compute/src/V1/RemoveInstancesInstanceGroupRequest.php +++ b/Compute/src/V1/RemoveInstancesInstanceGroupRequest.php @@ -20,31 +20,31 @@ class RemoveInstancesInstanceGroupRequest extends \Google\Protobuf\Internal\Mess * * Generated from protobuf field string instance_group = 81095253 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group = ''; + protected $instance_group = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.InstanceGroupsRemoveInstancesRequest instance_groups_remove_instances_request_resource = 390981817 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_groups_remove_instances_request_resource = null; + protected $instance_groups_remove_instances_request_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone where the instance group is located. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/RemovePacketMirroringRuleNetworkFirewallPolicyRequest.php b/Compute/src/V1/RemovePacketMirroringRuleNetworkFirewallPolicyRequest.php index 699ac6a98993..c9dc860e1f0d 100644 --- a/Compute/src/V1/RemovePacketMirroringRuleNetworkFirewallPolicyRequest.php +++ b/Compute/src/V1/RemovePacketMirroringRuleNetworkFirewallPolicyRequest.php @@ -20,25 +20,25 @@ class RemovePacketMirroringRuleNetworkFirewallPolicyRequest extends \Google\Prot * * Generated from protobuf field string firewall_policy = 498173265 [(.google.api.field_behavior) = REQUIRED]; */ - private $firewall_policy = ''; + protected $firewall_policy = ''; /** * The priority of the rule to remove from the firewall policy. * * Generated from protobuf field optional int32 priority = 445151652; */ - private $priority = null; + protected $priority = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/RemovePeeringNetworkRequest.php b/Compute/src/V1/RemovePeeringNetworkRequest.php index 215c664889b2..9006c03e0405 100644 --- a/Compute/src/V1/RemovePeeringNetworkRequest.php +++ b/Compute/src/V1/RemovePeeringNetworkRequest.php @@ -20,25 +20,25 @@ class RemovePeeringNetworkRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string network = 232872494 [(.google.api.field_behavior) = REQUIRED]; */ - private $network = ''; + protected $network = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.NetworksRemovePeeringRequest networks_remove_peering_request_resource = 421162494 [(.google.api.field_behavior) = REQUIRED]; */ - private $networks_remove_peering_request_resource = null; + protected $networks_remove_peering_request_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/RemoveResourcePoliciesDiskRequest.php b/Compute/src/V1/RemoveResourcePoliciesDiskRequest.php index 8c2612311aae..af2f38f54426 100644 --- a/Compute/src/V1/RemoveResourcePoliciesDiskRequest.php +++ b/Compute/src/V1/RemoveResourcePoliciesDiskRequest.php @@ -20,31 +20,31 @@ class RemoveResourcePoliciesDiskRequest extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field string disk = 3083677 [(.google.api.field_behavior) = REQUIRED]; */ - private $disk = ''; + protected $disk = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.DisksRemoveResourcePoliciesRequest disks_remove_resource_policies_request_resource = 436756718 [(.google.api.field_behavior) = REQUIRED]; */ - private $disks_remove_resource_policies_request_resource = null; + protected $disks_remove_resource_policies_request_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/RemoveResourcePoliciesInstanceRequest.php b/Compute/src/V1/RemoveResourcePoliciesInstanceRequest.php index 9ddfe3bf3f03..ac89343c48d5 100644 --- a/Compute/src/V1/RemoveResourcePoliciesInstanceRequest.php +++ b/Compute/src/V1/RemoveResourcePoliciesInstanceRequest.php @@ -20,31 +20,31 @@ class RemoveResourcePoliciesInstanceRequest extends \Google\Protobuf\Internal\Me * * Generated from protobuf field string instance = 18257045 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance = ''; + protected $instance = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.InstancesRemoveResourcePoliciesRequest instances_remove_resource_policies_request_resource = 49229558 [(.google.api.field_behavior) = REQUIRED]; */ - private $instances_remove_resource_policies_request_resource = null; + protected $instances_remove_resource_policies_request_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/RemoveResourcePoliciesRegionDiskRequest.php b/Compute/src/V1/RemoveResourcePoliciesRegionDiskRequest.php index 290c385a3fde..35d27067d021 100644 --- a/Compute/src/V1/RemoveResourcePoliciesRegionDiskRequest.php +++ b/Compute/src/V1/RemoveResourcePoliciesRegionDiskRequest.php @@ -20,31 +20,31 @@ class RemoveResourcePoliciesRegionDiskRequest extends \Google\Protobuf\Internal\ * * Generated from protobuf field string disk = 3083677 [(.google.api.field_behavior) = REQUIRED]; */ - private $disk = ''; + protected $disk = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * The name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.RegionDisksRemoveResourcePoliciesRequest region_disks_remove_resource_policies_request_resource = 8741283 [(.google.api.field_behavior) = REQUIRED]; */ - private $region_disks_remove_resource_policies_request_resource = null; + protected $region_disks_remove_resource_policies_request_resource = null; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/RemoveRuleFirewallPolicyRequest.php b/Compute/src/V1/RemoveRuleFirewallPolicyRequest.php index 182c9f042832..608dec586b82 100644 --- a/Compute/src/V1/RemoveRuleFirewallPolicyRequest.php +++ b/Compute/src/V1/RemoveRuleFirewallPolicyRequest.php @@ -20,19 +20,19 @@ class RemoveRuleFirewallPolicyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string firewall_policy = 498173265 [(.google.api.field_behavior) = REQUIRED]; */ - private $firewall_policy = ''; + protected $firewall_policy = ''; /** * The priority of the rule to remove from the firewall policy. * * Generated from protobuf field optional int32 priority = 445151652; */ - private $priority = null; + protected $priority = null; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $firewallPolicy Name of the firewall policy to update. diff --git a/Compute/src/V1/RemoveRuleNetworkFirewallPolicyRequest.php b/Compute/src/V1/RemoveRuleNetworkFirewallPolicyRequest.php index a9d480e691d1..e6e2ad879431 100644 --- a/Compute/src/V1/RemoveRuleNetworkFirewallPolicyRequest.php +++ b/Compute/src/V1/RemoveRuleNetworkFirewallPolicyRequest.php @@ -20,25 +20,25 @@ class RemoveRuleNetworkFirewallPolicyRequest extends \Google\Protobuf\Internal\M * * Generated from protobuf field string firewall_policy = 498173265 [(.google.api.field_behavior) = REQUIRED]; */ - private $firewall_policy = ''; + protected $firewall_policy = ''; /** * The priority of the rule to remove from the firewall policy. * * Generated from protobuf field optional int32 priority = 445151652; */ - private $priority = null; + protected $priority = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/RemoveRuleRegionNetworkFirewallPolicyRequest.php b/Compute/src/V1/RemoveRuleRegionNetworkFirewallPolicyRequest.php index 6c5bf8df5a62..7a998a24ccd1 100644 --- a/Compute/src/V1/RemoveRuleRegionNetworkFirewallPolicyRequest.php +++ b/Compute/src/V1/RemoveRuleRegionNetworkFirewallPolicyRequest.php @@ -20,31 +20,31 @@ class RemoveRuleRegionNetworkFirewallPolicyRequest extends \Google\Protobuf\Inte * * Generated from protobuf field string firewall_policy = 498173265 [(.google.api.field_behavior) = REQUIRED]; */ - private $firewall_policy = ''; + protected $firewall_policy = ''; /** * The priority of the rule to remove from the firewall policy. * * Generated from protobuf field optional int32 priority = 445151652; */ - private $priority = null; + protected $priority = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/RemoveRuleRegionSecurityPolicyRequest.php b/Compute/src/V1/RemoveRuleRegionSecurityPolicyRequest.php index ee11ab727aef..f800fd967994 100644 --- a/Compute/src/V1/RemoveRuleRegionSecurityPolicyRequest.php +++ b/Compute/src/V1/RemoveRuleRegionSecurityPolicyRequest.php @@ -20,25 +20,25 @@ class RemoveRuleRegionSecurityPolicyRequest extends \Google\Protobuf\Internal\Me * * Generated from protobuf field optional int32 priority = 445151652; */ - private $priority = null; + protected $priority = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * Name of the security policy to update. * * Generated from protobuf field string security_policy = 171082513 [(.google.api.field_behavior) = REQUIRED]; */ - private $security_policy = ''; + protected $security_policy = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/RemoveRuleSecurityPolicyRequest.php b/Compute/src/V1/RemoveRuleSecurityPolicyRequest.php index 4ca7523fd8d2..8922e0e0a93c 100644 --- a/Compute/src/V1/RemoveRuleSecurityPolicyRequest.php +++ b/Compute/src/V1/RemoveRuleSecurityPolicyRequest.php @@ -20,19 +20,19 @@ class RemoveRuleSecurityPolicyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int32 priority = 445151652; */ - private $priority = null; + protected $priority = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the security policy to update. * * Generated from protobuf field string security_policy = 171082513 [(.google.api.field_behavior) = REQUIRED]; */ - private $security_policy = ''; + protected $security_policy = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ReportHostAsFaultyInstanceRequest.php b/Compute/src/V1/ReportHostAsFaultyInstanceRequest.php index 22b897c882c8..500a9f4c33da 100644 --- a/Compute/src/V1/ReportHostAsFaultyInstanceRequest.php +++ b/Compute/src/V1/ReportHostAsFaultyInstanceRequest.php @@ -20,31 +20,31 @@ class ReportHostAsFaultyInstanceRequest extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field string instance = 18257045 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance = ''; + protected $instance = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.InstancesReportHostAsFaultyRequest instances_report_host_as_faulty_request_resource = 494094886 [(.google.api.field_behavior) = REQUIRED]; */ - private $instances_report_host_as_faulty_request_resource = null; + protected $instances_report_host_as_faulty_request_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/RequestMirrorPolicy.php b/Compute/src/V1/RequestMirrorPolicy.php index e1548502c202..edc422264709 100644 --- a/Compute/src/V1/RequestMirrorPolicy.php +++ b/Compute/src/V1/RequestMirrorPolicy.php @@ -20,7 +20,7 @@ class RequestMirrorPolicy extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string backend_service = 306946058; */ - private $backend_service = null; + protected $backend_service = null; /** * Constructor. diff --git a/Compute/src/V1/RequestRemovePeeringNetworkRequest.php b/Compute/src/V1/RequestRemovePeeringNetworkRequest.php index fcb675763714..5bba04bc5b84 100644 --- a/Compute/src/V1/RequestRemovePeeringNetworkRequest.php +++ b/Compute/src/V1/RequestRemovePeeringNetworkRequest.php @@ -20,25 +20,25 @@ class RequestRemovePeeringNetworkRequest extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field string network = 232872494 [(.google.api.field_behavior) = REQUIRED]; */ - private $network = ''; + protected $network = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.NetworksRequestRemovePeeringRequest networks_request_remove_peering_request_resource = 150860366 [(.google.api.field_behavior) = REQUIRED]; */ - private $networks_request_remove_peering_request_resource = null; + protected $networks_request_remove_peering_request_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/Reservation.php b/Compute/src/V1/Reservation.php index 9be5a17069af..83664d8c3078 100644 --- a/Compute/src/V1/Reservation.php +++ b/Compute/src/V1/Reservation.php @@ -20,68 +20,68 @@ class Reservation extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.ReservationAdvancedDeploymentControl advanced_deployment_control = 410618144; */ - private $advanced_deployment_control = null; + protected $advanced_deployment_control = null; /** * Reservation for aggregated resources, providing shape flexibility. * * Generated from protobuf field optional .google.cloud.compute.v1.AllocationAggregateReservation aggregate_reservation = 291567948; */ - private $aggregate_reservation = null; + protected $aggregate_reservation = null; /** * [Output Only] Full or partial URL to a parent commitment. This field displays for reservations that are tied to a commitment. * * Generated from protobuf field optional string commitment = 482134805; */ - private $commitment = null; + protected $commitment = null; /** * [Output Only] Creation timestamp in RFC3339 text format. * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * Duration time relative to reservation creation when Compute Engine will automatically delete this resource. * * Generated from protobuf field optional .google.cloud.compute.v1.Duration delete_after_duration = 323997099; */ - private $delete_after_duration = null; + protected $delete_after_duration = null; /** * Absolute time in future when the reservation will be auto-deleted by Compute Engine. Timestamp is represented in RFC3339 text format. * * Generated from protobuf field optional string delete_at_time = 83294405; */ - private $delete_at_time = null; + protected $delete_at_time = null; /** * Specifies the deployment strategy for this reservation. * Check the DeploymentType enum for the list of possible values. * * Generated from protobuf field optional string deployment_type = 396722292; */ - private $deployment_type = null; + protected $deployment_type = null; /** * An optional description of this resource. Provide this property when you create the resource. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * Indicates whether Compute Engine allows unplanned maintenance for your VMs; for example, to fix hardware errors. * * Generated from protobuf field optional bool enable_emergent_maintenance = 353759497; */ - private $enable_emergent_maintenance = null; + protected $enable_emergent_maintenance = null; /** * [Output Only] The unique identifier for the resource. This identifier is defined by the server. * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * [Output Only] Type of the resource. Always compute#reservations for reservations. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] Full or partial URL to parent commitments. This field displays for reservations that are tied to multiple commitments. * @@ -93,13 +93,13 @@ class Reservation extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * Specify the reservation sharing policy. If unspecified, the reservation will not be shared with Google Cloud managed services. * * Generated from protobuf field optional .google.cloud.compute.v1.AllocationReservationSharingPolicy reservation_sharing_policy = 205970120; */ - private $reservation_sharing_policy = null; + protected $reservation_sharing_policy = null; /** * Resource policies to be added to this reservation. The key is defined by user, and the value is resource policy url. This is to define placement policy with reservation. * @@ -111,57 +111,57 @@ class Reservation extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.AllocationResourceStatus resource_status = 249429315; */ - private $resource_status = null; + protected $resource_status = null; /** * [Output Only] Reserved for future use. * * Generated from protobuf field optional bool satisfies_pzs = 480964267; */ - private $satisfies_pzs = null; + protected $satisfies_pzs = null; /** * The type of maintenance for the reservation. * Check the SchedulingType enum for the list of possible values. * * Generated from protobuf field optional string scheduling_type = 199835397; */ - private $scheduling_type = null; + protected $scheduling_type = null; /** * [Output Only] Server-defined fully-qualified URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * Specify share-settings to create a shared reservation. This property is optional. For more information about the syntax and options for this field and its subfields, see the guide for creating a shared reservation. * * Generated from protobuf field optional .google.cloud.compute.v1.ShareSettings share_settings = 266668163; */ - private $share_settings = null; + protected $share_settings = null; /** * Reservation for instances with specific machine shapes. * * Generated from protobuf field optional .google.cloud.compute.v1.AllocationSpecificSKUReservation specific_reservation = 404901951; */ - private $specific_reservation = null; + protected $specific_reservation = null; /** * Indicates whether the reservation can be consumed by VMs with affinity for "any" reservation. If the field is set, then only VMs that target the reservation by name can consume from this reservation. * * Generated from protobuf field optional bool specific_reservation_required = 226550687; */ - private $specific_reservation_required = null; + protected $specific_reservation_required = null; /** * [Output Only] The status of the reservation. - CREATING: Reservation resources are being allocated. - READY: Reservation resources have been allocated, and the reservation is ready for use. - DELETING: Reservation deletion is in progress. - UPDATING: Reservation update is in progress. * Check the Status enum for the list of possible values. * * Generated from protobuf field optional string status = 181260274; */ - private $status = null; + protected $status = null; /** * Zone in which the reservation resides. A zone must be provided if the reservation is created within a commitment. * * Generated from protobuf field optional string zone = 3744684; */ - private $zone = null; + protected $zone = null; /** * Constructor. diff --git a/Compute/src/V1/ReservationAdvancedDeploymentControl.php b/Compute/src/V1/ReservationAdvancedDeploymentControl.php index fecef826855f..28217efd482e 100644 --- a/Compute/src/V1/ReservationAdvancedDeploymentControl.php +++ b/Compute/src/V1/ReservationAdvancedDeploymentControl.php @@ -21,7 +21,7 @@ class ReservationAdvancedDeploymentControl extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field optional string reservation_operational_mode = 499978755; */ - private $reservation_operational_mode = null; + protected $reservation_operational_mode = null; /** * Constructor. diff --git a/Compute/src/V1/ReservationAffinity.php b/Compute/src/V1/ReservationAffinity.php index c986ac7911b6..0a525929069e 100644 --- a/Compute/src/V1/ReservationAffinity.php +++ b/Compute/src/V1/ReservationAffinity.php @@ -21,13 +21,13 @@ class ReservationAffinity extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string consume_reservation_type = 300736944; */ - private $consume_reservation_type = null; + protected $consume_reservation_type = null; /** * Corresponds to the label key of a reservation resource. To target a SPECIFIC_RESERVATION by name, specify googleapis.com/reservation-name as the key and specify the name of your reservation as its value. * * Generated from protobuf field optional string key = 106079; */ - private $key = null; + protected $key = null; /** * Corresponds to the label values of a reservation resource. This can be either a name to a reservation in the same project or "projects/different-project/reservations/some-reservation-name" to target a shared reservation in the same zone but in a different project. * diff --git a/Compute/src/V1/ReservationAggregatedList.php b/Compute/src/V1/ReservationAggregatedList.php index 5213208bff3c..aa0b65ccb707 100644 --- a/Compute/src/V1/ReservationAggregatedList.php +++ b/Compute/src/V1/ReservationAggregatedList.php @@ -20,7 +20,7 @@ class ReservationAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of Allocation resources. * @@ -32,19 +32,19 @@ class ReservationAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Unreachable resources. * @@ -56,7 +56,7 @@ class ReservationAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/ReservationBlock.php b/Compute/src/V1/ReservationBlock.php index 484d81d93634..0eff24a589a8 100644 --- a/Compute/src/V1/ReservationBlock.php +++ b/Compute/src/V1/ReservationBlock.php @@ -20,92 +20,92 @@ class ReservationBlock extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int32 count = 94851343; */ - private $count = null; + protected $count = null; /** * [Output Only] Creation timestamp in RFC3339 text format. * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * [Output Only] Health information for the reservation block. * * Generated from protobuf field optional .google.cloud.compute.v1.ReservationBlockHealthInfo health_info = 235287729; */ - private $health_info = null; + protected $health_info = null; /** * [Output Only] The unique identifier for the resource. This identifier is defined by the server. * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * [Output Only] The number of instances that are currently in use on this reservation block. * * Generated from protobuf field optional int32 in_use_count = 493458877; */ - private $in_use_count = null; + protected $in_use_count = null; /** * [Output Only] Type of the resource. Always compute#reservationBlock for reservation blocks. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] The name of this reservation block generated by Google Compute Engine. The name must be 1-63 characters long, and comply with RFC1035 @pattern [a-z](?:[-a-z0-9]{0,61}[a-z0-9])? * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * [Output Only] The physical topology of the reservation block. * * Generated from protobuf field optional .google.cloud.compute.v1.ReservationBlockPhysicalTopology physical_topology = 279778519; */ - private $physical_topology = null; + protected $physical_topology = null; /** * [Output Only] Maintenance information for this reservation block. * * Generated from protobuf field optional .google.cloud.compute.v1.GroupMaintenanceInfo reservation_maintenance = 340607776; */ - private $reservation_maintenance = null; + protected $reservation_maintenance = null; /** * [Output Only] The number of reservation subBlocks associated with this reservation block. * * Generated from protobuf field optional int32 reservation_sub_block_count = 330782955; */ - private $reservation_sub_block_count = null; + protected $reservation_sub_block_count = null; /** * [Output Only] The number of in-use reservation subBlocks associated with this reservation block. If at least one VM is running on a subBlock, it is considered in-use. * * Generated from protobuf field optional int32 reservation_sub_block_in_use_count = 186007137; */ - private $reservation_sub_block_in_use_count = null; + protected $reservation_sub_block_in_use_count = null; /** * [Output Only] Server-defined fully-qualified URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Server-defined URL for this resource with the resource id. * * Generated from protobuf field optional string self_link_with_id = 44520962; */ - private $self_link_with_id = null; + protected $self_link_with_id = null; /** * [Output Only] Status of the reservation block. * Check the Status enum for the list of possible values. * * Generated from protobuf field optional string status = 181260274; */ - private $status = null; + protected $status = null; /** * [Output Only] Zone in which the reservation block resides. * * Generated from protobuf field optional string zone = 3744684; */ - private $zone = null; + protected $zone = null; /** * Constructor. diff --git a/Compute/src/V1/ReservationBlockHealthInfo.php b/Compute/src/V1/ReservationBlockHealthInfo.php index 65f2838147b3..cd41f529754b 100644 --- a/Compute/src/V1/ReservationBlockHealthInfo.php +++ b/Compute/src/V1/ReservationBlockHealthInfo.php @@ -20,20 +20,20 @@ class ReservationBlockHealthInfo extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int32 degraded_sub_block_count = 458044493; */ - private $degraded_sub_block_count = null; + protected $degraded_sub_block_count = null; /** * The health status of the reservation block. * Check the HealthStatus enum for the list of possible values. * * Generated from protobuf field optional string health_status = 380545845; */ - private $health_status = null; + protected $health_status = null; /** * The number of subBlocks that are healthy. * * Generated from protobuf field optional int32 healthy_sub_block_count = 5348540; */ - private $healthy_sub_block_count = null; + protected $healthy_sub_block_count = null; /** * Constructor. diff --git a/Compute/src/V1/ReservationBlockPhysicalTopology.php b/Compute/src/V1/ReservationBlockPhysicalTopology.php index b866c074f8f7..64328d55bf56 100644 --- a/Compute/src/V1/ReservationBlockPhysicalTopology.php +++ b/Compute/src/V1/ReservationBlockPhysicalTopology.php @@ -19,13 +19,13 @@ class ReservationBlockPhysicalTopology extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string block = 93832333; */ - private $block = null; + protected $block = null; /** * The cluster name of the reservation block. * * Generated from protobuf field optional string cluster = 335221242; */ - private $cluster = null; + protected $cluster = null; /** * The detailed instances information for a given Block * diff --git a/Compute/src/V1/ReservationBlockPhysicalTopologyInstance.php b/Compute/src/V1/ReservationBlockPhysicalTopologyInstance.php index 149b5ba5556e..0b0495fa2c23 100644 --- a/Compute/src/V1/ReservationBlockPhysicalTopologyInstance.php +++ b/Compute/src/V1/ReservationBlockPhysicalTopologyInstance.php @@ -20,19 +20,19 @@ class ReservationBlockPhysicalTopologyInstance extends \Google\Protobuf\Internal * * Generated from protobuf field optional uint64 instance_id = 45488389; */ - private $instance_id = null; + protected $instance_id = null; /** * The PhysicalHostTopology of instances within a Block resource. * * Generated from protobuf field optional .google.cloud.compute.v1.ReservationBlockPhysicalTopologyInstancePhysicalHostTopology physical_host_topology = 390842814; */ - private $physical_host_topology = null; + protected $physical_host_topology = null; /** * Project where the instance lives * * Generated from protobuf field optional uint64 project_id = 177513473; */ - private $project_id = null; + protected $project_id = null; /** * Constructor. diff --git a/Compute/src/V1/ReservationBlockPhysicalTopologyInstancePhysicalHostTopology.php b/Compute/src/V1/ReservationBlockPhysicalTopologyInstancePhysicalHostTopology.php index 59143f6dc7bd..eb89e4a9f914 100644 --- a/Compute/src/V1/ReservationBlockPhysicalTopologyInstancePhysicalHostTopology.php +++ b/Compute/src/V1/ReservationBlockPhysicalTopologyInstancePhysicalHostTopology.php @@ -20,13 +20,13 @@ class ReservationBlockPhysicalTopologyInstancePhysicalHostTopology extends \Goog * * Generated from protobuf field optional string host = 3208616; */ - private $host = null; + protected $host = null; /** * Sub block hash for a given instance * * Generated from protobuf field optional string sub_block = 478033358; */ - private $sub_block = null; + protected $sub_block = null; /** * Constructor. diff --git a/Compute/src/V1/ReservationBlocksClient.php b/Compute/src/V1/ReservationBlocksClient.php deleted file mode 100644 index 1e4b2048538d..000000000000 --- a/Compute/src/V1/ReservationBlocksClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional .google.cloud.compute.v1.ReservationBlock resource = 195806222; */ - private $resource = null; + protected $resource = null; /** * Constructor. diff --git a/Compute/src/V1/ReservationBlocksListResponse.php b/Compute/src/V1/ReservationBlocksListResponse.php index 488538daf071..691764f7544c 100644 --- a/Compute/src/V1/ReservationBlocksListResponse.php +++ b/Compute/src/V1/ReservationBlocksListResponse.php @@ -20,7 +20,7 @@ class ReservationBlocksListResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of reservation block resources. * @@ -32,25 +32,25 @@ class ReservationBlocksListResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/ReservationList.php b/Compute/src/V1/ReservationList.php index 0de337d1d58d..e7bb76bcb3d0 100644 --- a/Compute/src/V1/ReservationList.php +++ b/Compute/src/V1/ReservationList.php @@ -19,7 +19,7 @@ class ReservationList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * [Output Only] A list of Allocation resources. * @@ -31,25 +31,25 @@ class ReservationList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/ReservationSubBlock.php b/Compute/src/V1/ReservationSubBlock.php index 4316b4e825d3..e72d384bb0b5 100644 --- a/Compute/src/V1/ReservationSubBlock.php +++ b/Compute/src/V1/ReservationSubBlock.php @@ -20,80 +20,80 @@ class ReservationSubBlock extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int32 count = 94851343; */ - private $count = null; + protected $count = null; /** * [Output Only] Creation timestamp in RFC3339 text format. * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * [Output Only] Health information for the reservation subBlock. * * Generated from protobuf field optional .google.cloud.compute.v1.ReservationSubBlockHealthInfo health_info = 235287729; */ - private $health_info = null; + protected $health_info = null; /** * [Output Only] The unique identifier for the resource. This identifier is defined by the server. * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * [Output Only] The number of instances that are currently in use on this reservation subBlock. * * Generated from protobuf field optional int32 in_use_count = 493458877; */ - private $in_use_count = null; + protected $in_use_count = null; /** * [Output Only] Type of the resource. Always compute#reservationSubBlock for reservation subBlocks. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] The name of this reservation subBlock generated by Google Compute Engine. The name must be 1-63 characters long, and comply with RFC1035 @pattern [a-z](?:[-a-z0-9]{0,61}[a-z0-9])? * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * [Output Only] The physical topology of the reservation subBlock. * * Generated from protobuf field optional .google.cloud.compute.v1.ReservationSubBlockPhysicalTopology physical_topology = 279778519; */ - private $physical_topology = null; + protected $physical_topology = null; /** * Maintenance information for this reservation subBlock. * * Generated from protobuf field optional .google.cloud.compute.v1.GroupMaintenanceInfo reservation_sub_block_maintenance = 377005551; */ - private $reservation_sub_block_maintenance = null; + protected $reservation_sub_block_maintenance = null; /** * [Output Only] Server-defined fully-qualified URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Server-defined URL for this resource with the resource id. * * Generated from protobuf field optional string self_link_with_id = 44520962; */ - private $self_link_with_id = null; + protected $self_link_with_id = null; /** * [Output Only] Status of the reservation subBlock. * Check the Status enum for the list of possible values. * * Generated from protobuf field optional string status = 181260274; */ - private $status = null; + protected $status = null; /** * [Output Only] Zone in which the reservation subBlock resides. * * Generated from protobuf field optional string zone = 3744684; */ - private $zone = null; + protected $zone = null; /** * Constructor. diff --git a/Compute/src/V1/ReservationSubBlockHealthInfo.php b/Compute/src/V1/ReservationSubBlockHealthInfo.php index 4ed0ec599b9d..0b0930ab14a1 100644 --- a/Compute/src/V1/ReservationSubBlockHealthInfo.php +++ b/Compute/src/V1/ReservationSubBlockHealthInfo.php @@ -20,32 +20,32 @@ class ReservationSubBlockHealthInfo extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int32 degraded_host_count = 535025001; */ - private $degraded_host_count = null; + protected $degraded_host_count = null; /** * The number of degraded infrastructure (e.g NV link domain) in the reservation subblock. * * Generated from protobuf field optional int32 degraded_infra_count = 138638927; */ - private $degraded_infra_count = null; + protected $degraded_infra_count = null; /** * The health status of the reservation subBlock. * Check the HealthStatus enum for the list of possible values. * * Generated from protobuf field optional string health_status = 380545845; */ - private $health_status = null; + protected $health_status = null; /** * The number of healthy hosts in the reservation subBlock. * * Generated from protobuf field optional int32 healthy_host_count = 40739738; */ - private $healthy_host_count = null; + protected $healthy_host_count = null; /** * The number of healthy infrastructure (e.g NV link domain) in the reservation subblock. * * Generated from protobuf field optional int32 healthy_infra_count = 385052222; */ - private $healthy_infra_count = null; + protected $healthy_infra_count = null; /** * Constructor. diff --git a/Compute/src/V1/ReservationSubBlockPhysicalTopology.php b/Compute/src/V1/ReservationSubBlockPhysicalTopology.php index 41946f1e78ad..86146aab40fa 100644 --- a/Compute/src/V1/ReservationSubBlockPhysicalTopology.php +++ b/Compute/src/V1/ReservationSubBlockPhysicalTopology.php @@ -19,19 +19,19 @@ class ReservationSubBlockPhysicalTopology extends \Google\Protobuf\Internal\Mess * * Generated from protobuf field optional string block = 93832333; */ - private $block = null; + protected $block = null; /** * The cluster name of the reservation subBlock. * * Generated from protobuf field optional string cluster = 335221242; */ - private $cluster = null; + protected $cluster = null; /** * The hash of the capacity sub-block within the capacity block. * * Generated from protobuf field optional string sub_block = 478033358; */ - private $sub_block = null; + protected $sub_block = null; /** * Constructor. diff --git a/Compute/src/V1/ReservationSubBlocksClient.php b/Compute/src/V1/ReservationSubBlocksClient.php deleted file mode 100644 index 4c1477b31296..000000000000 --- a/Compute/src/V1/ReservationSubBlocksClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional .google.cloud.compute.v1.ReservationSubBlock resource = 195806222; */ - private $resource = null; + protected $resource = null; /** * Constructor. diff --git a/Compute/src/V1/ReservationSubBlocksListResponse.php b/Compute/src/V1/ReservationSubBlocksListResponse.php index ba37d1983316..3c59390aa63b 100644 --- a/Compute/src/V1/ReservationSubBlocksListResponse.php +++ b/Compute/src/V1/ReservationSubBlocksListResponse.php @@ -20,7 +20,7 @@ class ReservationSubBlocksListResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of reservation subBlock resources. * @@ -32,25 +32,25 @@ class ReservationSubBlocksListResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/ReservationsBlocksPerformMaintenanceRequest.php b/Compute/src/V1/ReservationsBlocksPerformMaintenanceRequest.php index 198b405bc7b5..3910e8b24c1f 100644 --- a/Compute/src/V1/ReservationsBlocksPerformMaintenanceRequest.php +++ b/Compute/src/V1/ReservationsBlocksPerformMaintenanceRequest.php @@ -20,7 +20,7 @@ class ReservationsBlocksPerformMaintenanceRequest extends \Google\Protobuf\Inter * * Generated from protobuf field optional string maintenance_scope = 140687912; */ - private $maintenance_scope = null; + protected $maintenance_scope = null; /** * Constructor. diff --git a/Compute/src/V1/ReservationsClient.php b/Compute/src/V1/ReservationsClient.php deleted file mode 100644 index b207dba1d5ac..000000000000 --- a/Compute/src/V1/ReservationsClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional string maintenance_scope = 140687912; */ - private $maintenance_scope = null; + protected $maintenance_scope = null; /** * Constructor. diff --git a/Compute/src/V1/ReservationsResizeRequest.php b/Compute/src/V1/ReservationsResizeRequest.php index b5b33dd53eb7..f84252697816 100644 --- a/Compute/src/V1/ReservationsResizeRequest.php +++ b/Compute/src/V1/ReservationsResizeRequest.php @@ -19,7 +19,7 @@ class ReservationsResizeRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int64 specific_sku_count = 13890720; */ - private $specific_sku_count = null; + protected $specific_sku_count = null; /** * Constructor. diff --git a/Compute/src/V1/ReservationsScopedList.php b/Compute/src/V1/ReservationsScopedList.php index 436ca7cfab6a..3ecfc5b7366e 100644 --- a/Compute/src/V1/ReservationsScopedList.php +++ b/Compute/src/V1/ReservationsScopedList.php @@ -25,7 +25,7 @@ class ReservationsScopedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/ResetInstanceRequest.php b/Compute/src/V1/ResetInstanceRequest.php index 26eb8df319eb..3f3656eea366 100644 --- a/Compute/src/V1/ResetInstanceRequest.php +++ b/Compute/src/V1/ResetInstanceRequest.php @@ -20,25 +20,25 @@ class ResetInstanceRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string instance = 18257045 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance = ''; + protected $instance = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ResizeDiskRequest.php b/Compute/src/V1/ResizeDiskRequest.php index fb3f8840970f..0eec8d34cc90 100644 --- a/Compute/src/V1/ResizeDiskRequest.php +++ b/Compute/src/V1/ResizeDiskRequest.php @@ -20,31 +20,31 @@ class ResizeDiskRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string disk = 3083677 [(.google.api.field_behavior) = REQUIRED]; */ - private $disk = ''; + protected $disk = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.DisksResizeRequest disks_resize_request_resource = 78307616 [(.google.api.field_behavior) = REQUIRED]; */ - private $disks_resize_request_resource = null; + protected $disks_resize_request_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ResizeInstanceGroupManagerRequest.php b/Compute/src/V1/ResizeInstanceGroupManagerRequest.php index 9ab3c503e7b0..8b7cf3db5873 100644 --- a/Compute/src/V1/ResizeInstanceGroupManagerRequest.php +++ b/Compute/src/V1/ResizeInstanceGroupManagerRequest.php @@ -20,31 +20,31 @@ class ResizeInstanceGroupManagerRequest extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field string instance_group_manager = 249363395 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group_manager = ''; + protected $instance_group_manager = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The number of running instances that the managed instance group should maintain at any given time. The group automatically adds or removes instances to maintain the number of instances specified by this parameter. * * Generated from protobuf field int32 size = 3530753 [(.google.api.field_behavior) = REQUIRED]; */ - private $size = 0; + protected $size = 0; /** * The name of the zone where the managed instance group is located. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ResizeRegionDiskRequest.php b/Compute/src/V1/ResizeRegionDiskRequest.php index c315fa82f6ab..e23e57614f51 100644 --- a/Compute/src/V1/ResizeRegionDiskRequest.php +++ b/Compute/src/V1/ResizeRegionDiskRequest.php @@ -20,31 +20,31 @@ class ResizeRegionDiskRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string disk = 3083677 [(.google.api.field_behavior) = REQUIRED]; */ - private $disk = ''; + protected $disk = ''; /** * The project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.RegionDisksResizeRequest region_disks_resize_request_resource = 446633237 [(.google.api.field_behavior) = REQUIRED]; */ - private $region_disks_resize_request_resource = null; + protected $region_disks_resize_request_resource = null; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project The project ID for this request. diff --git a/Compute/src/V1/ResizeRegionInstanceGroupManagerRequest.php b/Compute/src/V1/ResizeRegionInstanceGroupManagerRequest.php index 8b9e72c49289..e6567906116a 100644 --- a/Compute/src/V1/ResizeRegionInstanceGroupManagerRequest.php +++ b/Compute/src/V1/ResizeRegionInstanceGroupManagerRequest.php @@ -20,31 +20,31 @@ class ResizeRegionInstanceGroupManagerRequest extends \Google\Protobuf\Internal\ * * Generated from protobuf field string instance_group_manager = 249363395 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group_manager = ''; + protected $instance_group_manager = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Number of instances that should exist in this instance group manager. * * Generated from protobuf field int32 size = 3530753 [(.google.api.field_behavior) = REQUIRED]; */ - private $size = 0; + protected $size = 0; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ResizeReservationRequest.php b/Compute/src/V1/ResizeReservationRequest.php index 9cad3cd6fc27..eab76acb0c59 100644 --- a/Compute/src/V1/ResizeReservationRequest.php +++ b/Compute/src/V1/ResizeReservationRequest.php @@ -20,31 +20,31 @@ class ResizeReservationRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name of the reservation to update. * * Generated from protobuf field string reservation = 47530956 [(.google.api.field_behavior) = REQUIRED]; */ - private $reservation = ''; + protected $reservation = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.ReservationsResizeRequest reservations_resize_request_resource = 389262801 [(.google.api.field_behavior) = REQUIRED]; */ - private $reservations_resize_request_resource = null; + protected $reservations_resize_request_resource = null; /** * Name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ResourceCommitment.php b/Compute/src/V1/ResourceCommitment.php index 2730edfb1dda..3416a0ca45ec 100644 --- a/Compute/src/V1/ResourceCommitment.php +++ b/Compute/src/V1/ResourceCommitment.php @@ -20,20 +20,20 @@ class ResourceCommitment extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string accelerator_type = 138031246; */ - private $accelerator_type = null; + protected $accelerator_type = null; /** * The quantity of the hardware resource that you want to commit to purchasing (in a type-dependent unit). - For vCPUs, you must specify an integer value. - For memory, you specify the amount of MB that you want. The value you specify must be a multiple of 256 MB, with up to 6.5 GB of memory per every vCPU. - For GPUs, you must specify an integer value. - For Local SSD disks, you must specify the amount in GB. The size of a single Local SSD disk is 375 GB. * * Generated from protobuf field optional int64 amount = 196759640; */ - private $amount = null; + protected $amount = null; /** * The type of hardware resource that you want to specify. You can specify any of the following values: - VCPU - MEMORY - LOCAL_SSD - ACCELERATOR Specify as a separate entry in the list for each individual resource type. * Check the Type enum for the list of possible values. * * Generated from protobuf field optional string type = 3575610; */ - private $type = null; + protected $type = null; /** * Constructor. diff --git a/Compute/src/V1/ResourceGroupReference.php b/Compute/src/V1/ResourceGroupReference.php index 6a40e7faa688..d325aa351c9c 100644 --- a/Compute/src/V1/ResourceGroupReference.php +++ b/Compute/src/V1/ResourceGroupReference.php @@ -19,7 +19,7 @@ class ResourceGroupReference extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string group = 98629247; */ - private $group = null; + protected $group = null; /** * Constructor. diff --git a/Compute/src/V1/ResourcePoliciesClient.php b/Compute/src/V1/ResourcePoliciesClient.php deleted file mode 100644 index 81086ea684ca..000000000000 --- a/Compute/src/V1/ResourcePoliciesClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/ResourcePolicy.php b/Compute/src/V1/ResourcePolicy.php index a397735b2f07..185ab80efe1d 100644 --- a/Compute/src/V1/ResourcePolicy.php +++ b/Compute/src/V1/ResourcePolicy.php @@ -20,82 +20,82 @@ class ResourcePolicy extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * Resource policy for disk consistency groups. * * Generated from protobuf field optional .google.cloud.compute.v1.ResourcePolicyDiskConsistencyGroupPolicy disk_consistency_group_policy = 473727515; */ - private $disk_consistency_group_policy = null; + protected $disk_consistency_group_policy = null; /** * Resource policy for instances for placement configuration. * * Generated from protobuf field optional .google.cloud.compute.v1.ResourcePolicyGroupPlacementPolicy group_placement_policy = 10931596; */ - private $group_placement_policy = null; + protected $group_placement_policy = null; /** * [Output Only] The unique identifier for the resource. This identifier is defined by the server. * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * Resource policy for scheduling instance operations. * * Generated from protobuf field optional .google.cloud.compute.v1.ResourcePolicyInstanceSchedulePolicy instance_schedule_policy = 344877104; */ - private $instance_schedule_policy = null; + protected $instance_schedule_policy = null; /** * [Output Only] Type of the resource. Always compute#resource_policies for resource policies. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * The name of the resource, provided by the client when initially creating the resource. The resource name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * Generated from protobuf field optional string region = 138946292; */ - private $region = null; + protected $region = null; /** * [Output Only] The system status of the resource policy. * * Generated from protobuf field optional .google.cloud.compute.v1.ResourcePolicyResourceStatus resource_status = 249429315; */ - private $resource_status = null; + protected $resource_status = null; /** * [Output Only] Server-defined fully-qualified URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * Resource policy for persistent disks for creating snapshots. * * Generated from protobuf field optional .google.cloud.compute.v1.ResourcePolicySnapshotSchedulePolicy snapshot_schedule_policy = 218131295; */ - private $snapshot_schedule_policy = null; + protected $snapshot_schedule_policy = null; /** * [Output Only] The status of resource policy creation. * Check the Status enum for the list of possible values. * * Generated from protobuf field optional string status = 181260274; */ - private $status = null; + protected $status = null; /** * Resource policy for defining instance placement for MIGs. * * Generated from protobuf field optional .google.cloud.compute.v1.ResourcePolicyWorkloadPolicy workload_policy = 114721530; */ - private $workload_policy = null; + protected $workload_policy = null; /** * Constructor. diff --git a/Compute/src/V1/ResourcePolicyAggregatedList.php b/Compute/src/V1/ResourcePolicyAggregatedList.php index 28d47e9d5fb3..ed4b0e4da048 100644 --- a/Compute/src/V1/ResourcePolicyAggregatedList.php +++ b/Compute/src/V1/ResourcePolicyAggregatedList.php @@ -18,13 +18,13 @@ class ResourcePolicyAggregatedList extends \Google\Protobuf\Internal\Message /** * Generated from protobuf field optional string etag = 3123477; */ - private $etag = null; + protected $etag = null; /** * [Output Only] Unique identifier for the resource; defined by the server. * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of ResourcePolicy resources. * @@ -36,19 +36,19 @@ class ResourcePolicyAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Unreachable resources. * @@ -60,7 +60,7 @@ class ResourcePolicyAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/ResourcePolicyDailyCycle.php b/Compute/src/V1/ResourcePolicyDailyCycle.php index bad397eaa86d..300c1a9174e5 100644 --- a/Compute/src/V1/ResourcePolicyDailyCycle.php +++ b/Compute/src/V1/ResourcePolicyDailyCycle.php @@ -20,19 +20,19 @@ class ResourcePolicyDailyCycle extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int32 days_in_cycle = 369790004; */ - private $days_in_cycle = null; + protected $days_in_cycle = null; /** * [Output only] A predetermined duration for the window, automatically chosen to be the smallest possible in the given scenario. * * Generated from protobuf field optional string duration = 155471252; */ - private $duration = null; + protected $duration = null; /** * Start time of the window. This must be in UTC format that resolves to one of 00:00, 04:00, 08:00, 12:00, 16:00, or 20:00. For example, both 13:00-5 and 08:00 are valid. * * Generated from protobuf field optional string start_time = 37467274; */ - private $start_time = null; + protected $start_time = null; /** * Constructor. diff --git a/Compute/src/V1/ResourcePolicyGroupPlacementPolicy.php b/Compute/src/V1/ResourcePolicyGroupPlacementPolicy.php index ebdafdfb10fe..cec1cf90d1c4 100644 --- a/Compute/src/V1/ResourcePolicyGroupPlacementPolicy.php +++ b/Compute/src/V1/ResourcePolicyGroupPlacementPolicy.php @@ -20,26 +20,26 @@ class ResourcePolicyGroupPlacementPolicy extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field optional int32 availability_domain_count = 12453432; */ - private $availability_domain_count = null; + protected $availability_domain_count = null; /** * Specifies network collocation * Check the Collocation enum for the list of possible values. * * Generated from protobuf field optional string collocation = 511156533; */ - private $collocation = null; + protected $collocation = null; /** * Specifies the shape of the GPU slice, in slice based GPU families eg. A4X. * * Generated from protobuf field optional string gpu_topology = 247948450; */ - private $gpu_topology = null; + protected $gpu_topology = null; /** * Number of VMs in this placement group. Google does not recommend that you use this field unless you use a compact policy and you want your policy to work only if it contains this exact number of VMs. * * Generated from protobuf field optional int32 vm_count = 261463431; */ - private $vm_count = null; + protected $vm_count = null; /** * Constructor. diff --git a/Compute/src/V1/ResourcePolicyHourlyCycle.php b/Compute/src/V1/ResourcePolicyHourlyCycle.php index 198169568ae1..41eb52b02c39 100644 --- a/Compute/src/V1/ResourcePolicyHourlyCycle.php +++ b/Compute/src/V1/ResourcePolicyHourlyCycle.php @@ -20,19 +20,19 @@ class ResourcePolicyHourlyCycle extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string duration = 155471252; */ - private $duration = null; + protected $duration = null; /** * Defines a schedule with units measured in hours. The value determines how many hours pass between the start of each cycle. * * Generated from protobuf field optional int32 hours_in_cycle = 526763132; */ - private $hours_in_cycle = null; + protected $hours_in_cycle = null; /** * Time within the window to start the operations. It must be in format "HH:MM", where HH : [00-23] and MM : [00-00] GMT. * * Generated from protobuf field optional string start_time = 37467274; */ - private $start_time = null; + protected $start_time = null; /** * Constructor. diff --git a/Compute/src/V1/ResourcePolicyInstanceSchedulePolicy.php b/Compute/src/V1/ResourcePolicyInstanceSchedulePolicy.php index 3e98b853255a..1cf826e3b7e5 100644 --- a/Compute/src/V1/ResourcePolicyInstanceSchedulePolicy.php +++ b/Compute/src/V1/ResourcePolicyInstanceSchedulePolicy.php @@ -20,31 +20,31 @@ class ResourcePolicyInstanceSchedulePolicy extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field optional string expiration_time = 230299229; */ - private $expiration_time = null; + protected $expiration_time = null; /** * The start time of the schedule. The timestamp is an RFC3339 string. * * Generated from protobuf field optional string start_time = 37467274; */ - private $start_time = null; + protected $start_time = null; /** * Specifies the time zone to be used in interpreting Schedule.schedule. The value of this field must be a time zone name from the tz database: https://wikipedia.org/wiki/Tz_database. * * Generated from protobuf field optional string time_zone = 36848094; */ - private $time_zone = null; + protected $time_zone = null; /** * Specifies the schedule for starting instances. * * Generated from protobuf field optional .google.cloud.compute.v1.ResourcePolicyInstanceSchedulePolicySchedule vm_start_schedule = 17762396; */ - private $vm_start_schedule = null; + protected $vm_start_schedule = null; /** * Specifies the schedule for stopping instances. * * Generated from protobuf field optional .google.cloud.compute.v1.ResourcePolicyInstanceSchedulePolicySchedule vm_stop_schedule = 426242732; */ - private $vm_stop_schedule = null; + protected $vm_stop_schedule = null; /** * Constructor. diff --git a/Compute/src/V1/ResourcePolicyInstanceSchedulePolicySchedule.php b/Compute/src/V1/ResourcePolicyInstanceSchedulePolicySchedule.php index 232a7a95931b..3e7557145722 100644 --- a/Compute/src/V1/ResourcePolicyInstanceSchedulePolicySchedule.php +++ b/Compute/src/V1/ResourcePolicyInstanceSchedulePolicySchedule.php @@ -20,7 +20,7 @@ class ResourcePolicyInstanceSchedulePolicySchedule extends \Google\Protobuf\Inte * * Generated from protobuf field optional string schedule = 375820951; */ - private $schedule = null; + protected $schedule = null; /** * Constructor. diff --git a/Compute/src/V1/ResourcePolicyList.php b/Compute/src/V1/ResourcePolicyList.php index d5342c95d8d0..e0b77c79dbff 100644 --- a/Compute/src/V1/ResourcePolicyList.php +++ b/Compute/src/V1/ResourcePolicyList.php @@ -17,13 +17,13 @@ class ResourcePolicyList extends \Google\Protobuf\Internal\Message /** * Generated from protobuf field optional string etag = 3123477; */ - private $etag = null; + protected $etag = null; /** * [Output Only] The unique identifier for the resource. This identifier is defined by the server. * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * [Output Only] A list of ResourcePolicy resources. * @@ -35,25 +35,25 @@ class ResourcePolicyList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/ResourcePolicyResourceStatus.php b/Compute/src/V1/ResourcePolicyResourceStatus.php index 41c881ca2d40..73bf28ee62e7 100644 --- a/Compute/src/V1/ResourcePolicyResourceStatus.php +++ b/Compute/src/V1/ResourcePolicyResourceStatus.php @@ -20,7 +20,7 @@ class ResourcePolicyResourceStatus extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.ResourcePolicyResourceStatusInstanceSchedulePolicyStatus instance_schedule_policy = 344877104; */ - private $instance_schedule_policy = null; + protected $instance_schedule_policy = null; /** * Constructor. diff --git a/Compute/src/V1/ResourcePolicyResourceStatusInstanceSchedulePolicyStatus.php b/Compute/src/V1/ResourcePolicyResourceStatusInstanceSchedulePolicyStatus.php index 5ae8a46aebec..be74f034b615 100644 --- a/Compute/src/V1/ResourcePolicyResourceStatusInstanceSchedulePolicyStatus.php +++ b/Compute/src/V1/ResourcePolicyResourceStatusInstanceSchedulePolicyStatus.php @@ -19,13 +19,13 @@ class ResourcePolicyResourceStatusInstanceSchedulePolicyStatus extends \Google\P * * Generated from protobuf field optional string last_run_start_time = 303069063; */ - private $last_run_start_time = null; + protected $last_run_start_time = null; /** * [Output Only] The next time the schedule is planned to run. The actual time might be slightly different. The timestamp is an RFC3339 string. * * Generated from protobuf field optional string next_run_start_time = 318642570; */ - private $next_run_start_time = null; + protected $next_run_start_time = null; /** * Constructor. diff --git a/Compute/src/V1/ResourcePolicySnapshotSchedulePolicy.php b/Compute/src/V1/ResourcePolicySnapshotSchedulePolicy.php index bc7d35703559..f858d6ad9a75 100644 --- a/Compute/src/V1/ResourcePolicySnapshotSchedulePolicy.php +++ b/Compute/src/V1/ResourcePolicySnapshotSchedulePolicy.php @@ -20,19 +20,19 @@ class ResourcePolicySnapshotSchedulePolicy extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field optional .google.cloud.compute.v1.ResourcePolicySnapshotSchedulePolicyRetentionPolicy retention_policy = 68625779; */ - private $retention_policy = null; + protected $retention_policy = null; /** * A Vm Maintenance Policy specifies what kind of infrastructure maintenance we are allowed to perform on this VM and when. Schedule that is applied to disks covered by this policy. * * Generated from protobuf field optional .google.cloud.compute.v1.ResourcePolicySnapshotSchedulePolicySchedule schedule = 375820951; */ - private $schedule = null; + protected $schedule = null; /** * Properties with which snapshots are created such as labels, encryption keys. * * Generated from protobuf field optional .google.cloud.compute.v1.ResourcePolicySnapshotSchedulePolicySnapshotProperties snapshot_properties = 185371278; */ - private $snapshot_properties = null; + protected $snapshot_properties = null; /** * Constructor. diff --git a/Compute/src/V1/ResourcePolicySnapshotSchedulePolicyRetentionPolicy.php b/Compute/src/V1/ResourcePolicySnapshotSchedulePolicyRetentionPolicy.php index ef6f8e6af47f..4a91189d7faf 100644 --- a/Compute/src/V1/ResourcePolicySnapshotSchedulePolicyRetentionPolicy.php +++ b/Compute/src/V1/ResourcePolicySnapshotSchedulePolicyRetentionPolicy.php @@ -20,14 +20,14 @@ class ResourcePolicySnapshotSchedulePolicyRetentionPolicy extends \Google\Protob * * Generated from protobuf field optional int32 max_retention_days = 324296979; */ - private $max_retention_days = null; + protected $max_retention_days = null; /** * Specifies the behavior to apply to scheduled snapshots when the source disk is deleted. * Check the OnSourceDiskDelete enum for the list of possible values. * * Generated from protobuf field optional string on_source_disk_delete = 321955529; */ - private $on_source_disk_delete = null; + protected $on_source_disk_delete = null; /** * Constructor. diff --git a/Compute/src/V1/ResourcePolicySnapshotSchedulePolicySchedule.php b/Compute/src/V1/ResourcePolicySnapshotSchedulePolicySchedule.php index d42f05a99971..ad9c65433731 100644 --- a/Compute/src/V1/ResourcePolicySnapshotSchedulePolicySchedule.php +++ b/Compute/src/V1/ResourcePolicySnapshotSchedulePolicySchedule.php @@ -18,15 +18,15 @@ class ResourcePolicySnapshotSchedulePolicySchedule extends \Google\Protobuf\Inte /** * Generated from protobuf field optional .google.cloud.compute.v1.ResourcePolicyDailyCycle daily_schedule = 86159869; */ - private $daily_schedule = null; + protected $daily_schedule = null; /** * Generated from protobuf field optional .google.cloud.compute.v1.ResourcePolicyHourlyCycle hourly_schedule = 38328485; */ - private $hourly_schedule = null; + protected $hourly_schedule = null; /** * Generated from protobuf field optional .google.cloud.compute.v1.ResourcePolicyWeeklyCycle weekly_schedule = 359548053; */ - private $weekly_schedule = null; + protected $weekly_schedule = null; /** * Constructor. diff --git a/Compute/src/V1/ResourcePolicySnapshotSchedulePolicySnapshotProperties.php b/Compute/src/V1/ResourcePolicySnapshotSchedulePolicySnapshotProperties.php index 0f970ce9b4fe..b510adb6ba78 100644 --- a/Compute/src/V1/ResourcePolicySnapshotSchedulePolicySnapshotProperties.php +++ b/Compute/src/V1/ResourcePolicySnapshotSchedulePolicySnapshotProperties.php @@ -20,13 +20,13 @@ class ResourcePolicySnapshotSchedulePolicySnapshotProperties extends \Google\Pro * * Generated from protobuf field optional string chain_name = 68644169; */ - private $chain_name = null; + protected $chain_name = null; /** * Indication to perform a 'guest aware' snapshot. * * Generated from protobuf field optional bool guest_flush = 385550813; */ - private $guest_flush = null; + protected $guest_flush = null; /** * Labels to apply to scheduled snapshots. These can be later modified by the setLabels method. Label values may be empty. * diff --git a/Compute/src/V1/ResourcePolicyWeeklyCycleDayOfWeek.php b/Compute/src/V1/ResourcePolicyWeeklyCycleDayOfWeek.php index f5c64564943a..7b7ab06ed0d0 100644 --- a/Compute/src/V1/ResourcePolicyWeeklyCycleDayOfWeek.php +++ b/Compute/src/V1/ResourcePolicyWeeklyCycleDayOfWeek.php @@ -20,19 +20,19 @@ class ResourcePolicyWeeklyCycleDayOfWeek extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field optional string day = 99228; */ - private $day = null; + protected $day = null; /** * [Output only] Duration of the time window, automatically chosen to be smallest possible in the given scenario. * * Generated from protobuf field optional string duration = 155471252; */ - private $duration = null; + protected $duration = null; /** * Time within the window to start the operations. It must be in format "HH:MM", where HH : [00-23] and MM : [00-00] GMT. * * Generated from protobuf field optional string start_time = 37467274; */ - private $start_time = null; + protected $start_time = null; /** * Constructor. diff --git a/Compute/src/V1/ResourcePolicyWorkloadPolicy.php b/Compute/src/V1/ResourcePolicyWorkloadPolicy.php index 96aaf259f1fa..ae3769ae904b 100644 --- a/Compute/src/V1/ResourcePolicyWorkloadPolicy.php +++ b/Compute/src/V1/ResourcePolicyWorkloadPolicy.php @@ -20,21 +20,21 @@ class ResourcePolicyWorkloadPolicy extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string accelerator_topology = 389323203; */ - private $accelerator_topology = null; + protected $accelerator_topology = null; /** * Specifies the maximum distance between instances. * Check the MaxTopologyDistance enum for the list of possible values. * * Generated from protobuf field optional string max_topology_distance = 7521706; */ - private $max_topology_distance = null; + protected $max_topology_distance = null; /** * Specifies the intent of the instance placement in the MIG. * Check the Type enum for the list of possible values. * * Generated from protobuf field optional string type = 3575610; */ - private $type = null; + protected $type = null; /** * Constructor. diff --git a/Compute/src/V1/ResourceStatus.php b/Compute/src/V1/ResourceStatus.php index acf08ca71841..effe1e367efd 100644 --- a/Compute/src/V1/ResourceStatus.php +++ b/Compute/src/V1/ResourceStatus.php @@ -20,27 +20,27 @@ class ResourceStatus extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.ResourceStatusEffectiveInstanceMetadata effective_instance_metadata = 55052033; */ - private $effective_instance_metadata = null; + protected $effective_instance_metadata = null; /** * [Output Only] The precise location of your instance within the zone's data center, including the block, sub-block, and host. The field is formatted as follows: blockId/subBlockId/hostId. * * Generated from protobuf field optional string physical_host = 464370704; */ - private $physical_host = null; + protected $physical_host = null; /** * [Output Only] A series of fields containing the global name of the Compute Engine cluster, as well as the ID of the block, sub-block, and host on which the running instance is located. * * Generated from protobuf field optional .google.cloud.compute.v1.ResourceStatusPhysicalHostTopology physical_host_topology = 390842814; */ - private $physical_host_topology = null; + protected $physical_host_topology = null; /** * Generated from protobuf field optional .google.cloud.compute.v1.ResourceStatusScheduling scheduling = 386688404; */ - private $scheduling = null; + protected $scheduling = null; /** * Generated from protobuf field optional .google.cloud.compute.v1.UpcomingMaintenance upcoming_maintenance = 227348592; */ - private $upcoming_maintenance = null; + protected $upcoming_maintenance = null; /** * Constructor. diff --git a/Compute/src/V1/ResourceStatusEffectiveInstanceMetadata.php b/Compute/src/V1/ResourceStatusEffectiveInstanceMetadata.php index 6505cabdee9e..b453e4da9d39 100644 --- a/Compute/src/V1/ResourceStatusEffectiveInstanceMetadata.php +++ b/Compute/src/V1/ResourceStatusEffectiveInstanceMetadata.php @@ -20,49 +20,49 @@ class ResourceStatusEffectiveInstanceMetadata extends \Google\Protobuf\Internal\ * * Generated from protobuf field optional bool block_project_ssh_keys_metadata_value = 338623101; */ - private $block_project_ssh_keys_metadata_value = null; + protected $block_project_ssh_keys_metadata_value = null; /** * Effective enable-guest-attributes value at Instance level. * * Generated from protobuf field optional bool enable_guest_attributes_metadata_value = 420155878; */ - private $enable_guest_attributes_metadata_value = null; + protected $enable_guest_attributes_metadata_value = null; /** * Effective enable-os-inventory value at Instance level. * * Generated from protobuf field optional bool enable_os_inventory_metadata_value = 371752675; */ - private $enable_os_inventory_metadata_value = null; + protected $enable_os_inventory_metadata_value = null; /** * Effective enable-osconfig value at Instance level. * * Generated from protobuf field optional bool enable_osconfig_metadata_value = 502966494; */ - private $enable_osconfig_metadata_value = null; + protected $enable_osconfig_metadata_value = null; /** * Effective enable-oslogin value at Instance level. * * Generated from protobuf field optional bool enable_oslogin_metadata_value = 216603159; */ - private $enable_oslogin_metadata_value = null; + protected $enable_oslogin_metadata_value = null; /** * Effective serial-port-enable value at Instance level. * * Generated from protobuf field optional bool serial_port_enable_metadata_value = 430536330; */ - private $serial_port_enable_metadata_value = null; + protected $serial_port_enable_metadata_value = null; /** * Effective serial-port-logging-enable value at Instance level. * * Generated from protobuf field optional bool serial_port_logging_enable_metadata_value = 311813290; */ - private $serial_port_logging_enable_metadata_value = null; + protected $serial_port_logging_enable_metadata_value = null; /** * Effective VM DNS setting at Instance level. * * Generated from protobuf field optional string vm_dns_setting_metadata_value = 411127950; */ - private $vm_dns_setting_metadata_value = null; + protected $vm_dns_setting_metadata_value = null; /** * Constructor. diff --git a/Compute/src/V1/ResourceStatusPhysicalHostTopology.php b/Compute/src/V1/ResourceStatusPhysicalHostTopology.php index 0192407aa820..7d1721d76c35 100644 --- a/Compute/src/V1/ResourceStatusPhysicalHostTopology.php +++ b/Compute/src/V1/ResourceStatusPhysicalHostTopology.php @@ -20,25 +20,25 @@ class ResourceStatusPhysicalHostTopology extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field optional string block = 93832333; */ - private $block = null; + protected $block = null; /** * [Output Only] The global name of the Compute Engine cluster where the running instance is located. * * Generated from protobuf field optional string cluster = 335221242; */ - private $cluster = null; + protected $cluster = null; /** * [Output Only] The ID of the host on which the running instance is located. Instances on the same host experience the lowest possible network latency. * * Generated from protobuf field optional string host = 3208616; */ - private $host = null; + protected $host = null; /** * [Output Only] The ID of the sub-block in which the running instance is located. Instances in the same sub-block experience lower network latency than instances in the same block. * * Generated from protobuf field optional string subblock = 70446669; */ - private $subblock = null; + protected $subblock = null; /** * Constructor. diff --git a/Compute/src/V1/ResourceStatusScheduling.php b/Compute/src/V1/ResourceStatusScheduling.php index 3e3c6552f897..58e85289a9ca 100644 --- a/Compute/src/V1/ResourceStatusScheduling.php +++ b/Compute/src/V1/ResourceStatusScheduling.php @@ -19,7 +19,7 @@ class ResourceStatusScheduling extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int32 availability_domain = 252514344; */ - private $availability_domain = null; + protected $availability_domain = null; /** * Constructor. diff --git a/Compute/src/V1/ResumeInstanceRequest.php b/Compute/src/V1/ResumeInstanceRequest.php index b915138699e3..c1d529d70f66 100644 --- a/Compute/src/V1/ResumeInstanceRequest.php +++ b/Compute/src/V1/ResumeInstanceRequest.php @@ -20,25 +20,25 @@ class ResumeInstanceRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string instance = 18257045 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance = ''; + protected $instance = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ResumeInstancesInstanceGroupManagerRequest.php b/Compute/src/V1/ResumeInstancesInstanceGroupManagerRequest.php index 3b3ba80d4091..2e8920315311 100644 --- a/Compute/src/V1/ResumeInstancesInstanceGroupManagerRequest.php +++ b/Compute/src/V1/ResumeInstancesInstanceGroupManagerRequest.php @@ -20,31 +20,31 @@ class ResumeInstancesInstanceGroupManagerRequest extends \Google\Protobuf\Intern * * Generated from protobuf field string instance_group_manager = 249363395 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group_manager = ''; + protected $instance_group_manager = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.InstanceGroupManagersResumeInstancesRequest instance_group_managers_resume_instances_request_resource = 129015618 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group_managers_resume_instances_request_resource = null; + protected $instance_group_managers_resume_instances_request_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone where the managed instance group is located. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ResumeInstancesRegionInstanceGroupManagerRequest.php b/Compute/src/V1/ResumeInstancesRegionInstanceGroupManagerRequest.php index b6783df0280f..948885317be3 100644 --- a/Compute/src/V1/ResumeInstancesRegionInstanceGroupManagerRequest.php +++ b/Compute/src/V1/ResumeInstancesRegionInstanceGroupManagerRequest.php @@ -20,31 +20,31 @@ class ResumeInstancesRegionInstanceGroupManagerRequest extends \Google\Protobuf\ * * Generated from protobuf field string instance_group_manager = 249363395 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group_manager = ''; + protected $instance_group_manager = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.RegionInstanceGroupManagersResumeInstancesRequest region_instance_group_managers_resume_instances_request_resource = 463471031 [(.google.api.field_behavior) = REQUIRED]; */ - private $region_instance_group_managers_resume_instances_request_resource = null; + protected $region_instance_group_managers_resume_instances_request_resource = null; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/Route.php b/Compute/src/V1/Route.php index 738766c426cb..81a1281d12f8 100644 --- a/Compute/src/V1/Route.php +++ b/Compute/src/V1/Route.php @@ -26,142 +26,142 @@ class Route extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * An optional description of this resource. Provide this field when you create the resource. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * The destination range of outgoing packets that this route applies to. Both IPv4 and IPv6 are supported. Must specify an IPv4 range (e.g. 192.0.2.0/24) or an IPv6 range in RFC 4291 format (e.g. 2001:db8::/32). IPv6 range will be displayed using RFC 5952 compressed format. * * Generated from protobuf field optional string dest_range = 381327712; */ - private $dest_range = null; + protected $dest_range = null; /** * [Output Only] The unique identifier for the resource. This identifier is defined by the server. * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * [Output Only] Type of this resource. Always compute#routes for Route resources. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?`. The first character must be a lowercase letter, and all following characters (except for the last character) must be a dash, lowercase letter, or digit. The last character must be a lowercase letter or digit. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * Fully-qualified URL of the network that this route applies to. * * Generated from protobuf field optional string network = 232872494; */ - private $network = null; + protected $network = null; /** * The URL to a gateway that should handle matching packets. You can only specify the internet gateway using a full or partial valid URL: projects/ project/global/gateways/default-internet-gateway * * Generated from protobuf field optional string next_hop_gateway = 377175298; */ - private $next_hop_gateway = null; + protected $next_hop_gateway = null; /** * [Output Only] The full resource name of the Network Connectivity Center hub that will handle matching packets. * * Generated from protobuf field optional string next_hop_hub = 198679219; */ - private $next_hop_hub = null; + protected $next_hop_hub = null; /** * The URL to a forwarding rule of type loadBalancingScheme=INTERNAL that should handle matching packets or the IP address of the forwarding Rule. For example, the following are all valid URLs: - https://www.googleapis.com/compute/v1/projects/project/regions/region /forwardingRules/forwardingRule - regions/region/forwardingRules/forwardingRule If an IP address is provided, must specify an IPv4 address in dot-decimal notation or an IPv6 address in RFC 4291 format. For example, the following are all valid IP addresses: - 10.128.0.56 - 2001:db8::2d9:51:0:0 - 2001:db8:0:0:2d9:51:0:0 IPv6 addresses will be displayed using RFC 5952 compressed format (e.g. 2001:db8::2d9:51:0:0). Should never be an IPv4-mapped IPv6 address. * * Generated from protobuf field optional string next_hop_ilb = 198679901; */ - private $next_hop_ilb = null; + protected $next_hop_ilb = null; /** * The URL to an instance that should handle matching packets. You can specify this as a full or partial URL. For example: https://www.googleapis.com/compute/v1/projects/project/zones/zone/instances/ * * Generated from protobuf field optional string next_hop_instance = 393508247; */ - private $next_hop_instance = null; + protected $next_hop_instance = null; /** * [Output only] Internal fixed region-to-region cost that Google Cloud calculates based on factors such as network performance, distance, and available bandwidth between regions. * * Generated from protobuf field optional uint32 next_hop_inter_region_cost = 24442003; */ - private $next_hop_inter_region_cost = null; + protected $next_hop_inter_region_cost = null; /** * The network IP address of an instance that should handle matching packets. Both IPv6 address and IPv4 addresses are supported. Must specify an IPv4 address in dot-decimal notation (e.g. 192.0.2.99) or an IPv6 address in RFC 4291 format (e.g. 2001:db8::2d9:51:0:0 or 2001:db8:0:0:2d9:51:0:0). IPv6 addresses will be displayed using RFC 5952 compressed format (e.g. 2001:db8::2d9:51:0:0). Should never be an IPv4-mapped IPv6 address. * * Generated from protobuf field optional string next_hop_ip = 110319529; */ - private $next_hop_ip = null; + protected $next_hop_ip = null; /** * [Output Only] Multi-Exit Discriminator, a BGP route metric that indicates the desirability of a particular route in a network. * * Generated from protobuf field optional uint32 next_hop_med = 198683530; */ - private $next_hop_med = null; + protected $next_hop_med = null; /** * The URL of the local network if it should handle matching packets. * * Generated from protobuf field optional string next_hop_network = 262295788; */ - private $next_hop_network = null; + protected $next_hop_network = null; /** * [Output Only] Indicates the origin of the route. Can be IGP (Interior Gateway Protocol), EGP (Exterior Gateway Protocol), or INCOMPLETE. * Check the NextHopOrigin enum for the list of possible values. * * Generated from protobuf field optional string next_hop_origin = 48752808; */ - private $next_hop_origin = null; + protected $next_hop_origin = null; /** * [Output Only] The network peering name that should handle matching packets, which should conform to RFC1035. * * Generated from protobuf field optional string next_hop_peering = 412682750; */ - private $next_hop_peering = null; + protected $next_hop_peering = null; /** * The URL to a VpnTunnel that should handle matching packets. * * Generated from protobuf field optional string next_hop_vpn_tunnel = 519844501; */ - private $next_hop_vpn_tunnel = null; + protected $next_hop_vpn_tunnel = null; /** * Input only. [Input Only] Additional params passed with the request, but not persisted as part of resource payload. * * Generated from protobuf field optional .google.cloud.compute.v1.RouteParams params = 78313862; */ - private $params = null; + protected $params = null; /** * The priority of this route. Priority is used to break ties in cases where there is more than one matching route of equal prefix length. In cases where multiple routes have equal prefix length, the one with the lowest-numbered priority value wins. The default value is `1000`. The priority value must be from `0` to `65535`, inclusive. * * Generated from protobuf field optional uint32 priority = 445151652; */ - private $priority = null; + protected $priority = null; /** * [Output only] The status of the route. * Check the RouteStatus enum for the list of possible values. * * Generated from protobuf field optional string route_status = 418162344; */ - private $route_status = null; + protected $route_status = null; /** * [Output Only] The type of this route, which can be one of the following values: - 'TRANSIT' for a transit route that this router learned from another Cloud Router and will readvertise to one of its BGP peers - 'SUBNET' for a route from a subnet of the VPC - 'BGP' for a route learned from a BGP peer of this router - 'STATIC' for a static route * Check the RouteType enum for the list of possible values. * * Generated from protobuf field optional string route_type = 375888752; */ - private $route_type = null; + protected $route_type = null; /** * [Output Only] Server-defined fully-qualified URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * A list of instance tags to which this route applies. * diff --git a/Compute/src/V1/RouteAsPath.php b/Compute/src/V1/RouteAsPath.php index a74623d1707b..a015c1712546 100644 --- a/Compute/src/V1/RouteAsPath.php +++ b/Compute/src/V1/RouteAsPath.php @@ -26,7 +26,7 @@ class RouteAsPath extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string path_segment_type = 513464992; */ - private $path_segment_type = null; + protected $path_segment_type = null; /** * Constructor. diff --git a/Compute/src/V1/RouteList.php b/Compute/src/V1/RouteList.php index b28a4efa78de..d2c7249caf4f 100644 --- a/Compute/src/V1/RouteList.php +++ b/Compute/src/V1/RouteList.php @@ -20,7 +20,7 @@ class RouteList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of Route resources. * @@ -32,25 +32,25 @@ class RouteList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/RoutePolicy.php b/Compute/src/V1/RoutePolicy.php index 9e506733b865..8dd1143482bd 100644 --- a/Compute/src/V1/RoutePolicy.php +++ b/Compute/src/V1/RoutePolicy.php @@ -19,19 +19,19 @@ class RoutePolicy extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * A fingerprint for the Route Policy being applied to this Router, which is essentially a hash of the Route Policy used for optimistic locking. The fingerprint is initially generated by Compute Engine and changes after every request to modify or update Route Policy. You must always provide an up-to-date fingerprint hash in order to update or change labels. To see the latest fingerprint, make a getRoutePolicy() request to retrieve a Route Policy. * * Generated from protobuf field optional string fingerprint = 234678500; */ - private $fingerprint = null; + protected $fingerprint = null; /** * Route Policy name, which must be a resource ID segment and unique within all the router's Route Policies. Name should conform to RFC1035. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * List of terms (the order in the list is not important, they are evaluated in order of priority). Order of policies is not retained and might change when getting policy later. * @@ -44,7 +44,7 @@ class RoutePolicy extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string type = 3575610; */ - private $type = null; + protected $type = null; /** * Constructor. diff --git a/Compute/src/V1/RoutePolicyPolicyTerm.php b/Compute/src/V1/RoutePolicyPolicyTerm.php index 118b17a3ebd1..8bc33752c184 100644 --- a/Compute/src/V1/RoutePolicyPolicyTerm.php +++ b/Compute/src/V1/RoutePolicyPolicyTerm.php @@ -25,13 +25,13 @@ class RoutePolicyPolicyTerm extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.Expr match = 103668165; */ - private $match = null; + protected $match = null; /** * The evaluation priority for this term, which must be between 0 (inclusive) and 2^31 (exclusive), and unique within the list. * * Generated from protobuf field optional int32 priority = 445151652; */ - private $priority = null; + protected $priority = null; /** * Constructor. diff --git a/Compute/src/V1/Router.php b/Compute/src/V1/Router.php index e7d908083c17..2917e472a554 100644 --- a/Compute/src/V1/Router.php +++ b/Compute/src/V1/Router.php @@ -20,7 +20,7 @@ class Router extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.RouterBgp bgp = 97483; */ - private $bgp = null; + protected $bgp = null; /** * BGP information that must be configured into the routing stack to establish BGP peering. This information must specify the peer ASN and either the interface name, IP address, or peer IP address. Please refer to RFC4273. * @@ -32,25 +32,25 @@ class Router extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * An optional description of this resource. Provide this property when you create the resource. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * Indicates if a router is dedicated for use with encrypted VLAN attachments (interconnectAttachments). * * Generated from protobuf field optional bool encrypted_interconnect_router = 297996575; */ - private $encrypted_interconnect_router = null; + protected $encrypted_interconnect_router = null; /** * [Output Only] The unique identifier for the resource. This identifier is defined by the server. * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * Router interfaces. To create a BGP peer that uses a router interface, the interface must have one of the following fields specified: - linkedVpnTunnel - linkedInterconnectAttachment - subnetwork You can create a router interface without any of these fields specified. However, you cannot create a BGP peer that uses that interface. * @@ -62,7 +62,7 @@ class Router extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * Keys used for MD5 authentication. * @@ -74,7 +74,7 @@ class Router extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * A list of NAT services created in this router. * @@ -86,19 +86,19 @@ class Router extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string network = 232872494; */ - private $network = null; + protected $network = null; /** * [Output Only] URI of the region where the router resides. You must specify this field as part of the HTTP request URL. It is not settable as a field in the request body. * * Generated from protobuf field optional string region = 138946292; */ - private $region = null; + protected $region = null; /** * [Output Only] Server-defined URL for the resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * Constructor. diff --git a/Compute/src/V1/RouterAdvertisedIpRange.php b/Compute/src/V1/RouterAdvertisedIpRange.php index c861f4e2b8de..0fa31914818b 100644 --- a/Compute/src/V1/RouterAdvertisedIpRange.php +++ b/Compute/src/V1/RouterAdvertisedIpRange.php @@ -20,13 +20,13 @@ class RouterAdvertisedIpRange extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * The IP range to advertise. The value must be a CIDR-formatted string. * * Generated from protobuf field optional string range = 108280125; */ - private $range = null; + protected $range = null; /** * Constructor. diff --git a/Compute/src/V1/RouterAggregatedList.php b/Compute/src/V1/RouterAggregatedList.php index 65843ecbb094..172d4c1f8b53 100644 --- a/Compute/src/V1/RouterAggregatedList.php +++ b/Compute/src/V1/RouterAggregatedList.php @@ -20,7 +20,7 @@ class RouterAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of Router resources. * @@ -32,19 +32,19 @@ class RouterAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Unreachable resources. * @@ -56,7 +56,7 @@ class RouterAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/RouterBgp.php b/Compute/src/V1/RouterBgp.php index 881d315a601c..d1a2b0fdce2f 100644 --- a/Compute/src/V1/RouterBgp.php +++ b/Compute/src/V1/RouterBgp.php @@ -20,7 +20,7 @@ class RouterBgp extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string advertise_mode = 312134331; */ - private $advertise_mode = null; + protected $advertise_mode = null; /** * User-specified list of prefix groups to advertise in custom mode. This field can only be populated if advertise_mode is CUSTOM and is advertised to all peers of the router. These groups will be advertised in addition to any specified prefixes. Leave this field blank to advertise no custom groups. * Check the AdvertisedGroups enum for the list of possible values. @@ -39,19 +39,19 @@ class RouterBgp extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional uint32 asn = 96892; */ - private $asn = null; + protected $asn = null; /** * Explicitly specifies a range of valid BGP Identifiers for this Router. It is provided as a link-local IPv4 range (from 169.254.0.0/16), of size at least /30, even if the BGP sessions are over IPv6. It must not overlap with any IPv4 BGP session ranges. Other vendors commonly call this "router ID". * * Generated from protobuf field optional string identifier_range = 501573159; */ - private $identifier_range = null; + protected $identifier_range = null; /** * The interval in seconds between BGP keepalive messages that are sent to the peer. Hold time is three times the interval at which keepalive messages are sent, and the hold time is the maximum number of seconds allowed to elapse between successive keepalive messages that BGP receives from a peer. BGP will use the smaller of either the local hold time value or the peer's hold time value as the hold time for the BGP connection between the two peers. If set, this value must be between 20 and 60. The default is 20. * * Generated from protobuf field optional uint32 keepalive_interval = 276771516; */ - private $keepalive_interval = null; + protected $keepalive_interval = null; /** * Constructor. diff --git a/Compute/src/V1/RouterBgpPeer.php b/Compute/src/V1/RouterBgpPeer.php index 8213e9fda550..58f7412ea8b1 100644 --- a/Compute/src/V1/RouterBgpPeer.php +++ b/Compute/src/V1/RouterBgpPeer.php @@ -20,7 +20,7 @@ class RouterBgpPeer extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string advertise_mode = 312134331; */ - private $advertise_mode = null; + protected $advertise_mode = null; /** * User-specified list of prefix groups to advertise in custom mode, which currently supports the following option: - ALL_SUBNETS: Advertises all of the router's own VPC subnets. This excludes any routes learned for subnets that use VPC Network Peering. Note that this field can only be populated if advertise_mode is CUSTOM and overrides the list defined for the router (in the "bgp" message). These groups are advertised in addition to any specified prefixes. Leave this field blank to advertise no custom groups. * Check the AdvertisedGroups enum for the list of possible values. @@ -39,13 +39,13 @@ class RouterBgpPeer extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional uint32 advertised_route_priority = 186486332; */ - private $advertised_route_priority = null; + protected $advertised_route_priority = null; /** * BFD configuration for the BGP peering. * * Generated from protobuf field optional .google.cloud.compute.v1.RouterBgpPeerBfd bfd = 97440; */ - private $bfd = null; + protected $bfd = null; /** * A list of user-defined custom learned route IP address ranges for a BGP session. * @@ -57,26 +57,26 @@ class RouterBgpPeer extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int32 custom_learned_route_priority = 330412356; */ - private $custom_learned_route_priority = null; + protected $custom_learned_route_priority = null; /** * The status of the BGP peer connection. If set to FALSE, any active session with the peer is terminated and all associated routing information is removed. If set to TRUE, the peer connection can be established with routing information. The default is TRUE. * Check the Enable enum for the list of possible values. * * Generated from protobuf field optional string enable = 311764355; */ - private $enable = null; + protected $enable = null; /** * Enable IPv4 traffic over BGP Peer. It is enabled by default if the peerIpAddress is version 4. * * Generated from protobuf field optional bool enable_ipv4 = 181467937; */ - private $enable_ipv4 = null; + protected $enable_ipv4 = null; /** * Enable IPv6 traffic over BGP Peer. It is enabled by default if the peerIpAddress is version 6. * * Generated from protobuf field optional bool enable_ipv6 = 181467939; */ - private $enable_ipv6 = null; + protected $enable_ipv6 = null; /** * List of export policies applied to this peer, in the order they must be evaluated. The name must correspond to an existing policy that has ROUTE_POLICY_TYPE_EXPORT type. * @@ -94,74 +94,74 @@ class RouterBgpPeer extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string interface_name = 437854673; */ - private $interface_name = null; + protected $interface_name = null; /** * IP address of the interface inside Google Cloud Platform. * * Generated from protobuf field optional string ip_address = 406272220; */ - private $ip_address = null; + protected $ip_address = null; /** * IPv4 address of the interface inside Google Cloud Platform. * * Generated from protobuf field optional string ipv4_nexthop_address = 5703377; */ - private $ipv4_nexthop_address = null; + protected $ipv4_nexthop_address = null; /** * IPv6 address of the interface inside Google Cloud Platform. * * Generated from protobuf field optional string ipv6_nexthop_address = 27968211; */ - private $ipv6_nexthop_address = null; + protected $ipv6_nexthop_address = null; /** * [Output Only] The resource that configures and manages this BGP peer. - MANAGED_BY_USER is the default value and can be managed by you or other users - MANAGED_BY_ATTACHMENT is a BGP peer that is configured and managed by Cloud Interconnect, specifically by an InterconnectAttachment of type PARTNER. Google automatically creates, updates, and deletes this type of BGP peer when the PARTNER InterconnectAttachment is created, updated, or deleted. * Check the ManagementType enum for the list of possible values. * * Generated from protobuf field optional string management_type = 173703606; */ - private $management_type = null; + protected $management_type = null; /** * Present if MD5 authentication is enabled for the peering. Must be the name of one of the entries in the Router.md5_authentication_keys. The field must comply with RFC1035. * * Generated from protobuf field optional string md5_authentication_key_name = 281075345; */ - private $md5_authentication_key_name = null; + protected $md5_authentication_key_name = null; /** * Name of this BGP peer. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * Peer BGP Autonomous System Number (ASN). Each BGP interface may use a different value. * * Generated from protobuf field optional uint32 peer_asn = 69573151; */ - private $peer_asn = null; + protected $peer_asn = null; /** * IP address of the BGP interface outside Google Cloud Platform. * * Generated from protobuf field optional string peer_ip_address = 207735769; */ - private $peer_ip_address = null; + protected $peer_ip_address = null; /** * IPv4 address of the BGP interface outside Google Cloud Platform. * * Generated from protobuf field optional string peer_ipv4_nexthop_address = 469221774; */ - private $peer_ipv4_nexthop_address = null; + protected $peer_ipv4_nexthop_address = null; /** * IPv6 address of the BGP interface outside Google Cloud Platform. * * Generated from protobuf field optional string peer_ipv6_nexthop_address = 491486608; */ - private $peer_ipv6_nexthop_address = null; + protected $peer_ipv6_nexthop_address = null; /** * URI of the VM instance that is used as third-party router appliances such as Next Gen Firewalls, Virtual Routers, or Router Appliances. The VM instance must be located in zones contained in the same region as this Cloud Router. The VM instance is the peer side of the BGP session. * * Generated from protobuf field optional string router_appliance_instance = 468312989; */ - private $router_appliance_instance = null; + protected $router_appliance_instance = null; /** * Constructor. diff --git a/Compute/src/V1/RouterBgpPeerBfd.php b/Compute/src/V1/RouterBgpPeerBfd.php index e00acc15cf32..695d610b06d7 100644 --- a/Compute/src/V1/RouterBgpPeerBfd.php +++ b/Compute/src/V1/RouterBgpPeerBfd.php @@ -19,26 +19,26 @@ class RouterBgpPeerBfd extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional uint32 min_receive_interval = 186981614; */ - private $min_receive_interval = null; + protected $min_receive_interval = null; /** * The minimum interval, in milliseconds, between BFD control packets transmitted to the peer router. The actual value is negotiated between the two routers and is equal to the greater of this value and the corresponding receive interval of the other router. If set, this value must be between 1000 and 30000. The default is 1000. * * Generated from protobuf field optional uint32 min_transmit_interval = 523282631; */ - private $min_transmit_interval = null; + protected $min_transmit_interval = null; /** * The number of consecutive BFD packets that must be missed before BFD declares that a peer is unavailable. If set, the value must be a value between 5 and 16. The default is 5. * * Generated from protobuf field optional uint32 multiplier = 191331777; */ - private $multiplier = null; + protected $multiplier = null; /** * The BFD session initialization mode for this BGP peer. If set to ACTIVE, the Cloud Router will initiate the BFD session for this BGP peer. If set to PASSIVE, the Cloud Router will wait for the peer router to initiate the BFD session for this BGP peer. If set to DISABLED, BFD is disabled for this BGP peer. The default is DISABLED. * Check the SessionInitializationMode enum for the list of possible values. * * Generated from protobuf field optional string session_initialization_mode = 105957049; */ - private $session_initialization_mode = null; + protected $session_initialization_mode = null; /** * Constructor. diff --git a/Compute/src/V1/RouterBgpPeerCustomLearnedIpRange.php b/Compute/src/V1/RouterBgpPeerCustomLearnedIpRange.php index d94d836bc33c..7b8974584801 100644 --- a/Compute/src/V1/RouterBgpPeerCustomLearnedIpRange.php +++ b/Compute/src/V1/RouterBgpPeerCustomLearnedIpRange.php @@ -19,7 +19,7 @@ class RouterBgpPeerCustomLearnedIpRange extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field optional string range = 108280125; */ - private $range = null; + protected $range = null; /** * Constructor. diff --git a/Compute/src/V1/RouterInterface.php b/Compute/src/V1/RouterInterface.php index af0c0232d394..8d8ea26615b8 100644 --- a/Compute/src/V1/RouterInterface.php +++ b/Compute/src/V1/RouterInterface.php @@ -19,57 +19,57 @@ class RouterInterface extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string ip_range = 145092645; */ - private $ip_range = null; + protected $ip_range = null; /** * IP version of this interface. * Check the IpVersion enum for the list of possible values. * * Generated from protobuf field optional string ip_version = 294959552; */ - private $ip_version = null; + protected $ip_version = null; /** * URI of the linked Interconnect attachment. It must be in the same region as the router. Each interface can have one linked resource, which can be a VPN tunnel, an Interconnect attachment, or a subnetwork. * * Generated from protobuf field optional string linked_interconnect_attachment = 501085518; */ - private $linked_interconnect_attachment = null; + protected $linked_interconnect_attachment = null; /** * URI of the linked VPN tunnel, which must be in the same region as the router. Each interface can have one linked resource, which can be a VPN tunnel, an Interconnect attachment, or a subnetwork. * * Generated from protobuf field optional string linked_vpn_tunnel = 352296953; */ - private $linked_vpn_tunnel = null; + protected $linked_vpn_tunnel = null; /** * [Output Only] The resource that configures and manages this interface. - MANAGED_BY_USER is the default value and can be managed directly by users. - MANAGED_BY_ATTACHMENT is an interface that is configured and managed by Cloud Interconnect, specifically, by an InterconnectAttachment of type PARTNER. Google automatically creates, updates, and deletes this type of interface when the PARTNER InterconnectAttachment is created, updated, or deleted. * Check the ManagementType enum for the list of possible values. * * Generated from protobuf field optional string management_type = 173703606; */ - private $management_type = null; + protected $management_type = null; /** * Name of this interface entry. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * The regional private internal IP address that is used to establish BGP sessions to a VM instance acting as a third-party Router Appliance, such as a Next Gen Firewall, a Virtual Router, or an SD-WAN VM. * * Generated from protobuf field optional string private_ip_address = 100854040; */ - private $private_ip_address = null; + protected $private_ip_address = null; /** * Name of the interface that will be redundant with the current interface you are creating. The redundantInterface must belong to the same Cloud Router as the interface here. To establish the BGP session to a Router Appliance VM, you must create two BGP peers. The two BGP peers must be attached to two separate interfaces that are redundant with each other. The redundant_interface must be 1-63 characters long, and comply with RFC1035. Specifically, the redundant_interface must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. * * Generated from protobuf field optional string redundant_interface = 523187303; */ - private $redundant_interface = null; + protected $redundant_interface = null; /** * The URI of the subnetwork resource that this interface belongs to, which must be in the same region as the Cloud Router. When you establish a BGP session to a VM instance using this interface, the VM instance must belong to the same subnetwork as the subnetwork specified here. * * Generated from protobuf field optional string subnetwork = 307827694; */ - private $subnetwork = null; + protected $subnetwork = null; /** * Constructor. diff --git a/Compute/src/V1/RouterList.php b/Compute/src/V1/RouterList.php index ad5843a0982f..988da5d53726 100644 --- a/Compute/src/V1/RouterList.php +++ b/Compute/src/V1/RouterList.php @@ -20,7 +20,7 @@ class RouterList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of Router resources. * @@ -32,25 +32,25 @@ class RouterList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/RouterMd5AuthenticationKey.php b/Compute/src/V1/RouterMd5AuthenticationKey.php index 5f9d607a50b1..45d87cccc2df 100644 --- a/Compute/src/V1/RouterMd5AuthenticationKey.php +++ b/Compute/src/V1/RouterMd5AuthenticationKey.php @@ -19,13 +19,13 @@ class RouterMd5AuthenticationKey extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string key = 106079; */ - private $key = null; + protected $key = null; /** * Name used to identify the key. Must be unique within a router. Must be referenced by exactly one bgpPeer. Must comply with RFC1035. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * Constructor. diff --git a/Compute/src/V1/RouterNat.php b/Compute/src/V1/RouterNat.php index 04d8180922dc..c935d4f41970 100644 --- a/Compute/src/V1/RouterNat.php +++ b/Compute/src/V1/RouterNat.php @@ -21,7 +21,7 @@ class RouterNat extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string auto_network_tier = 269770211; */ - private $auto_network_tier = null; + protected $auto_network_tier = null; /** * A list of URLs of the IP resources to be drained. These IPs must be valid static external IPs that have been assigned to the NAT. These IPs should be used for updating/patching a NAT only. * @@ -33,11 +33,11 @@ class RouterNat extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional bool enable_dynamic_port_allocation = 532106402; */ - private $enable_dynamic_port_allocation = null; + protected $enable_dynamic_port_allocation = null; /** * Generated from protobuf field optional bool enable_endpoint_independent_mapping = 259441819; */ - private $enable_endpoint_independent_mapping = null; + protected $enable_endpoint_independent_mapping = null; /** * List of NAT-ted endpoint types supported by the Nat Gateway. If the list is empty, then it will be equivalent to include ENDPOINT_TYPE_VM * Check the EndpointTypes enum for the list of possible values. @@ -50,31 +50,31 @@ class RouterNat extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int32 icmp_idle_timeout_sec = 3647562; */ - private $icmp_idle_timeout_sec = null; + protected $icmp_idle_timeout_sec = null; /** * Configure logging on this NAT. * * Generated from protobuf field optional .google.cloud.compute.v1.RouterNatLogConfig log_config = 351299741; */ - private $log_config = null; + protected $log_config = null; /** * Maximum number of ports allocated to a VM from this NAT config when Dynamic Port Allocation is enabled. If Dynamic Port Allocation is not enabled, this field has no effect. If Dynamic Port Allocation is enabled, and this field is set, it must be set to a power of two greater than minPortsPerVm, or 64 if minPortsPerVm is not set. If Dynamic Port Allocation is enabled and this field is not set, a maximum of 65536 ports will be allocated to a VM from this NAT config. * * Generated from protobuf field optional int32 max_ports_per_vm = 250062049; */ - private $max_ports_per_vm = null; + protected $max_ports_per_vm = null; /** * Minimum number of ports allocated to a VM from this NAT config. If not set, a default number of ports is allocated to a VM. This is rounded up to the nearest power of 2. For example, if the value of this field is 50, at least 64 ports are allocated to a VM. * * Generated from protobuf field optional int32 min_ports_per_vm = 186193587; */ - private $min_ports_per_vm = null; + protected $min_ports_per_vm = null; /** * Unique name of this Nat service. The name must be 1-63 characters long and comply with RFC1035. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * List of Subnetwork resources whose traffic should be translated by NAT64 Gateway. It is used only when LIST_OF_IPV6_SUBNETWORKS is selected for the SubnetworkIpRangeToNat64Option above. * @@ -87,7 +87,7 @@ class RouterNat extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string nat_ip_allocate_option = 429726845; */ - private $nat_ip_allocate_option = null; + protected $nat_ip_allocate_option = null; /** * A list of URLs of the IP resources used for this Nat service. These IP addresses must be valid static external IP addresses assigned to the project. * @@ -106,14 +106,14 @@ class RouterNat extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string source_subnetwork_ip_ranges_to_nat = 252213211; */ - private $source_subnetwork_ip_ranges_to_nat = null; + protected $source_subnetwork_ip_ranges_to_nat = null; /** * Specify the Nat option for NAT64, which can take one of the following values: - ALL_IPV6_SUBNETWORKS: All of the IP ranges in every Subnetwork are allowed to Nat. - LIST_OF_IPV6_SUBNETWORKS: A list of Subnetworks are allowed to Nat (specified in the field nat64_subnetwork below) The default is NAT64_OPTION_UNSPECIFIED. Note that if this field contains NAT64_ALL_V6_SUBNETWORKS no other Router.Nat section in this region can also enable NAT64 for any Subnetworks in this network. Other Router.Nat sections can still be present to enable NAT44 only. * Check the SourceSubnetworkIpRangesToNat64 enum for the list of possible values. * * Generated from protobuf field optional string source_subnetwork_ip_ranges_to_nat64 = 248116185; */ - private $source_subnetwork_ip_ranges_to_nat64 = null; + protected $source_subnetwork_ip_ranges_to_nat64 = null; /** * A list of Subnetwork resources whose traffic should be translated by NAT Gateway. It is used only when LIST_OF_SUBNETWORKS is selected for the SubnetworkIpRangeToNatOption above. * @@ -125,32 +125,32 @@ class RouterNat extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int32 tcp_established_idle_timeout_sec = 223098349; */ - private $tcp_established_idle_timeout_sec = null; + protected $tcp_established_idle_timeout_sec = null; /** * Timeout (in seconds) for TCP connections that are in TIME_WAIT state. Defaults to 120s if not set. * * Generated from protobuf field optional int32 tcp_time_wait_timeout_sec = 513596925; */ - private $tcp_time_wait_timeout_sec = null; + protected $tcp_time_wait_timeout_sec = null; /** * Timeout (in seconds) for TCP transitory connections. Defaults to 30s if not set. * * Generated from protobuf field optional int32 tcp_transitory_idle_timeout_sec = 205028774; */ - private $tcp_transitory_idle_timeout_sec = null; + protected $tcp_transitory_idle_timeout_sec = null; /** * Indicates whether this NAT is used for public or private IP translation. If unspecified, it defaults to PUBLIC. * Check the Type enum for the list of possible values. * * Generated from protobuf field optional string type = 3575610; */ - private $type = null; + protected $type = null; /** * Timeout (in seconds) for UDP connections. Defaults to 30s if not set. * * Generated from protobuf field optional int32 udp_idle_timeout_sec = 64919878; */ - private $udp_idle_timeout_sec = null; + protected $udp_idle_timeout_sec = null; /** * Constructor. diff --git a/Compute/src/V1/RouterNatLogConfig.php b/Compute/src/V1/RouterNatLogConfig.php index 3720f898dfb7..648fda471b86 100644 --- a/Compute/src/V1/RouterNatLogConfig.php +++ b/Compute/src/V1/RouterNatLogConfig.php @@ -20,14 +20,14 @@ class RouterNatLogConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional bool enable = 311764355; */ - private $enable = null; + protected $enable = null; /** * Specify the desired filtering of logs on this NAT. If unspecified, logs are exported for all connections handled by this NAT. This option can take one of the following values: - ERRORS_ONLY: Export logs only for connection failures. - TRANSLATIONS_ONLY: Export logs only for successful connections. - ALL: Export logs for all connections, successful and unsuccessful. * Check the Filter enum for the list of possible values. * * Generated from protobuf field optional string filter = 336120696; */ - private $filter = null; + protected $filter = null; /** * Constructor. diff --git a/Compute/src/V1/RouterNatRule.php b/Compute/src/V1/RouterNatRule.php index 777319d547c2..28a3770f927c 100644 --- a/Compute/src/V1/RouterNatRule.php +++ b/Compute/src/V1/RouterNatRule.php @@ -19,25 +19,25 @@ class RouterNatRule extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.RouterNatRuleAction action = 187661878; */ - private $action = null; + protected $action = null; /** * An optional description of this rule. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * CEL expression that specifies the match condition that egress traffic from a VM is evaluated against. If it evaluates to true, the corresponding `action` is enforced. The following examples are valid match expressions for public NAT: `inIpRange(destination.ip, '1.1.0.0/16') || inIpRange(destination.ip, '2.2.0.0/16')` `destination.ip == '1.1.0.1' || destination.ip == '8.8.8.8'` The following example is a valid match expression for private NAT: `nexthop.hub == '//networkconnectivity.googleapis.com/projects/my-project/locations/global/hubs/hub-1'` * * Generated from protobuf field optional string match = 103668165; */ - private $match = null; + protected $match = null; /** * An integer uniquely identifying a rule in the list. The rule number must be a positive value between 0 and 65000, and must be unique among rules within a NAT. * * Generated from protobuf field optional uint32 rule_number = 535211500; */ - private $rule_number = null; + protected $rule_number = null; /** * Constructor. diff --git a/Compute/src/V1/RouterNatSubnetworkToNat.php b/Compute/src/V1/RouterNatSubnetworkToNat.php index 31fe6b5a481a..56e602a397d4 100644 --- a/Compute/src/V1/RouterNatSubnetworkToNat.php +++ b/Compute/src/V1/RouterNatSubnetworkToNat.php @@ -20,7 +20,7 @@ class RouterNatSubnetworkToNat extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * A list of the secondary ranges of the Subnetwork that are allowed to use NAT. This can be populated only if "LIST_OF_SECONDARY_IP_RANGES" is one of the values in source_ip_ranges_to_nat. * diff --git a/Compute/src/V1/RouterNatSubnetworkToNat64.php b/Compute/src/V1/RouterNatSubnetworkToNat64.php index 83a88fa1d09e..53121be19f18 100644 --- a/Compute/src/V1/RouterNatSubnetworkToNat64.php +++ b/Compute/src/V1/RouterNatSubnetworkToNat64.php @@ -20,7 +20,7 @@ class RouterNatSubnetworkToNat64 extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * Constructor. diff --git a/Compute/src/V1/RouterStatus.php b/Compute/src/V1/RouterStatus.php index b38a5386ab6f..065345519255 100644 --- a/Compute/src/V1/RouterStatus.php +++ b/Compute/src/V1/RouterStatus.php @@ -39,7 +39,7 @@ class RouterStatus extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string network = 232872494; */ - private $network = null; + protected $network = null; /** * Constructor. diff --git a/Compute/src/V1/RouterStatusBgpPeerStatus.php b/Compute/src/V1/RouterStatusBgpPeerStatus.php index fd921bb21893..d1aa5973107a 100644 --- a/Compute/src/V1/RouterStatusBgpPeerStatus.php +++ b/Compute/src/V1/RouterStatusBgpPeerStatus.php @@ -23,117 +23,117 @@ class RouterStatusBgpPeerStatus extends \Google\Protobuf\Internal\Message /** * Generated from protobuf field optional .google.cloud.compute.v1.BfdStatus bfd_status = 395631729; */ - private $bfd_status = null; + protected $bfd_status = null; /** * Enable IPv4 traffic over BGP Peer. It is enabled by default if the peerIpAddress is version 4. * * Generated from protobuf field optional bool enable_ipv4 = 181467937; */ - private $enable_ipv4 = null; + protected $enable_ipv4 = null; /** * Enable IPv6 traffic over BGP Peer. It is enabled by default if the peerIpAddress is version 6. * * Generated from protobuf field optional bool enable_ipv6 = 181467939; */ - private $enable_ipv6 = null; + protected $enable_ipv6 = null; /** * IP address of the local BGP interface. * * Generated from protobuf field optional string ip_address = 406272220; */ - private $ip_address = null; + protected $ip_address = null; /** * IPv4 address of the local BGP interface. * * Generated from protobuf field optional string ipv4_nexthop_address = 5703377; */ - private $ipv4_nexthop_address = null; + protected $ipv4_nexthop_address = null; /** * IPv6 address of the local BGP interface. * * Generated from protobuf field optional string ipv6_nexthop_address = 27968211; */ - private $ipv6_nexthop_address = null; + protected $ipv6_nexthop_address = null; /** * URL of the VPN tunnel that this BGP peer controls. * * Generated from protobuf field optional string linked_vpn_tunnel = 352296953; */ - private $linked_vpn_tunnel = null; + protected $linked_vpn_tunnel = null; /** * Informs whether MD5 authentication is enabled on this BGP peer. * * Generated from protobuf field optional bool md5_auth_enabled = 451152075; */ - private $md5_auth_enabled = null; + protected $md5_auth_enabled = null; /** * Name of this BGP peer. Unique within the Routers resource. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * Number of routes learned from the remote BGP Peer. * * Generated from protobuf field optional uint32 num_learned_routes = 135457535; */ - private $num_learned_routes = null; + protected $num_learned_routes = null; /** * IP address of the remote BGP interface. * * Generated from protobuf field optional string peer_ip_address = 207735769; */ - private $peer_ip_address = null; + protected $peer_ip_address = null; /** * IPv4 address of the remote BGP interface. * * Generated from protobuf field optional string peer_ipv4_nexthop_address = 469221774; */ - private $peer_ipv4_nexthop_address = null; + protected $peer_ipv4_nexthop_address = null; /** * IPv6 address of the remote BGP interface. * * Generated from protobuf field optional string peer_ipv6_nexthop_address = 491486608; */ - private $peer_ipv6_nexthop_address = null; + protected $peer_ipv6_nexthop_address = null; /** * [Output only] URI of the VM instance that is used as third-party router appliances such as Next Gen Firewalls, Virtual Routers, or Router Appliances. The VM instance is the peer side of the BGP session. * * Generated from protobuf field optional string router_appliance_instance = 468312989; */ - private $router_appliance_instance = null; + protected $router_appliance_instance = null; /** * The state of the BGP session. For a list of possible values for this field, see BGP session states. * * Generated from protobuf field optional string state = 109757585; */ - private $state = null; + protected $state = null; /** * Status of the BGP peer: {UP, DOWN} * Check the Status enum for the list of possible values. * * Generated from protobuf field optional string status = 181260274; */ - private $status = null; + protected $status = null; /** * Indicates why particular status was returned. * Check the StatusReason enum for the list of possible values. * * Generated from protobuf field optional string status_reason = 342706993; */ - private $status_reason = null; + protected $status_reason = null; /** * Time this session has been up. Format: 14 years, 51 weeks, 6 days, 23 hours, 59 minutes, 59 seconds * * Generated from protobuf field optional string uptime = 235379688; */ - private $uptime = null; + protected $uptime = null; /** * Time this session has been up, in seconds. Format: 145 * * Generated from protobuf field optional string uptime_seconds = 104736040; */ - private $uptime_seconds = null; + protected $uptime_seconds = null; /** * Constructor. diff --git a/Compute/src/V1/RouterStatusNatStatus.php b/Compute/src/V1/RouterStatusNatStatus.php index 583aeb24dec9..d47bcb8a9334 100644 --- a/Compute/src/V1/RouterStatusNatStatus.php +++ b/Compute/src/V1/RouterStatusNatStatus.php @@ -38,19 +38,19 @@ class RouterStatusNatStatus extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int32 min_extra_nat_ips_needed = 365786338; */ - private $min_extra_nat_ips_needed = null; + protected $min_extra_nat_ips_needed = null; /** * Unique name of this NAT. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * Number of VM endpoints (i.e., Nics) that can use NAT. * * Generated from protobuf field optional int32 num_vm_endpoints_with_nat_mappings = 512367468; */ - private $num_vm_endpoints_with_nat_mappings = null; + protected $num_vm_endpoints_with_nat_mappings = null; /** * Status of rules in this NAT. * diff --git a/Compute/src/V1/RouterStatusNatStatusNatRuleStatus.php b/Compute/src/V1/RouterStatusNatStatusNatRuleStatus.php index 94ebf79a2d0e..c05fa60b5885 100644 --- a/Compute/src/V1/RouterStatusNatStatusNatRuleStatus.php +++ b/Compute/src/V1/RouterStatusNatStatusNatRuleStatus.php @@ -32,19 +32,19 @@ class RouterStatusNatStatusNatRuleStatus extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field optional int32 min_extra_ips_needed = 353002756; */ - private $min_extra_ips_needed = null; + protected $min_extra_ips_needed = null; /** * Number of VM endpoints (i.e., NICs) that have NAT Mappings from this NAT Rule. * * Generated from protobuf field optional int32 num_vm_endpoints_with_nat_mappings = 512367468; */ - private $num_vm_endpoints_with_nat_mappings = null; + protected $num_vm_endpoints_with_nat_mappings = null; /** * Rule number of the rule. * * Generated from protobuf field optional int32 rule_number = 535211500; */ - private $rule_number = null; + protected $rule_number = null; /** * Constructor. diff --git a/Compute/src/V1/RouterStatusResponse.php b/Compute/src/V1/RouterStatusResponse.php index 277c3eb43c63..13e3aaaaf134 100644 --- a/Compute/src/V1/RouterStatusResponse.php +++ b/Compute/src/V1/RouterStatusResponse.php @@ -19,11 +19,11 @@ class RouterStatusResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * Generated from protobuf field optional .google.cloud.compute.v1.RouterStatus result = 139315229; */ - private $result = null; + protected $result = null; /** * Constructor. diff --git a/Compute/src/V1/RoutersClient.php b/Compute/src/V1/RoutersClient.php deleted file mode 100644 index 7368aa69b73b..000000000000 --- a/Compute/src/V1/RoutersClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional .google.cloud.compute.v1.RoutePolicy resource = 195806222; */ - private $resource = null; + protected $resource = null; /** * Constructor. diff --git a/Compute/src/V1/RoutersListBgpRoutes.php b/Compute/src/V1/RoutersListBgpRoutes.php index 7b1909114313..47c007ea7a3d 100644 --- a/Compute/src/V1/RoutersListBgpRoutes.php +++ b/Compute/src/V1/RoutersListBgpRoutes.php @@ -17,25 +17,25 @@ class RoutersListBgpRoutes extends \Google\Protobuf\Internal\Message /** * Generated from protobuf field optional string etag = 3123477; */ - private $etag = null; + protected $etag = null; /** * [Output Only] The unique identifier for the resource. This identifier is defined by the server. * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * [Output Only] Type of resource. Always compute#routersListBgpRoutes for lists of bgp routes. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] A list of bgp routes. * @@ -47,7 +47,7 @@ class RoutersListBgpRoutes extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Unreachable resources. * @@ -59,7 +59,7 @@ class RoutersListBgpRoutes extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/RoutersListRoutePolicies.php b/Compute/src/V1/RoutersListRoutePolicies.php index dc9a62bb5d1e..9e03035b1751 100644 --- a/Compute/src/V1/RoutersListRoutePolicies.php +++ b/Compute/src/V1/RoutersListRoutePolicies.php @@ -17,25 +17,25 @@ class RoutersListRoutePolicies extends \Google\Protobuf\Internal\Message /** * Generated from protobuf field optional string etag = 3123477; */ - private $etag = null; + protected $etag = null; /** * [Output Only] The unique identifier for the resource. This identifier is defined by the server. * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * [Output Only] Type of resource. Always compute#routersListRoutePolicies for lists of route policies. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] A list of route policies. * @@ -47,7 +47,7 @@ class RoutersListRoutePolicies extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Unreachable resources. * @@ -59,7 +59,7 @@ class RoutersListRoutePolicies extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/RoutersPreviewResponse.php b/Compute/src/V1/RoutersPreviewResponse.php index 94acf0f556cf..43fa47a49ddb 100644 --- a/Compute/src/V1/RoutersPreviewResponse.php +++ b/Compute/src/V1/RoutersPreviewResponse.php @@ -19,7 +19,7 @@ class RoutersPreviewResponse extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.Router resource = 195806222; */ - private $resource = null; + protected $resource = null; /** * Constructor. diff --git a/Compute/src/V1/RoutersScopedList.php b/Compute/src/V1/RoutersScopedList.php index 7a7f477d2d73..cc74b19b17aa 100644 --- a/Compute/src/V1/RoutersScopedList.php +++ b/Compute/src/V1/RoutersScopedList.php @@ -25,7 +25,7 @@ class RoutersScopedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/RoutesClient.php b/Compute/src/V1/RoutesClient.php deleted file mode 100644 index fa45bfe433eb..000000000000 --- a/Compute/src/V1/RoutesClient.php +++ /dev/null @@ -1,34 +0,0 @@ -google.cloud.compute.v1.Rule - */ -class Rule extends \Google\Protobuf\Internal\Message -{ - /** - * This is deprecated and has no effect. Do not use. - * Check the Action enum for the list of possible values. - * - * Generated from protobuf field optional string action = 187661878; - */ - private $action = null; - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf field repeated .google.cloud.compute.v1.Condition conditions = 142882488; - */ - private $conditions; - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf field optional string description = 422937596; - */ - private $description = null; - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf field repeated string ins = 104430; - */ - private $ins; - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf field repeated .google.cloud.compute.v1.LogConfig log_configs = 152873846; - */ - private $log_configs; - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf field repeated string not_ins = 518443138; - */ - private $not_ins; - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf field repeated string permissions = 59962500; - */ - private $permissions; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $action - * This is deprecated and has no effect. Do not use. - * Check the Action enum for the list of possible values. - * @type array<\Google\Cloud\Compute\V1\Condition>|\Google\Protobuf\Internal\RepeatedField $conditions - * This is deprecated and has no effect. Do not use. - * @type string $description - * This is deprecated and has no effect. Do not use. - * @type array|\Google\Protobuf\Internal\RepeatedField $ins - * This is deprecated and has no effect. Do not use. - * @type array<\Google\Cloud\Compute\V1\LogConfig>|\Google\Protobuf\Internal\RepeatedField $log_configs - * This is deprecated and has no effect. Do not use. - * @type array|\Google\Protobuf\Internal\RepeatedField $not_ins - * This is deprecated and has no effect. Do not use. - * @type array|\Google\Protobuf\Internal\RepeatedField $permissions - * This is deprecated and has no effect. Do not use. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Compute\V1\Compute::initOnce(); - parent::__construct($data); - } - - /** - * This is deprecated and has no effect. Do not use. - * Check the Action enum for the list of possible values. - * - * Generated from protobuf field optional string action = 187661878; - * @return string - */ - public function getAction() - { - return isset($this->action) ? $this->action : ''; - } - - public function hasAction() - { - return isset($this->action); - } - - public function clearAction() - { - unset($this->action); - } - - /** - * This is deprecated and has no effect. Do not use. - * Check the Action enum for the list of possible values. - * - * Generated from protobuf field optional string action = 187661878; - * @param string $var - * @return $this - */ - public function setAction($var) - { - GPBUtil::checkString($var, True); - $this->action = $var; - - return $this; - } - - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf field repeated .google.cloud.compute.v1.Condition conditions = 142882488; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getConditions() - { - return $this->conditions; - } - - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf field repeated .google.cloud.compute.v1.Condition conditions = 142882488; - * @param array<\Google\Cloud\Compute\V1\Condition>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setConditions($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Compute\V1\Condition::class); - $this->conditions = $arr; - - return $this; - } - - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf field optional string description = 422937596; - * @return string - */ - public function getDescription() - { - return isset($this->description) ? $this->description : ''; - } - - public function hasDescription() - { - return isset($this->description); - } - - public function clearDescription() - { - unset($this->description); - } - - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf field optional string description = 422937596; - * @param string $var - * @return $this - */ - public function setDescription($var) - { - GPBUtil::checkString($var, True); - $this->description = $var; - - return $this; - } - - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf field repeated string ins = 104430; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getIns() - { - return $this->ins; - } - - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf field repeated string ins = 104430; - * @param array|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setIns($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); - $this->ins = $arr; - - return $this; - } - - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf field repeated .google.cloud.compute.v1.LogConfig log_configs = 152873846; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getLogConfigs() - { - return $this->log_configs; - } - - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf field repeated .google.cloud.compute.v1.LogConfig log_configs = 152873846; - * @param array<\Google\Cloud\Compute\V1\LogConfig>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setLogConfigs($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Compute\V1\LogConfig::class); - $this->log_configs = $arr; - - return $this; - } - - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf field repeated string not_ins = 518443138; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getNotIns() - { - return $this->not_ins; - } - - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf field repeated string not_ins = 518443138; - * @param array|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setNotIns($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); - $this->not_ins = $arr; - - return $this; - } - - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf field repeated string permissions = 59962500; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getPermissions() - { - return $this->permissions; - } - - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf field repeated string permissions = 59962500; - * @param array|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setPermissions($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); - $this->permissions = $arr; - - return $this; - } - -} - diff --git a/Compute/src/V1/Rule/Action.php b/Compute/src/V1/Rule/Action.php deleted file mode 100644 index 4be165050e8f..000000000000 --- a/Compute/src/V1/Rule/Action.php +++ /dev/null @@ -1,90 +0,0 @@ -google.cloud.compute.v1.Rule.Action - */ -class Action -{ - /** - * A value indicating that the enum field is not set. - * - * Generated from protobuf enum UNDEFINED_ACTION = 0; - */ - const UNDEFINED_ACTION = 0; - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf enum ALLOW = 62368553; - */ - const ALLOW = 62368553; - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf enum ALLOW_WITH_LOG = 76034177; - */ - const ALLOW_WITH_LOG = 76034177; - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf enum DENY = 2094604; - */ - const DENY = 2094604; - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf enum DENY_WITH_LOG = 351433982; - */ - const DENY_WITH_LOG = 351433982; - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf enum LOG = 75556; - */ - const LOG = 75556; - /** - * This is deprecated and has no effect. Do not use. - * - * Generated from protobuf enum NO_ACTION = 260643444; - */ - const NO_ACTION = 260643444; - - private static $valueToName = [ - self::UNDEFINED_ACTION => 'UNDEFINED_ACTION', - self::ALLOW => 'ALLOW', - self::ALLOW_WITH_LOG => 'ALLOW_WITH_LOG', - self::DENY => 'DENY', - self::DENY_WITH_LOG => 'DENY_WITH_LOG', - self::LOG => 'LOG', - self::NO_ACTION => 'NO_ACTION', - ]; - - 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/Compute/src/V1/SSLHealthCheck.php b/Compute/src/V1/SSLHealthCheck.php index 7d3bf120ec18..b9ffc1a0ddbb 100644 --- a/Compute/src/V1/SSLHealthCheck.php +++ b/Compute/src/V1/SSLHealthCheck.php @@ -19,39 +19,39 @@ class SSLHealthCheck extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int32 port = 3446913; */ - private $port = null; + protected $port = null; /** * Not supported. * * Generated from protobuf field optional string port_name = 41534345; */ - private $port_name = null; + protected $port_name = null; /** * Specifies how a port is selected for health checking. Can be one of the following values: USE_FIXED_PORT: Specifies a port number explicitly using the port field in the health check. Supported by backend services for passthrough load balancers and backend services for proxy load balancers. Not supported by target pools. The health check supports all backends supported by the backend service provided the backend can be health checked. For example, GCE_VM_IP network endpoint groups, GCE_VM_IP_PORT network endpoint groups, and instance group backends. USE_NAMED_PORT: Not supported. USE_SERVING_PORT: Provides an indirect method of specifying the health check port by referring to the backend service. Only supported by backend services for proxy load balancers. Not supported by target pools. Not supported by backend services for passthrough load balancers. Supports all backends that can be health checked; for example, GCE_VM_IP_PORT network endpoint groups and instance group backends. For GCE_VM_IP_PORT network endpoint group backends, the health check uses the port number specified for each endpoint in the network endpoint group. For instance group backends, the health check uses the port number determined by looking up the backend service's named port in the instance group's list of named ports. * Check the PortSpecification enum for the list of possible values. * * Generated from protobuf field optional string port_specification = 51590597; */ - private $port_specification = null; + protected $port_specification = null; /** * Specifies the type of proxy header to append before sending data to the backend, either NONE or PROXY_V1. The default is NONE. * Check the ProxyHeader enum for the list of possible values. * * Generated from protobuf field optional string proxy_header = 160374142; */ - private $proxy_header = null; + protected $proxy_header = null; /** * Instructs the health check prober to send this exact ASCII string, up to 1024 bytes in length, after establishing the TCP connection and SSL handshake. * * Generated from protobuf field optional string request = 21951119; */ - private $request = null; + protected $request = null; /** * Creates a content-based SSL health check. In addition to establishing a TCP connection and the TLS handshake, you can configure the health check to pass only when the backend sends this exact response ASCII string, up to 1024 bytes in length. For details, see: https://cloud.google.com/load-balancing/docs/health-check-concepts#criteria-protocol-ssl-tcp * * Generated from protobuf field optional string response = 196547649; */ - private $response = null; + protected $response = null; /** * Constructor. diff --git a/Compute/src/V1/SavedAttachedDisk.php b/Compute/src/V1/SavedAttachedDisk.php index 667471f56759..da0531ba2aa3 100644 --- a/Compute/src/V1/SavedAttachedDisk.php +++ b/Compute/src/V1/SavedAttachedDisk.php @@ -20,37 +20,37 @@ class SavedAttachedDisk extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional bool auto_delete = 464761403; */ - private $auto_delete = null; + protected $auto_delete = null; /** * Indicates that this is a boot disk. The virtual machine will use the first partition of the disk for its root filesystem. * * Generated from protobuf field optional bool boot = 3029746; */ - private $boot = null; + protected $boot = null; /** * Specifies the name of the disk attached to the source instance. * * Generated from protobuf field optional string device_name = 67541716; */ - private $device_name = null; + protected $device_name = null; /** * The encryption key for the disk. * * Generated from protobuf field optional .google.cloud.compute.v1.CustomerEncryptionKey disk_encryption_key = 271660677; */ - private $disk_encryption_key = null; + protected $disk_encryption_key = null; /** * The size of the disk in base-2 GB. * * Generated from protobuf field optional int64 disk_size_gb = 316263735; */ - private $disk_size_gb = null; + protected $disk_size_gb = null; /** * [Output Only] URL of the disk type resource. For example: projects/project /zones/zone/diskTypes/pd-standard or pd-ssd * * Generated from protobuf field optional string disk_type = 93009052; */ - private $disk_type = null; + protected $disk_type = null; /** * A list of features to enable on the guest operating system. Applicable only for bootable images. Read Enabling guest operating system features to see a list of available options. * @@ -62,20 +62,20 @@ class SavedAttachedDisk extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int32 index = 100346066; */ - private $index = null; + protected $index = null; /** * Specifies the disk interface to use for attaching this disk, which is either SCSI or NVME. * Check the Interface enum for the list of possible values. * * Generated from protobuf field optional string interface = 502623545; */ - private $interface = null; + protected $interface = null; /** * [Output Only] Type of the resource. Always compute#attachedDisk for attached disks. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] Any valid publicly visible licenses. * @@ -88,33 +88,33 @@ class SavedAttachedDisk extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string mode = 3357091; */ - private $mode = null; + protected $mode = null; /** * Specifies a URL of the disk attached to the source instance. * * Generated from protobuf field optional string source = 177235995; */ - private $source = null; + protected $source = null; /** * [Output Only] A size of the storage used by the disk's snapshot by this machine image. * * Generated from protobuf field optional int64 storage_bytes = 424631719; */ - private $storage_bytes = null; + protected $storage_bytes = null; /** * [Output Only] An indicator whether storageBytes is in a stable state or it is being adjusted as a result of shared storage reallocation. This status can either be UPDATING, meaning the size of the snapshot is being updated, or UP_TO_DATE, meaning the size of the snapshot is up-to-date. * Check the StorageBytesStatus enum for the list of possible values. * * Generated from protobuf field optional string storage_bytes_status = 490739082; */ - private $storage_bytes_status = null; + protected $storage_bytes_status = null; /** * Specifies the type of the attached disk, either SCRATCH or PERSISTENT. * Check the Type enum for the list of possible values. * * Generated from protobuf field optional string type = 3575610; */ - private $type = null; + protected $type = null; /** * Constructor. diff --git a/Compute/src/V1/SavedDisk.php b/Compute/src/V1/SavedDisk.php index b4a4880fb7e1..483ecf737ad0 100644 --- a/Compute/src/V1/SavedDisk.php +++ b/Compute/src/V1/SavedDisk.php @@ -21,32 +21,32 @@ class SavedDisk extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string architecture = 302803283; */ - private $architecture = null; + protected $architecture = null; /** * [Output Only] Type of the resource. Always compute#savedDisk for attached disks. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * Specifies a URL of the disk attached to the source instance. * * Generated from protobuf field optional string source_disk = 451753793; */ - private $source_disk = null; + protected $source_disk = null; /** * [Output Only] Size of the individual disk snapshot used by this machine image. * * Generated from protobuf field optional int64 storage_bytes = 424631719; */ - private $storage_bytes = null; + protected $storage_bytes = null; /** * [Output Only] An indicator whether storageBytes is in a stable state or it is being adjusted as a result of shared storage reallocation. This status can either be UPDATING, meaning the size of the snapshot is being updated, or UP_TO_DATE, meaning the size of the snapshot is up-to-date. * Check the StorageBytesStatus enum for the list of possible values. * * Generated from protobuf field optional string storage_bytes_status = 490739082; */ - private $storage_bytes_status = null; + protected $storage_bytes_status = null; /** * Constructor. diff --git a/Compute/src/V1/ScalingScheduleStatus.php b/Compute/src/V1/ScalingScheduleStatus.php index 2f0295349e83..eaceb3778795 100644 --- a/Compute/src/V1/ScalingScheduleStatus.php +++ b/Compute/src/V1/ScalingScheduleStatus.php @@ -19,20 +19,20 @@ class ScalingScheduleStatus extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string last_start_time = 34545107; */ - private $last_start_time = null; + protected $last_start_time = null; /** * [Output Only] The next time the scaling schedule is to become active. Note: this is a timestamp when a schedule is planned to run, but the actual time might be slightly different. The timestamp is in RFC3339 text format. * * Generated from protobuf field optional string next_start_time = 97270102; */ - private $next_start_time = null; + protected $next_start_time = null; /** * [Output Only] The current state of a scaling schedule. * Check the State enum for the list of possible values. * * Generated from protobuf field optional string state = 109757585; */ - private $state = null; + protected $state = null; /** * Constructor. diff --git a/Compute/src/V1/Scheduling.php b/Compute/src/V1/Scheduling.php index 3efda8bfd1f6..432970cdacb7 100644 --- a/Compute/src/V1/Scheduling.php +++ b/Compute/src/V1/Scheduling.php @@ -20,50 +20,50 @@ class Scheduling extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional bool automatic_restart = 350821371; */ - private $automatic_restart = null; + protected $automatic_restart = null; /** * Specifies the availability domain to place the instance in. The value must be a number between 1 and the number of availability domains specified in the spread placement policy attached to the instance. * * Generated from protobuf field optional int32 availability_domain = 252514344; */ - private $availability_domain = null; + protected $availability_domain = null; /** * Specify the time in seconds for host error detection, the value must be within the range of [90, 330] with the increment of 30, if unset, the default behavior of host error recovery will be used. * * Generated from protobuf field optional int32 host_error_timeout_seconds = 408317459; */ - private $host_error_timeout_seconds = null; + protected $host_error_timeout_seconds = null; /** * Specifies the termination action for the instance. * Check the InstanceTerminationAction enum for the list of possible values. * * Generated from protobuf field optional string instance_termination_action = 107380667; */ - private $instance_termination_action = null; + protected $instance_termination_action = null; /** * Specifies the maximum amount of time a Local Ssd Vm should wait while recovery of the Local Ssd state is attempted. Its value should be in between 0 and 168 hours with hour granularity and the default value being 1 hour. * * Generated from protobuf field optional .google.cloud.compute.v1.Duration local_ssd_recovery_timeout = 268015590; */ - private $local_ssd_recovery_timeout = null; + protected $local_ssd_recovery_timeout = null; /** * An opaque location hint used to place the instance close to other resources. This field is for use by internal tools that use the public API. * * Generated from protobuf field optional string location_hint = 350519505; */ - private $location_hint = null; + protected $location_hint = null; /** * Specifies the max run duration for the given instance. If specified, the instance termination action will be performed at the end of the run duration. * * Generated from protobuf field optional .google.cloud.compute.v1.Duration max_run_duration = 430839747; */ - private $max_run_duration = null; + protected $max_run_duration = null; /** * The minimum number of virtual CPUs this instance will consume when running on a sole-tenant node. * * Generated from protobuf field optional int32 min_node_cpus = 317231675; */ - private $min_node_cpus = null; + protected $min_node_cpus = null; /** * A set of node affinity and anti-affinity configurations. Refer to Configuring node affinity for more information. Overrides reservationAffinity. * @@ -76,30 +76,30 @@ class Scheduling extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string on_host_maintenance = 64616796; */ - private $on_host_maintenance = null; + protected $on_host_maintenance = null; /** * Generated from protobuf field optional .google.cloud.compute.v1.SchedulingOnInstanceStopAction on_instance_stop_action = 529876681; */ - private $on_instance_stop_action = null; + protected $on_instance_stop_action = null; /** * Defines whether the instance is preemptible. This can only be set during instance creation or while the instance is stopped and therefore, in a `TERMINATED` state. See Instance Life Cycle for more information on the possible instance states. * * Generated from protobuf field optional bool preemptible = 324203169; */ - private $preemptible = null; + protected $preemptible = null; /** * Specifies the provisioning model of the instance. * Check the ProvisioningModel enum for the list of possible values. * * Generated from protobuf field optional string provisioning_model = 494423; */ - private $provisioning_model = null; + protected $provisioning_model = null; /** * Specifies the timestamp, when the instance will be terminated, in RFC3339 text format. If specified, the instance termination action will be performed at the termination time. * * Generated from protobuf field optional string termination_time = 428082984; */ - private $termination_time = null; + protected $termination_time = null; /** * Constructor. diff --git a/Compute/src/V1/SchedulingNodeAffinity.php b/Compute/src/V1/SchedulingNodeAffinity.php index 2ca0c2aa39e8..c2d90f28a17f 100644 --- a/Compute/src/V1/SchedulingNodeAffinity.php +++ b/Compute/src/V1/SchedulingNodeAffinity.php @@ -20,14 +20,14 @@ class SchedulingNodeAffinity extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string key = 106079; */ - private $key = null; + protected $key = null; /** * Defines the operation of node selection. Valid operators are IN for affinity and NOT_IN for anti-affinity. * Check the Operator enum for the list of possible values. * * Generated from protobuf field optional string operator = 36317348; */ - private $operator = null; + protected $operator = null; /** * Corresponds to the label values of Node resource. * diff --git a/Compute/src/V1/SchedulingOnInstanceStopAction.php b/Compute/src/V1/SchedulingOnInstanceStopAction.php index 419bcf881df8..14119bed879c 100644 --- a/Compute/src/V1/SchedulingOnInstanceStopAction.php +++ b/Compute/src/V1/SchedulingOnInstanceStopAction.php @@ -20,7 +20,7 @@ class SchedulingOnInstanceStopAction extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional bool discard_local_ssd = 319517903; */ - private $discard_local_ssd = null; + protected $discard_local_ssd = null; /** * Constructor. diff --git a/Compute/src/V1/ScratchDisks.php b/Compute/src/V1/ScratchDisks.php deleted file mode 100644 index 91d488ee44ed..000000000000 --- a/Compute/src/V1/ScratchDisks.php +++ /dev/null @@ -1,76 +0,0 @@ -google.cloud.compute.v1.ScratchDisks - */ -class ScratchDisks extends \Google\Protobuf\Internal\Message -{ - /** - * Size of the scratch disk, defined in GB. - * - * Generated from protobuf field optional int32 disk_gb = 60990141; - */ - private $disk_gb = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type int $disk_gb - * Size of the scratch disk, defined in GB. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Compute\V1\Compute::initOnce(); - parent::__construct($data); - } - - /** - * Size of the scratch disk, defined in GB. - * - * Generated from protobuf field optional int32 disk_gb = 60990141; - * @return int - */ - public function getDiskGb() - { - return isset($this->disk_gb) ? $this->disk_gb : 0; - } - - public function hasDiskGb() - { - return isset($this->disk_gb); - } - - public function clearDiskGb() - { - unset($this->disk_gb); - } - - /** - * Size of the scratch disk, defined in GB. - * - * Generated from protobuf field optional int32 disk_gb = 60990141; - * @param int $var - * @return $this - */ - public function setDiskGb($var) - { - GPBUtil::checkInt32($var); - $this->disk_gb = $var; - - return $this; - } - -} - diff --git a/Compute/src/V1/Screenshot.php b/Compute/src/V1/Screenshot.php index af11e9e228d1..c550d1905ed0 100644 --- a/Compute/src/V1/Screenshot.php +++ b/Compute/src/V1/Screenshot.php @@ -20,13 +20,13 @@ class Screenshot extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string contents = 506419994; */ - private $contents = null; + protected $contents = null; /** * [Output Only] Type of the resource. Always compute#screenshot for the screenshots. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * Constructor. diff --git a/Compute/src/V1/SecurityPoliciesAggregatedList.php b/Compute/src/V1/SecurityPoliciesAggregatedList.php index 98a3b5f5b3b6..b9d2ab1d011c 100644 --- a/Compute/src/V1/SecurityPoliciesAggregatedList.php +++ b/Compute/src/V1/SecurityPoliciesAggregatedList.php @@ -17,13 +17,13 @@ class SecurityPoliciesAggregatedList extends \Google\Protobuf\Internal\Message /** * Generated from protobuf field optional string etag = 3123477; */ - private $etag = null; + protected $etag = null; /** * [Output Only] Unique identifier for the resource; defined by the server. * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of SecurityPoliciesScopedList resources. * @@ -35,19 +35,19 @@ class SecurityPoliciesAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Unreachable resources. * @@ -59,7 +59,7 @@ class SecurityPoliciesAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/SecurityPoliciesClient.php b/Compute/src/V1/SecurityPoliciesClient.php deleted file mode 100644 index 9dd1dfdd3f03..000000000000 --- a/Compute/src/V1/SecurityPoliciesClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional .google.cloud.compute.v1.SecurityPoliciesWafConfig preconfigured_expression_sets = 536200826; */ - private $preconfigured_expression_sets = null; + protected $preconfigured_expression_sets = null; /** * Constructor. diff --git a/Compute/src/V1/SecurityPoliciesScopedList.php b/Compute/src/V1/SecurityPoliciesScopedList.php index e8754fbd8f34..d691acd38118 100644 --- a/Compute/src/V1/SecurityPoliciesScopedList.php +++ b/Compute/src/V1/SecurityPoliciesScopedList.php @@ -25,7 +25,7 @@ class SecurityPoliciesScopedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/SecurityPoliciesWafConfig.php b/Compute/src/V1/SecurityPoliciesWafConfig.php index 5ec3a643da37..f907c573499b 100644 --- a/Compute/src/V1/SecurityPoliciesWafConfig.php +++ b/Compute/src/V1/SecurityPoliciesWafConfig.php @@ -17,7 +17,7 @@ class SecurityPoliciesWafConfig extends \Google\Protobuf\Internal\Message /** * Generated from protobuf field optional .google.cloud.compute.v1.PreconfiguredWafSet waf_rules = 74899924; */ - private $waf_rules = null; + protected $waf_rules = null; /** * Constructor. diff --git a/Compute/src/V1/SecurityPolicy.php b/Compute/src/V1/SecurityPolicy.php index 93adb966ca6f..2cf410052234 100644 --- a/Compute/src/V1/SecurityPolicy.php +++ b/Compute/src/V1/SecurityPolicy.php @@ -18,51 +18,51 @@ class SecurityPolicy extends \Google\Protobuf\Internal\Message /** * Generated from protobuf field optional .google.cloud.compute.v1.SecurityPolicyAdaptiveProtectionConfig adaptive_protection_config = 150240735; */ - private $adaptive_protection_config = null; + protected $adaptive_protection_config = null; /** * Generated from protobuf field optional .google.cloud.compute.v1.SecurityPolicyAdvancedOptionsConfig advanced_options_config = 449276352; */ - private $advanced_options_config = null; + protected $advanced_options_config = null; /** * [Output Only] Creation timestamp in RFC3339 text format. * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * Generated from protobuf field optional .google.cloud.compute.v1.SecurityPolicyDdosProtectionConfig ddos_protection_config = 50315853; */ - private $ddos_protection_config = null; + protected $ddos_protection_config = null; /** * An optional description of this resource. Provide this property when you create the resource. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * Specifies a fingerprint for this resource, which is essentially a hash of the metadata's contents and used for optimistic locking. The fingerprint is initially generated by Compute Engine and changes after every request to modify or update metadata. You must always provide an up-to-date fingerprint hash in order to update or change metadata, otherwise the request will fail with error 412 conditionNotMet. To see the latest fingerprint, make get() request to the security policy. * * Generated from protobuf field optional string fingerprint = 234678500; */ - private $fingerprint = null; + protected $fingerprint = null; /** * [Output Only] The unique identifier for the resource. This identifier is defined by the server. * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * [Output only] Type of the resource. Always compute#securityPolicyfor security policies * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * A fingerprint for the labels being applied to this security policy, which is essentially a hash of the labels set used for optimistic locking. The fingerprint is initially generated by Compute Engine and changes after every request to modify or update labels. You must always provide an up-to-date fingerprint hash in order to update or change labels. To see the latest fingerprint, make get() request to the security policy. * * Generated from protobuf field optional string label_fingerprint = 178124825; */ - private $label_fingerprint = null; + protected $label_fingerprint = null; /** * Labels for this resource. These can only be added or modified by the setLabels method. Each label key/value pair must comply with RFC1035. Label values may be empty. * @@ -74,17 +74,17 @@ class SecurityPolicy extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * Generated from protobuf field optional .google.cloud.compute.v1.SecurityPolicyRecaptchaOptionsConfig recaptcha_options_config = 519006811; */ - private $recaptcha_options_config = null; + protected $recaptcha_options_config = null; /** * [Output Only] URL of the region where the regional security policy resides. This field is not applicable to global security policies. * * Generated from protobuf field optional string region = 138946292; */ - private $region = null; + protected $region = null; /** * A list of rules that belong to this policy. There must always be a default rule which is a rule with priority 2147483647 and match all condition (for the match condition this means match "*" for srcIpRanges and for the networkMatch condition every field must be either match "*" or not set). If no rules are provided when creating a security policy, a default rule with action "allow" will be added. * @@ -96,14 +96,14 @@ class SecurityPolicy extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * The type indicates the intended use of the security policy. - CLOUD_ARMOR: Cloud Armor backend security policies can be configured to filter incoming HTTP requests targeting backend services. They filter requests before they hit the origin servers. - CLOUD_ARMOR_EDGE: Cloud Armor edge security policies can be configured to filter incoming HTTP requests targeting backend services (including Cloud CDN-enabled) as well as backend buckets (Cloud Storage). They filter requests before the request is served from Google's cache. - CLOUD_ARMOR_INTERNAL_SERVICE (preview only): Cloud Armor internal service policies can be configured to filter HTTP requests targeting services managed by Traffic Director in a service mesh. They filter requests before the request is served from the application. - CLOUD_ARMOR_NETWORK: Cloud Armor network policies can be configured to filter packets targeting network load balancing resources such as backend services, target pools, target instances, and instances with external IPs. They filter requests before the request is served from the application. This field can be set only at resource creation time. * Check the Type enum for the list of possible values. * * Generated from protobuf field optional string type = 3575610; */ - private $type = null; + protected $type = null; /** * Definitions of user-defined fields for CLOUD_ARMOR_NETWORK policies. A user-defined field consists of up to 4 bytes extracted from a fixed offset in the packet, relative to the IPv4, IPv6, TCP, or UDP header, with an optional mask to select certain bits. Rules may then specify matching values for these fields. Example: userDefinedFields: - name: "ipv4_fragment_offset" base: IPV4 offset: 6 size: 2 mask: "0x1fff" * diff --git a/Compute/src/V1/SecurityPolicyAdaptiveProtectionConfig.php b/Compute/src/V1/SecurityPolicyAdaptiveProtectionConfig.php index 1dfab8803390..db6f5f9942c1 100644 --- a/Compute/src/V1/SecurityPolicyAdaptiveProtectionConfig.php +++ b/Compute/src/V1/SecurityPolicyAdaptiveProtectionConfig.php @@ -20,7 +20,7 @@ class SecurityPolicyAdaptiveProtectionConfig extends \Google\Protobuf\Internal\M * * Generated from protobuf field optional .google.cloud.compute.v1.SecurityPolicyAdaptiveProtectionConfigLayer7DdosDefenseConfig layer7_ddos_defense_config = 437316771; */ - private $layer7_ddos_defense_config = null; + protected $layer7_ddos_defense_config = null; /** * Constructor. diff --git a/Compute/src/V1/SecurityPolicyAdaptiveProtectionConfigLayer7DdosDefenseConfig.php b/Compute/src/V1/SecurityPolicyAdaptiveProtectionConfigLayer7DdosDefenseConfig.php index 7e4a6de85868..7d9d486bbea9 100644 --- a/Compute/src/V1/SecurityPolicyAdaptiveProtectionConfigLayer7DdosDefenseConfig.php +++ b/Compute/src/V1/SecurityPolicyAdaptiveProtectionConfigLayer7DdosDefenseConfig.php @@ -20,14 +20,14 @@ class SecurityPolicyAdaptiveProtectionConfigLayer7DdosDefenseConfig extends \Goo * * Generated from protobuf field optional bool enable = 311764355; */ - private $enable = null; + protected $enable = null; /** * Rule visibility can be one of the following: STANDARD - opaque rules. (default) PREMIUM - transparent rules. This field is only supported in Global Security Policies of type CLOUD_ARMOR. * Check the RuleVisibility enum for the list of possible values. * * Generated from protobuf field optional string rule_visibility = 453258293; */ - private $rule_visibility = null; + protected $rule_visibility = null; /** * Configuration options for layer7 adaptive protection for various customizable thresholds. * diff --git a/Compute/src/V1/SecurityPolicyAdaptiveProtectionConfigLayer7DdosDefenseConfigThresholdConfig.php b/Compute/src/V1/SecurityPolicyAdaptiveProtectionConfigLayer7DdosDefenseConfigThresholdConfig.php index 7cf8da270530..cce05ed043c7 100644 --- a/Compute/src/V1/SecurityPolicyAdaptiveProtectionConfigLayer7DdosDefenseConfigThresholdConfig.php +++ b/Compute/src/V1/SecurityPolicyAdaptiveProtectionConfigLayer7DdosDefenseConfigThresholdConfig.php @@ -17,37 +17,37 @@ class SecurityPolicyAdaptiveProtectionConfigLayer7DdosDefenseConfigThresholdConf /** * Generated from protobuf field optional float auto_deploy_confidence_threshold = 84309694; */ - private $auto_deploy_confidence_threshold = null; + protected $auto_deploy_confidence_threshold = null; /** * Generated from protobuf field optional int32 auto_deploy_expiration_sec = 69638793; */ - private $auto_deploy_expiration_sec = null; + protected $auto_deploy_expiration_sec = null; /** * Generated from protobuf field optional float auto_deploy_impacted_baseline_threshold = 292441667; */ - private $auto_deploy_impacted_baseline_threshold = null; + protected $auto_deploy_impacted_baseline_threshold = null; /** * Generated from protobuf field optional float auto_deploy_load_threshold = 522227738; */ - private $auto_deploy_load_threshold = null; + protected $auto_deploy_load_threshold = null; /** * Generated from protobuf field optional float detection_absolute_qps = 383123174; */ - private $detection_absolute_qps = null; + protected $detection_absolute_qps = null; /** * Generated from protobuf field optional float detection_load_threshold = 430499148; */ - private $detection_load_threshold = null; + protected $detection_load_threshold = null; /** * Generated from protobuf field optional float detection_relative_to_baseline_qps = 291343749; */ - private $detection_relative_to_baseline_qps = null; + protected $detection_relative_to_baseline_qps = null; /** * The name must be 1-63 characters long, and comply with RFC1035. The name must be unique within the security policy. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * Configuration options for enabling Adaptive Protection to operate on specified granular traffic units. * diff --git a/Compute/src/V1/SecurityPolicyAdaptiveProtectionConfigLayer7DdosDefenseConfigThresholdConfigTrafficGranularityConfig.php b/Compute/src/V1/SecurityPolicyAdaptiveProtectionConfigLayer7DdosDefenseConfigThresholdConfigTrafficGranularityConfig.php index 5899c77e3ba8..8947196b7054 100644 --- a/Compute/src/V1/SecurityPolicyAdaptiveProtectionConfigLayer7DdosDefenseConfigThresholdConfigTrafficGranularityConfig.php +++ b/Compute/src/V1/SecurityPolicyAdaptiveProtectionConfigLayer7DdosDefenseConfigThresholdConfigTrafficGranularityConfig.php @@ -20,20 +20,20 @@ class SecurityPolicyAdaptiveProtectionConfigLayer7DdosDefenseConfigThresholdConf * * Generated from protobuf field optional bool enable_each_unique_value = 469206341; */ - private $enable_each_unique_value = null; + protected $enable_each_unique_value = null; /** * Type of this configuration. * Check the Type enum for the list of possible values. * * Generated from protobuf field optional string type = 3575610; */ - private $type = null; + protected $type = null; /** * Requests that match this value constitute a granular traffic unit. * * Generated from protobuf field optional string value = 111972721; */ - private $value = null; + protected $value = null; /** * Constructor. diff --git a/Compute/src/V1/SecurityPolicyAdvancedOptionsConfig.php b/Compute/src/V1/SecurityPolicyAdvancedOptionsConfig.php index 7e439bbe3e60..1bd27459e69d 100644 --- a/Compute/src/V1/SecurityPolicyAdvancedOptionsConfig.php +++ b/Compute/src/V1/SecurityPolicyAdvancedOptionsConfig.php @@ -19,21 +19,21 @@ class SecurityPolicyAdvancedOptionsConfig extends \Google\Protobuf\Internal\Mess * * Generated from protobuf field optional .google.cloud.compute.v1.SecurityPolicyAdvancedOptionsConfigJsonCustomConfig json_custom_config = 111570105; */ - private $json_custom_config = null; + protected $json_custom_config = null; /** * * Check the JsonParsing enum for the list of possible values. * * Generated from protobuf field optional string json_parsing = 282493529; */ - private $json_parsing = null; + protected $json_parsing = null; /** * * Check the LogLevel enum for the list of possible values. * * Generated from protobuf field optional string log_level = 140582601; */ - private $log_level = null; + protected $log_level = null; /** * An optional list of case-insensitive request header names to use for resolving the callers client IP address. * diff --git a/Compute/src/V1/SecurityPolicyDdosProtectionConfig.php b/Compute/src/V1/SecurityPolicyDdosProtectionConfig.php index abb9493aeef4..811b17ae7d7f 100644 --- a/Compute/src/V1/SecurityPolicyDdosProtectionConfig.php +++ b/Compute/src/V1/SecurityPolicyDdosProtectionConfig.php @@ -20,7 +20,7 @@ class SecurityPolicyDdosProtectionConfig extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field optional string ddos_protection = 275173268; */ - private $ddos_protection = null; + protected $ddos_protection = null; /** * Constructor. diff --git a/Compute/src/V1/SecurityPolicyList.php b/Compute/src/V1/SecurityPolicyList.php index 91024497a948..6c222a7fedbb 100644 --- a/Compute/src/V1/SecurityPolicyList.php +++ b/Compute/src/V1/SecurityPolicyList.php @@ -19,7 +19,7 @@ class SecurityPolicyList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of SecurityPolicy resources. * @@ -31,19 +31,19 @@ class SecurityPolicyList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/SecurityPolicyRecaptchaOptionsConfig.php b/Compute/src/V1/SecurityPolicyRecaptchaOptionsConfig.php index 68e07227cdd1..cabdf36e0dfd 100644 --- a/Compute/src/V1/SecurityPolicyRecaptchaOptionsConfig.php +++ b/Compute/src/V1/SecurityPolicyRecaptchaOptionsConfig.php @@ -19,7 +19,7 @@ class SecurityPolicyRecaptchaOptionsConfig extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field optional string redirect_site_key = 447677034; */ - private $redirect_site_key = null; + protected $redirect_site_key = null; /** * Constructor. diff --git a/Compute/src/V1/SecurityPolicyReference.php b/Compute/src/V1/SecurityPolicyReference.php index 6890dfdf1734..dbc7f5c38fa1 100644 --- a/Compute/src/V1/SecurityPolicyReference.php +++ b/Compute/src/V1/SecurityPolicyReference.php @@ -17,7 +17,7 @@ class SecurityPolicyReference extends \Google\Protobuf\Internal\Message /** * Generated from protobuf field optional string security_policy = 171082513; */ - private $security_policy = null; + protected $security_policy = null; /** * Constructor. diff --git a/Compute/src/V1/SecurityPolicyRule.php b/Compute/src/V1/SecurityPolicyRule.php index 7dc54dc9b97e..c63605d7a027 100644 --- a/Compute/src/V1/SecurityPolicyRule.php +++ b/Compute/src/V1/SecurityPolicyRule.php @@ -20,67 +20,67 @@ class SecurityPolicyRule extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string action = 187661878; */ - private $action = null; + protected $action = null; /** * An optional description of this resource. Provide this property when you create the resource. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * Optional, additional actions that are performed on headers. This field is only supported in Global Security Policies of type CLOUD_ARMOR. * * Generated from protobuf field optional .google.cloud.compute.v1.SecurityPolicyRuleHttpHeaderAction header_action = 328077352; */ - private $header_action = null; + protected $header_action = null; /** * [Output only] Type of the resource. Always compute#securityPolicyRule for security policy rules * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * A match condition that incoming traffic is evaluated against. If it evaluates to true, the corresponding 'action' is enforced. * * Generated from protobuf field optional .google.cloud.compute.v1.SecurityPolicyRuleMatcher match = 103668165; */ - private $match = null; + protected $match = null; /** * A match condition that incoming packets are evaluated against for CLOUD_ARMOR_NETWORK security policies. If it matches, the corresponding 'action' is enforced. The match criteria for a rule consists of built-in match fields (like 'srcIpRanges') and potentially multiple user-defined match fields ('userDefinedFields'). Field values may be extracted directly from the packet or derived from it (e.g. 'srcRegionCodes'). Some fields may not be present in every packet (e.g. 'srcPorts'). A user-defined field is only present if the base header is found in the packet and the entire field is in bounds. Each match field may specify which values can match it, listing one or more ranges, prefixes, or exact values that are considered a match for the field. A field value must be present in order to match a specified match field. If no match values are specified for a match field, then any field value is considered to match it, and it's not required to be present. For strings specifying '*' is also equivalent to match all. For a packet to match a rule, all specified match fields must match the corresponding field values derived from the packet. Example: networkMatch: srcIpRanges: - "192.0.2.0/24" - "198.51.100.0/24" userDefinedFields: - name: "ipv4_fragment_offset" values: - "1-0x1fff" The above match condition matches packets with a source IP in 192.0.2.0/24 or 198.51.100.0/24 and a user-defined field named "ipv4_fragment_offset" with a value between 1 and 0x1fff inclusive. * * Generated from protobuf field optional .google.cloud.compute.v1.SecurityPolicyRuleNetworkMatcher network_match = 463387764; */ - private $network_match = null; + protected $network_match = null; /** * Preconfigured WAF configuration to be applied for the rule. If the rule does not evaluate preconfigured WAF rules, i.e., if evaluatePreconfiguredWaf() is not used, this field will have no effect. * * Generated from protobuf field optional .google.cloud.compute.v1.SecurityPolicyRulePreconfiguredWafConfig preconfigured_waf_config = 117805027; */ - private $preconfigured_waf_config = null; + protected $preconfigured_waf_config = null; /** * If set to true, the specified action is not enforced. * * Generated from protobuf field optional bool preview = 218686408; */ - private $preview = null; + protected $preview = null; /** * An integer indicating the priority of a rule in the list. The priority must be a positive value between 0 and 2147483647. Rules are evaluated from highest to lowest priority where 0 is the highest priority and 2147483647 is the lowest priority. * * Generated from protobuf field optional int32 priority = 445151652; */ - private $priority = null; + protected $priority = null; /** * Must be specified if the action is "rate_based_ban" or "throttle" or "fairshare". Cannot be specified for any other actions. * * Generated from protobuf field optional .google.cloud.compute.v1.SecurityPolicyRuleRateLimitOptions rate_limit_options = 67544315; */ - private $rate_limit_options = null; + protected $rate_limit_options = null; /** * Parameters defining the redirect action. Cannot be specified for any other actions. This field is only supported in Global Security Policies of type CLOUD_ARMOR. * * Generated from protobuf field optional .google.cloud.compute.v1.SecurityPolicyRuleRedirectOptions redirect_options = 163285307; */ - private $redirect_options = null; + protected $redirect_options = null; /** * Constructor. diff --git a/Compute/src/V1/SecurityPolicyRuleHttpHeaderActionHttpHeaderOption.php b/Compute/src/V1/SecurityPolicyRuleHttpHeaderActionHttpHeaderOption.php index 4ca22d7f5e7f..cb5dc22a39e1 100644 --- a/Compute/src/V1/SecurityPolicyRuleHttpHeaderActionHttpHeaderOption.php +++ b/Compute/src/V1/SecurityPolicyRuleHttpHeaderActionHttpHeaderOption.php @@ -19,13 +19,13 @@ class SecurityPolicyRuleHttpHeaderActionHttpHeaderOption extends \Google\Protobu * * Generated from protobuf field optional string header_name = 110223613; */ - private $header_name = null; + protected $header_name = null; /** * The value to set the named header to. * * Generated from protobuf field optional string header_value = 203094335; */ - private $header_value = null; + protected $header_value = null; /** * Constructor. diff --git a/Compute/src/V1/SecurityPolicyRuleMatcher.php b/Compute/src/V1/SecurityPolicyRuleMatcher.php index df2e465417f9..d1639085fe6e 100644 --- a/Compute/src/V1/SecurityPolicyRuleMatcher.php +++ b/Compute/src/V1/SecurityPolicyRuleMatcher.php @@ -20,26 +20,26 @@ class SecurityPolicyRuleMatcher extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.SecurityPolicyRuleMatcherConfig config = 255820610; */ - private $config = null; + protected $config = null; /** * User defined CEVAL expression. A CEVAL expression is used to specify match criteria such as origin.ip, source.region_code and contents in the request header. Expressions containing `evaluateThreatIntelligence` require Cloud Armor Managed Protection Plus tier and are not supported in Edge Policies nor in Regional Policies. Expressions containing `evaluatePreconfiguredExpr('sourceiplist-*')` require Cloud Armor Managed Protection Plus tier and are only supported in Global Security Policies. * * Generated from protobuf field optional .google.cloud.compute.v1.Expr expr = 3127797; */ - private $expr = null; + protected $expr = null; /** * The configuration options available when specifying a user defined CEVAL expression (i.e., 'expr'). * * Generated from protobuf field optional .google.cloud.compute.v1.SecurityPolicyRuleMatcherExprOptions expr_options = 486220372; */ - private $expr_options = null; + protected $expr_options = null; /** * Preconfigured versioned expression. If this field is specified, config must also be specified. Available preconfigured expressions along with their requirements are: SRC_IPS_V1 - must specify the corresponding src_ip_range field in config. * Check the VersionedExpr enum for the list of possible values. * * Generated from protobuf field optional string versioned_expr = 322286013; */ - private $versioned_expr = null; + protected $versioned_expr = null; /** * Constructor. diff --git a/Compute/src/V1/SecurityPolicyRuleMatcherExprOptions.php b/Compute/src/V1/SecurityPolicyRuleMatcherExprOptions.php index 379a466ddfcc..69b6f559dc29 100644 --- a/Compute/src/V1/SecurityPolicyRuleMatcherExprOptions.php +++ b/Compute/src/V1/SecurityPolicyRuleMatcherExprOptions.php @@ -19,7 +19,7 @@ class SecurityPolicyRuleMatcherExprOptions extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field optional .google.cloud.compute.v1.SecurityPolicyRuleMatcherExprOptionsRecaptchaOptions recaptcha_options = 389151558; */ - private $recaptcha_options = null; + protected $recaptcha_options = null; /** * Constructor. diff --git a/Compute/src/V1/SecurityPolicyRuleNetworkMatcherUserDefinedFieldMatch.php b/Compute/src/V1/SecurityPolicyRuleNetworkMatcherUserDefinedFieldMatch.php index 1740278c6628..ca6cc8bbc5e1 100644 --- a/Compute/src/V1/SecurityPolicyRuleNetworkMatcherUserDefinedFieldMatch.php +++ b/Compute/src/V1/SecurityPolicyRuleNetworkMatcherUserDefinedFieldMatch.php @@ -19,7 +19,7 @@ class SecurityPolicyRuleNetworkMatcherUserDefinedFieldMatch extends \Google\Prot * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * Matching values of the field. Each element can be a 32-bit unsigned decimal or hexadecimal (starting with "0x") number (e.g. "64") or range (e.g. "0x400-0x7ff"). * diff --git a/Compute/src/V1/SecurityPolicyRulePreconfiguredWafConfigExclusion.php b/Compute/src/V1/SecurityPolicyRulePreconfiguredWafConfigExclusion.php index 2936ce051c3c..6a53832d7064 100644 --- a/Compute/src/V1/SecurityPolicyRulePreconfiguredWafConfigExclusion.php +++ b/Compute/src/V1/SecurityPolicyRulePreconfiguredWafConfigExclusion.php @@ -49,7 +49,7 @@ class SecurityPolicyRulePreconfiguredWafConfigExclusion extends \Google\Protobuf * * Generated from protobuf field optional string target_rule_set = 498440077; */ - private $target_rule_set = null; + protected $target_rule_set = null; /** * Constructor. diff --git a/Compute/src/V1/SecurityPolicyRulePreconfiguredWafConfigExclusionFieldParams.php b/Compute/src/V1/SecurityPolicyRulePreconfiguredWafConfigExclusionFieldParams.php index 37e997bc0de1..fad7028f3c24 100644 --- a/Compute/src/V1/SecurityPolicyRulePreconfiguredWafConfigExclusionFieldParams.php +++ b/Compute/src/V1/SecurityPolicyRulePreconfiguredWafConfigExclusionFieldParams.php @@ -20,13 +20,13 @@ class SecurityPolicyRulePreconfiguredWafConfigExclusionFieldParams extends \Goog * * Generated from protobuf field optional string op = 3553; */ - private $op = null; + protected $op = null; /** * The value of the field. * * Generated from protobuf field optional string val = 116513; */ - private $val = null; + protected $val = null; /** * Constructor. diff --git a/Compute/src/V1/SecurityPolicyRuleRateLimitOptions.php b/Compute/src/V1/SecurityPolicyRuleRateLimitOptions.php index 69582b92e4da..e584fcf89ce2 100644 --- a/Compute/src/V1/SecurityPolicyRuleRateLimitOptions.php +++ b/Compute/src/V1/SecurityPolicyRuleRateLimitOptions.php @@ -19,26 +19,26 @@ class SecurityPolicyRuleRateLimitOptions extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field optional int32 ban_duration_sec = 42896726; */ - private $ban_duration_sec = null; + protected $ban_duration_sec = null; /** * Can only be specified if the action for the rule is "rate_based_ban". If specified, the key will be banned for the configured 'ban_duration_sec' when the number of requests that exceed the 'rate_limit_threshold' also exceed this 'ban_threshold'. * * Generated from protobuf field optional .google.cloud.compute.v1.SecurityPolicyRuleRateLimitOptionsThreshold ban_threshold = 501208123; */ - private $ban_threshold = null; + protected $ban_threshold = null; /** * Action to take for requests that are under the configured rate limit threshold. Valid option is "allow" only. * * Generated from protobuf field optional string conform_action = 517612367; */ - private $conform_action = null; + protected $conform_action = null; /** * Determines the key to enforce the rate_limit_threshold on. Possible values are: - ALL: A single rate limit threshold is applied to all the requests matching this rule. This is the default value if "enforceOnKey" is not configured. - IP: The source IP address of the request is the key. Each IP has this limit enforced separately. - HTTP_HEADER: The value of the HTTP header whose name is configured under "enforceOnKeyName". The key value is truncated to the first 128 bytes of the header value. If no such header is present in the request, the key type defaults to ALL. - XFF_IP: The first IP address (i.e. the originating client IP address) specified in the list of IPs under X-Forwarded-For HTTP header. If no such header is present or the value is not a valid IP, the key defaults to the source IP address of the request i.e. key type IP. - HTTP_COOKIE: The value of the HTTP cookie whose name is configured under "enforceOnKeyName". The key value is truncated to the first 128 bytes of the cookie value. If no such cookie is present in the request, the key type defaults to ALL. - HTTP_PATH: The URL path of the HTTP request. The key value is truncated to the first 128 bytes. - SNI: Server name indication in the TLS session of the HTTPS request. The key value is truncated to the first 128 bytes. The key type defaults to ALL on a HTTP session. - REGION_CODE: The country/region from which the request originates. - TLS_JA3_FINGERPRINT: JA3 TLS/SSL fingerprint if the client connects using HTTPS, HTTP/2 or HTTP/3. If not available, the key type defaults to ALL. - USER_IP: The IP address of the originating client, which is resolved based on "userIpRequestHeaders" configured with the security policy. If there is no "userIpRequestHeaders" configuration or an IP address cannot be resolved from it, the key type defaults to IP. - TLS_JA4_FINGERPRINT: JA4 TLS/SSL fingerprint if the client connects using HTTPS, HTTP/2 or HTTP/3. If not available, the key type defaults to ALL. For "fairshare" action, this value is limited to ALL i.e. a single rate limit threshold is enforced for all the requests matching the rule. * Check the EnforceOnKey enum for the list of possible values. * * Generated from protobuf field optional string enforce_on_key = 416648956; */ - private $enforce_on_key = null; + protected $enforce_on_key = null; /** * If specified, any combination of values of enforce_on_key_type/enforce_on_key_name is treated as the key on which ratelimit threshold/action is enforced. You can specify up to 3 enforce_on_key_configs. If enforce_on_key_configs is specified, enforce_on_key must not be specified. * @@ -50,25 +50,25 @@ class SecurityPolicyRuleRateLimitOptions extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field optional string enforce_on_key_name = 132555246; */ - private $enforce_on_key_name = null; + protected $enforce_on_key_name = null; /** * Action to take for requests that are above the configured rate limit threshold, to either deny with a specified HTTP response code, or redirect to a different endpoint. Valid options are `deny(STATUS)`, where valid values for `STATUS` are 403, 404, 429, and 502, and `redirect`, where the redirect parameters come from `exceedRedirectOptions` below. The `redirect` action is only supported in Global Security Policies of type CLOUD_ARMOR. * * Generated from protobuf field optional string exceed_action = 167159073; */ - private $exceed_action = null; + protected $exceed_action = null; /** * Parameters defining the redirect action that is used as the exceed action. Cannot be specified if the exceed action is not redirect. This field is only supported in Global Security Policies of type CLOUD_ARMOR. * * Generated from protobuf field optional .google.cloud.compute.v1.SecurityPolicyRuleRedirectOptions exceed_redirect_options = 473646694; */ - private $exceed_redirect_options = null; + protected $exceed_redirect_options = null; /** * Threshold at which to begin ratelimiting. * * Generated from protobuf field optional .google.cloud.compute.v1.SecurityPolicyRuleRateLimitOptionsThreshold rate_limit_threshold = 315875208; */ - private $rate_limit_threshold = null; + protected $rate_limit_threshold = null; /** * Constructor. diff --git a/Compute/src/V1/SecurityPolicyRuleRateLimitOptionsEnforceOnKeyConfig.php b/Compute/src/V1/SecurityPolicyRuleRateLimitOptionsEnforceOnKeyConfig.php index 4d835d5d65ae..72ddeebad557 100644 --- a/Compute/src/V1/SecurityPolicyRuleRateLimitOptionsEnforceOnKeyConfig.php +++ b/Compute/src/V1/SecurityPolicyRuleRateLimitOptionsEnforceOnKeyConfig.php @@ -19,14 +19,14 @@ class SecurityPolicyRuleRateLimitOptionsEnforceOnKeyConfig extends \Google\Proto * * Generated from protobuf field optional string enforce_on_key_name = 132555246; */ - private $enforce_on_key_name = null; + protected $enforce_on_key_name = null; /** * Determines the key to enforce the rate_limit_threshold on. Possible values are: - ALL: A single rate limit threshold is applied to all the requests matching this rule. This is the default value if "enforceOnKeyConfigs" is not configured. - IP: The source IP address of the request is the key. Each IP has this limit enforced separately. - HTTP_HEADER: The value of the HTTP header whose name is configured under "enforceOnKeyName". The key value is truncated to the first 128 bytes of the header value. If no such header is present in the request, the key type defaults to ALL. - XFF_IP: The first IP address (i.e. the originating client IP address) specified in the list of IPs under X-Forwarded-For HTTP header. If no such header is present or the value is not a valid IP, the key defaults to the source IP address of the request i.e. key type IP. - HTTP_COOKIE: The value of the HTTP cookie whose name is configured under "enforceOnKeyName". The key value is truncated to the first 128 bytes of the cookie value. If no such cookie is present in the request, the key type defaults to ALL. - HTTP_PATH: The URL path of the HTTP request. The key value is truncated to the first 128 bytes. - SNI: Server name indication in the TLS session of the HTTPS request. The key value is truncated to the first 128 bytes. The key type defaults to ALL on a HTTP session. - REGION_CODE: The country/region from which the request originates. - TLS_JA3_FINGERPRINT: JA3 TLS/SSL fingerprint if the client connects using HTTPS, HTTP/2 or HTTP/3. If not available, the key type defaults to ALL. - USER_IP: The IP address of the originating client, which is resolved based on "userIpRequestHeaders" configured with the security policy. If there is no "userIpRequestHeaders" configuration or an IP address cannot be resolved from it, the key type defaults to IP. - TLS_JA4_FINGERPRINT: JA4 TLS/SSL fingerprint if the client connects using HTTPS, HTTP/2 or HTTP/3. If not available, the key type defaults to ALL. * Check the EnforceOnKeyType enum for the list of possible values. * * Generated from protobuf field optional string enforce_on_key_type = 132757149; */ - private $enforce_on_key_type = null; + protected $enforce_on_key_type = null; /** * Constructor. diff --git a/Compute/src/V1/SecurityPolicyRuleRateLimitOptionsThreshold.php b/Compute/src/V1/SecurityPolicyRuleRateLimitOptionsThreshold.php index e4e471ddc096..c2b48ad7c3eb 100644 --- a/Compute/src/V1/SecurityPolicyRuleRateLimitOptionsThreshold.php +++ b/Compute/src/V1/SecurityPolicyRuleRateLimitOptionsThreshold.php @@ -19,13 +19,13 @@ class SecurityPolicyRuleRateLimitOptionsThreshold extends \Google\Protobuf\Inter * * Generated from protobuf field optional int32 count = 94851343; */ - private $count = null; + protected $count = null; /** * Interval over which the threshold is computed. * * Generated from protobuf field optional int32 interval_sec = 41084375; */ - private $interval_sec = null; + protected $interval_sec = null; /** * Constructor. diff --git a/Compute/src/V1/SecurityPolicyRuleRedirectOptions.php b/Compute/src/V1/SecurityPolicyRuleRedirectOptions.php index 6cb330f19fc9..74796af6ad6f 100644 --- a/Compute/src/V1/SecurityPolicyRuleRedirectOptions.php +++ b/Compute/src/V1/SecurityPolicyRuleRedirectOptions.php @@ -19,14 +19,14 @@ class SecurityPolicyRuleRedirectOptions extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field optional string target = 192835985; */ - private $target = null; + protected $target = null; /** * Type of the redirect action. Possible values are: - GOOGLE_RECAPTCHA: redirect to reCAPTCHA for manual challenge assessment. - EXTERNAL_302: redirect to a different URL via a 302 response. * Check the Type enum for the list of possible values. * * Generated from protobuf field optional string type = 3575610; */ - private $type = null; + protected $type = null; /** * Constructor. diff --git a/Compute/src/V1/SecurityPolicyUserDefinedField.php b/Compute/src/V1/SecurityPolicyUserDefinedField.php index 993c8eee50e2..bd6936b44472 100644 --- a/Compute/src/V1/SecurityPolicyUserDefinedField.php +++ b/Compute/src/V1/SecurityPolicyUserDefinedField.php @@ -20,31 +20,31 @@ class SecurityPolicyUserDefinedField extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string base = 3016401; */ - private $base = null; + protected $base = null; /** * If specified, apply this mask (bitwise AND) to the field to ignore bits before matching. Encoded as a hexadecimal number (starting with "0x"). The last byte of the field (in network byte order) corresponds to the least significant byte of the mask. * * Generated from protobuf field optional string mask = 3344108; */ - private $mask = null; + protected $mask = null; /** * The name of this field. Must be unique within the policy. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * Offset of the first byte of the field (in network byte order) relative to 'base'. * * Generated from protobuf field optional int32 offset = 53961875; */ - private $offset = null; + protected $offset = null; /** * Size of the field in bytes. Valid values: 1-4. * * Generated from protobuf field optional int32 size = 3530753; */ - private $size = null; + protected $size = null; /** * Constructor. diff --git a/Compute/src/V1/SecuritySettings.php b/Compute/src/V1/SecuritySettings.php index 5de76093e907..29cd7c3a1246 100644 --- a/Compute/src/V1/SecuritySettings.php +++ b/Compute/src/V1/SecuritySettings.php @@ -20,13 +20,13 @@ class SecuritySettings extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.AWSV4Signature aws_v4_authentication = 433993111; */ - private $aws_v4_authentication = null; + protected $aws_v4_authentication = null; /** * Optional. A URL referring to a networksecurity.ClientTlsPolicy resource that describes how clients should authenticate with this service's backends. clientTlsPolicy only applies to a global BackendService with the loadBalancingScheme set to INTERNAL_SELF_MANAGED. If left blank, communications are not encrypted. * * Generated from protobuf field optional string client_tls_policy = 462325226; */ - private $client_tls_policy = null; + protected $client_tls_policy = null; /** * Optional. A list of Subject Alternative Names (SANs) that the client verifies during a mutual TLS handshake with an server/endpoint for this BackendService. When the server presents its X.509 certificate to the client, the client inspects the certificate's subjectAltName field. If the field contains one of the specified values, the communication continues. Otherwise, it fails. This additional check enables the client to verify that the server is authorized to run the requested service. Note that the contents of the server certificate's subjectAltName field are configured by the Public Key Infrastructure which provisions server identities. Only applies to a global BackendService with loadBalancingScheme set to INTERNAL_SELF_MANAGED. Only applies when BackendService has an attached clientTlsPolicy with clientCertificate (mTLS mode). * diff --git a/Compute/src/V1/SendDiagnosticInterruptInstanceRequest.php b/Compute/src/V1/SendDiagnosticInterruptInstanceRequest.php index 574e6fae624a..73a72b9930ec 100644 --- a/Compute/src/V1/SendDiagnosticInterruptInstanceRequest.php +++ b/Compute/src/V1/SendDiagnosticInterruptInstanceRequest.php @@ -20,19 +20,19 @@ class SendDiagnosticInterruptInstanceRequest extends \Google\Protobuf\Internal\M * * Generated from protobuf field string instance = 18257045 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance = ''; + protected $instance = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SerialPortOutput.php b/Compute/src/V1/SerialPortOutput.php index 225604d266ea..1a97f6aab3d5 100644 --- a/Compute/src/V1/SerialPortOutput.php +++ b/Compute/src/V1/SerialPortOutput.php @@ -20,31 +20,31 @@ class SerialPortOutput extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string contents = 506419994; */ - private $contents = null; + protected $contents = null; /** * [Output Only] Type of the resource. Always compute#serialPortOutput for serial port output. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] The position of the next byte of content, regardless of whether the content exists, following the output returned in the `contents` property. Use this value in the next request as the start parameter. * * Generated from protobuf field optional int64 next = 3377907; */ - private $next = null; + protected $next = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * The starting byte position of the output that was returned. This should match the start parameter sent with the request. If the serial console output exceeds the size of the buffer (1 MB), older output is overwritten by newer content. The output start value will indicate the byte position of the output that was returned, which might be different than the `start` value that was specified in the request. * * Generated from protobuf field optional int64 start = 109757538; */ - private $start = null; + protected $start = null; /** * Constructor. diff --git a/Compute/src/V1/ServerBinding.php b/Compute/src/V1/ServerBinding.php index 1fea34989c6c..0f2143865e87 100644 --- a/Compute/src/V1/ServerBinding.php +++ b/Compute/src/V1/ServerBinding.php @@ -20,7 +20,7 @@ class ServerBinding extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string type = 3575610; */ - private $type = null; + protected $type = null; /** * Constructor. diff --git a/Compute/src/V1/ServiceAccount.php b/Compute/src/V1/ServiceAccount.php index 3d3e30918ef2..545940b13b72 100644 --- a/Compute/src/V1/ServiceAccount.php +++ b/Compute/src/V1/ServiceAccount.php @@ -20,7 +20,7 @@ class ServiceAccount extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string email = 96619420; */ - private $email = null; + protected $email = null; /** * The list of scopes to be made available for this service account. * diff --git a/Compute/src/V1/ServiceAttachment.php b/Compute/src/V1/ServiceAttachment.php index 218921064c63..7caab9925f5b 100644 --- a/Compute/src/V1/ServiceAttachment.php +++ b/Compute/src/V1/ServiceAttachment.php @@ -27,7 +27,7 @@ class ServiceAttachment extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string connection_preference = 285818076; */ - private $connection_preference = null; + protected $connection_preference = null; /** * Specifies which consumer projects or networks are allowed to connect to the service attachment. Each project or network has a connection limit. A given service attachment can manage connections at either the project or network level. Therefore, both the accept and reject lists for a given service attachment must contain either only projects or only networks or only endpoints. * @@ -45,13 +45,13 @@ class ServiceAttachment extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * An optional description of this resource. Provide this property when you create the resource. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * If specified, the domain name will be used during the integration between the PSC connected endpoints and the Cloud DNS. For example, this is a valid domain name: "p.mycompany.com.". Current max number of domain names supported is 1. * @@ -63,25 +63,25 @@ class ServiceAttachment extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional bool enable_proxy_protocol = 363791237; */ - private $enable_proxy_protocol = null; + protected $enable_proxy_protocol = null; /** * Fingerprint of this resource. A hash of the contents stored in this object. This field is used in optimistic locking. This field will be ignored when inserting a ServiceAttachment. An up-to-date fingerprint must be provided in order to patch/update the ServiceAttachment; otherwise, the request will fail with error 412 conditionNotMet. To see the latest fingerprint, make a get() request to retrieve the ServiceAttachment. * * Generated from protobuf field optional string fingerprint = 234678500; */ - private $fingerprint = null; + protected $fingerprint = null; /** * [Output Only] The unique identifier for the resource type. The server generates this identifier. * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * [Output Only] Type of the resource. Always compute#serviceAttachment for service attachments. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * Metadata of the service attachment. * @@ -93,7 +93,7 @@ class ServiceAttachment extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * An array of URLs where each entry is the URL of a subnet provided by the service producer to use for NAT in this service attachment. * @@ -105,43 +105,43 @@ class ServiceAttachment extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string producer_forwarding_rule = 247927889; */ - private $producer_forwarding_rule = null; + protected $producer_forwarding_rule = null; /** * The number of consumer spokes that connected Private Service Connect endpoints can be propagated to through Network Connectivity Center. This limit lets the service producer limit how many propagated Private Service Connect connections can be established to this service attachment from a single consumer. If the connection preference of the service attachment is ACCEPT_MANUAL, the limit applies to each project or network that is listed in the consumer accept list. If the connection preference of the service attachment is ACCEPT_AUTOMATIC, the limit applies to each project that contains a connected endpoint. If unspecified, the default propagated connection limit is 250. * * Generated from protobuf field optional uint32 propagated_connection_limit = 332719230; */ - private $propagated_connection_limit = null; + protected $propagated_connection_limit = null; /** * [Output Only] An 128-bit global unique ID of the PSC service attachment. * * Generated from protobuf field optional .google.cloud.compute.v1.Uint128 psc_service_attachment_id = 527695214; */ - private $psc_service_attachment_id = null; + protected $psc_service_attachment_id = null; /** * This flag determines whether a consumer accept/reject list change can reconcile the statuses of existing ACCEPTED or REJECTED PSC endpoints. - If false, connection policy update will only affect existing PENDING PSC endpoints. Existing ACCEPTED/REJECTED endpoints will remain untouched regardless how the connection policy is modified . - If true, update will affect both PENDING and ACCEPTED/REJECTED PSC endpoints. For example, an ACCEPTED PSC endpoint will be moved to REJECTED if its project is added to the reject list. For newly created service attachment, this boolean defaults to false. * * Generated from protobuf field optional bool reconcile_connections = 125493732; */ - private $reconcile_connections = null; + protected $reconcile_connections = null; /** * [Output Only] URL of the region where the service attachment resides. This field applies only to the region resource. You must specify this field as part of the HTTP request URL. It is not settable as a field in the request body. * * Generated from protobuf field optional string region = 138946292; */ - private $region = null; + protected $region = null; /** * [Output Only] Server-defined URL for the resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * The URL of a service serving the endpoint identified by this service attachment. * * Generated from protobuf field optional string target_service = 1293831; */ - private $target_service = null; + protected $target_service = null; /** * Constructor. diff --git a/Compute/src/V1/ServiceAttachmentAggregatedList.php b/Compute/src/V1/ServiceAttachmentAggregatedList.php index ca3bd0fd8572..1addb09f06c9 100644 --- a/Compute/src/V1/ServiceAttachmentAggregatedList.php +++ b/Compute/src/V1/ServiceAttachmentAggregatedList.php @@ -20,7 +20,7 @@ class ServiceAttachmentAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of ServiceAttachmentsScopedList resources. * @@ -32,19 +32,19 @@ class ServiceAttachmentAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Unreachable resources. * @@ -56,7 +56,7 @@ class ServiceAttachmentAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/ServiceAttachmentConnectedEndpoint.php b/Compute/src/V1/ServiceAttachmentConnectedEndpoint.php index 810321f28935..ad42591b6345 100644 --- a/Compute/src/V1/ServiceAttachmentConnectedEndpoint.php +++ b/Compute/src/V1/ServiceAttachmentConnectedEndpoint.php @@ -20,32 +20,32 @@ class ServiceAttachmentConnectedEndpoint extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field optional string consumer_network = 254357221; */ - private $consumer_network = null; + protected $consumer_network = null; /** * The url of a connected endpoint. * * Generated from protobuf field optional string endpoint = 130489749; */ - private $endpoint = null; + protected $endpoint = null; /** * The number of consumer Network Connectivity Center spokes that the connected Private Service Connect endpoint has propagated to. * * Generated from protobuf field optional uint32 propagated_connection_count = 324594130; */ - private $propagated_connection_count = null; + protected $propagated_connection_count = null; /** * The PSC connection id of the connected endpoint. * * Generated from protobuf field optional uint64 psc_connection_id = 292082397; */ - private $psc_connection_id = null; + protected $psc_connection_id = null; /** * The status of a connected endpoint to this service attachment. * Check the Status enum for the list of possible values. * * Generated from protobuf field optional string status = 181260274; */ - private $status = null; + protected $status = null; /** * Constructor. diff --git a/Compute/src/V1/ServiceAttachmentConsumerProjectLimit.php b/Compute/src/V1/ServiceAttachmentConsumerProjectLimit.php index 1678bc5c9c80..1789bf98a763 100644 --- a/Compute/src/V1/ServiceAttachmentConsumerProjectLimit.php +++ b/Compute/src/V1/ServiceAttachmentConsumerProjectLimit.php @@ -19,19 +19,19 @@ class ServiceAttachmentConsumerProjectLimit extends \Google\Protobuf\Internal\Me * * Generated from protobuf field optional uint32 connection_limit = 131403546; */ - private $connection_limit = null; + protected $connection_limit = null; /** * The network URL for the network to set the limit for. * * Generated from protobuf field optional string network_url = 207194078; */ - private $network_url = null; + protected $network_url = null; /** * The project id or number for the project to set the limit for. * * Generated from protobuf field optional string project_id_or_num = 349783336; */ - private $project_id_or_num = null; + protected $project_id_or_num = null; /** * Constructor. diff --git a/Compute/src/V1/ServiceAttachmentList.php b/Compute/src/V1/ServiceAttachmentList.php index 970c518eceab..fb661df50087 100644 --- a/Compute/src/V1/ServiceAttachmentList.php +++ b/Compute/src/V1/ServiceAttachmentList.php @@ -19,7 +19,7 @@ class ServiceAttachmentList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of ServiceAttachment resources. * @@ -31,25 +31,25 @@ class ServiceAttachmentList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/ServiceAttachmentsClient.php b/Compute/src/V1/ServiceAttachmentsClient.php deleted file mode 100644 index f28bfb2ca9c3..000000000000 --- a/Compute/src/V1/ServiceAttachmentsClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/SetBackendServiceTargetSslProxyRequest.php b/Compute/src/V1/SetBackendServiceTargetSslProxyRequest.php index 25bf5da3a813..2824a60f967b 100644 --- a/Compute/src/V1/SetBackendServiceTargetSslProxyRequest.php +++ b/Compute/src/V1/SetBackendServiceTargetSslProxyRequest.php @@ -20,25 +20,25 @@ class SetBackendServiceTargetSslProxyRequest extends \Google\Protobuf\Internal\M * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.TargetSslProxiesSetBackendServiceRequest target_ssl_proxies_set_backend_service_request_resource = 139080868 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_ssl_proxies_set_backend_service_request_resource = null; + protected $target_ssl_proxies_set_backend_service_request_resource = null; /** * Name of the TargetSslProxy resource whose BackendService resource is to be set. * * Generated from protobuf field string target_ssl_proxy = 338795853 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_ssl_proxy = ''; + protected $target_ssl_proxy = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetBackendServiceTargetTcpProxyRequest.php b/Compute/src/V1/SetBackendServiceTargetTcpProxyRequest.php index 8c18c9e8f8a5..6f78dca1cfbb 100644 --- a/Compute/src/V1/SetBackendServiceTargetTcpProxyRequest.php +++ b/Compute/src/V1/SetBackendServiceTargetTcpProxyRequest.php @@ -20,25 +20,25 @@ class SetBackendServiceTargetTcpProxyRequest extends \Google\Protobuf\Internal\M * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.TargetTcpProxiesSetBackendServiceRequest target_tcp_proxies_set_backend_service_request_resource = 273721583 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_tcp_proxies_set_backend_service_request_resource = null; + protected $target_tcp_proxies_set_backend_service_request_resource = null; /** * Name of the TargetTcpProxy resource whose BackendService resource is to be set. * * Generated from protobuf field string target_tcp_proxy = 503065442 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_tcp_proxy = ''; + protected $target_tcp_proxy = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetBackupTargetPoolRequest.php b/Compute/src/V1/SetBackupTargetPoolRequest.php index 239d8fa53bb1..fcfe6267ea74 100644 --- a/Compute/src/V1/SetBackupTargetPoolRequest.php +++ b/Compute/src/V1/SetBackupTargetPoolRequest.php @@ -20,37 +20,37 @@ class SetBackupTargetPoolRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional float failover_ratio = 212667006; */ - private $failover_ratio = null; + protected $failover_ratio = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name of the TargetPool resource to set a backup pool for. * * Generated from protobuf field string target_pool = 62796298 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_pool = ''; + protected $target_pool = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.TargetReference target_reference_resource = 523721712 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_reference_resource = null; + protected $target_reference_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetCertificateMapTargetHttpsProxyRequest.php b/Compute/src/V1/SetCertificateMapTargetHttpsProxyRequest.php index eac545b04d64..c238dfeb4568 100644 --- a/Compute/src/V1/SetCertificateMapTargetHttpsProxyRequest.php +++ b/Compute/src/V1/SetCertificateMapTargetHttpsProxyRequest.php @@ -20,25 +20,25 @@ class SetCertificateMapTargetHttpsProxyRequest extends \Google\Protobuf\Internal * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.TargetHttpsProxiesSetCertificateMapRequest target_https_proxies_set_certificate_map_request_resource = 467639099 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_https_proxies_set_certificate_map_request_resource = null; + protected $target_https_proxies_set_certificate_map_request_resource = null; /** * Name of the TargetHttpsProxy resource whose CertificateMap is to be set. The name must be 1-63 characters long, and comply with RFC1035. * * Generated from protobuf field string target_https_proxy = 52336748 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_https_proxy = ''; + protected $target_https_proxy = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetCertificateMapTargetSslProxyRequest.php b/Compute/src/V1/SetCertificateMapTargetSslProxyRequest.php index 0e242dd5b4b2..6701611f2e95 100644 --- a/Compute/src/V1/SetCertificateMapTargetSslProxyRequest.php +++ b/Compute/src/V1/SetCertificateMapTargetSslProxyRequest.php @@ -20,25 +20,25 @@ class SetCertificateMapTargetSslProxyRequest extends \Google\Protobuf\Internal\M * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.TargetSslProxiesSetCertificateMapRequest target_ssl_proxies_set_certificate_map_request_resource = 343984954 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_ssl_proxies_set_certificate_map_request_resource = null; + protected $target_ssl_proxies_set_certificate_map_request_resource = null; /** * Name of the TargetSslProxy resource whose CertificateMap is to be set. The name must be 1-63 characters long, and comply with RFC1035. * * Generated from protobuf field string target_ssl_proxy = 338795853 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_ssl_proxy = ''; + protected $target_ssl_proxy = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetCloudArmorTierProjectRequest.php b/Compute/src/V1/SetCloudArmorTierProjectRequest.php index 2c8c6de69a5b..cf077f115f21 100644 --- a/Compute/src/V1/SetCloudArmorTierProjectRequest.php +++ b/Compute/src/V1/SetCloudArmorTierProjectRequest.php @@ -20,19 +20,19 @@ class SetCloudArmorTierProjectRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.ProjectsSetCloudArmorTierRequest projects_set_cloud_armor_tier_request_resource = 77053391 [(.google.api.field_behavior) = REQUIRED]; */ - private $projects_set_cloud_armor_tier_request_resource = null; + protected $projects_set_cloud_armor_tier_request_resource = null; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetCommonInstanceMetadataOperationMetadata.php b/Compute/src/V1/SetCommonInstanceMetadataOperationMetadata.php index b83149a07704..12daa17fa638 100644 --- a/Compute/src/V1/SetCommonInstanceMetadataOperationMetadata.php +++ b/Compute/src/V1/SetCommonInstanceMetadataOperationMetadata.php @@ -19,7 +19,7 @@ class SetCommonInstanceMetadataOperationMetadata extends \Google\Protobuf\Intern * * Generated from protobuf field optional string client_operation_id = 297240295; */ - private $client_operation_id = null; + protected $client_operation_id = null; /** * [Output Only] Status information per location (location name is key). Example key: zones/us-central1-a * diff --git a/Compute/src/V1/SetCommonInstanceMetadataOperationMetadataPerLocationOperationInfo.php b/Compute/src/V1/SetCommonInstanceMetadataOperationMetadataPerLocationOperationInfo.php index 150a0ed01b4f..c1e201b4e632 100644 --- a/Compute/src/V1/SetCommonInstanceMetadataOperationMetadataPerLocationOperationInfo.php +++ b/Compute/src/V1/SetCommonInstanceMetadataOperationMetadataPerLocationOperationInfo.php @@ -19,14 +19,14 @@ class SetCommonInstanceMetadataOperationMetadataPerLocationOperationInfo extends * * Generated from protobuf field optional .google.cloud.compute.v1.Status error = 96784904; */ - private $error = null; + protected $error = null; /** * [Output Only] Status of the action, which can be one of the following: `PROPAGATING`, `PROPAGATED`, `ABANDONED`, `FAILED`, or `DONE`. * Check the State enum for the list of possible values. * * Generated from protobuf field optional string state = 109757585; */ - private $state = null; + protected $state = null; /** * Constructor. diff --git a/Compute/src/V1/SetCommonInstanceMetadataProjectRequest.php b/Compute/src/V1/SetCommonInstanceMetadataProjectRequest.php index 26e703970c57..3be4ce6e5399 100644 --- a/Compute/src/V1/SetCommonInstanceMetadataProjectRequest.php +++ b/Compute/src/V1/SetCommonInstanceMetadataProjectRequest.php @@ -20,19 +20,19 @@ class SetCommonInstanceMetadataProjectRequest extends \Google\Protobuf\Internal\ * * Generated from protobuf field .google.cloud.compute.v1.Metadata metadata_resource = 291086110 [(.google.api.field_behavior) = REQUIRED]; */ - private $metadata_resource = null; + protected $metadata_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetDefaultNetworkTierProjectRequest.php b/Compute/src/V1/SetDefaultNetworkTierProjectRequest.php index 269c571322e9..ed6f71483c4e 100644 --- a/Compute/src/V1/SetDefaultNetworkTierProjectRequest.php +++ b/Compute/src/V1/SetDefaultNetworkTierProjectRequest.php @@ -20,19 +20,19 @@ class SetDefaultNetworkTierProjectRequest extends \Google\Protobuf\Internal\Mess * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.ProjectsSetDefaultNetworkTierRequest projects_set_default_network_tier_request_resource = 126410762 [(.google.api.field_behavior) = REQUIRED]; */ - private $projects_set_default_network_tier_request_resource = null; + protected $projects_set_default_network_tier_request_resource = null; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetDeletionProtectionInstanceRequest.php b/Compute/src/V1/SetDeletionProtectionInstanceRequest.php index 4728014e9395..954f192e2df8 100644 --- a/Compute/src/V1/SetDeletionProtectionInstanceRequest.php +++ b/Compute/src/V1/SetDeletionProtectionInstanceRequest.php @@ -20,31 +20,31 @@ class SetDeletionProtectionInstanceRequest extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field optional bool deletion_protection = 458014698; */ - private $deletion_protection = null; + protected $deletion_protection = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetDiskAutoDeleteInstanceRequest.php b/Compute/src/V1/SetDiskAutoDeleteInstanceRequest.php index a8cfc2423811..76ee56d6b511 100644 --- a/Compute/src/V1/SetDiskAutoDeleteInstanceRequest.php +++ b/Compute/src/V1/SetDiskAutoDeleteInstanceRequest.php @@ -20,37 +20,37 @@ class SetDiskAutoDeleteInstanceRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field bool auto_delete = 464761403 [(.google.api.field_behavior) = REQUIRED]; */ - private $auto_delete = false; + protected $auto_delete = false; /** * The device name of the disk to modify. Make a get() request on the instance to view currently attached disks and device names. * * Generated from protobuf field string device_name = 67541716 [(.google.api.field_behavior) = REQUIRED]; */ - private $device_name = ''; + protected $device_name = ''; /** * The instance name for this request. * * Generated from protobuf field string instance = 18257045 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance = ''; + protected $instance = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetEdgeSecurityPolicyBackendBucketRequest.php b/Compute/src/V1/SetEdgeSecurityPolicyBackendBucketRequest.php index f81c0922d0b2..1315d8982b4e 100644 --- a/Compute/src/V1/SetEdgeSecurityPolicyBackendBucketRequest.php +++ b/Compute/src/V1/SetEdgeSecurityPolicyBackendBucketRequest.php @@ -20,25 +20,25 @@ class SetEdgeSecurityPolicyBackendBucketRequest extends \Google\Protobuf\Interna * * Generated from protobuf field string backend_bucket = 91714037 [(.google.api.field_behavior) = REQUIRED]; */ - private $backend_bucket = ''; + protected $backend_bucket = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.SecurityPolicyReference security_policy_reference_resource = 204135024 [(.google.api.field_behavior) = REQUIRED]; */ - private $security_policy_reference_resource = null; + protected $security_policy_reference_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetEdgeSecurityPolicyBackendServiceRequest.php b/Compute/src/V1/SetEdgeSecurityPolicyBackendServiceRequest.php index fd669766f56d..798af923ee68 100644 --- a/Compute/src/V1/SetEdgeSecurityPolicyBackendServiceRequest.php +++ b/Compute/src/V1/SetEdgeSecurityPolicyBackendServiceRequest.php @@ -20,25 +20,25 @@ class SetEdgeSecurityPolicyBackendServiceRequest extends \Google\Protobuf\Intern * * Generated from protobuf field string backend_service = 306946058 [(.google.api.field_behavior) = REQUIRED]; */ - private $backend_service = ''; + protected $backend_service = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.SecurityPolicyReference security_policy_reference_resource = 204135024 [(.google.api.field_behavior) = REQUIRED]; */ - private $security_policy_reference_resource = null; + protected $security_policy_reference_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetIamPolicyBackendBucketRequest.php b/Compute/src/V1/SetIamPolicyBackendBucketRequest.php index a076ef321d26..d326114550a5 100644 --- a/Compute/src/V1/SetIamPolicyBackendBucketRequest.php +++ b/Compute/src/V1/SetIamPolicyBackendBucketRequest.php @@ -20,19 +20,19 @@ class SetIamPolicyBackendBucketRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.compute.v1.GlobalSetPolicyRequest global_set_policy_request_resource = 337048498 [(.google.api.field_behavior) = REQUIRED]; */ - private $global_set_policy_request_resource = null; + protected $global_set_policy_request_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetIamPolicyBackendServiceRequest.php b/Compute/src/V1/SetIamPolicyBackendServiceRequest.php index bf8ebfca9d89..cf17f44b8eae 100644 --- a/Compute/src/V1/SetIamPolicyBackendServiceRequest.php +++ b/Compute/src/V1/SetIamPolicyBackendServiceRequest.php @@ -20,19 +20,19 @@ class SetIamPolicyBackendServiceRequest extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field .google.cloud.compute.v1.GlobalSetPolicyRequest global_set_policy_request_resource = 337048498 [(.google.api.field_behavior) = REQUIRED]; */ - private $global_set_policy_request_resource = null; + protected $global_set_policy_request_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetIamPolicyDiskRequest.php b/Compute/src/V1/SetIamPolicyDiskRequest.php index a916f262b70d..35853f04cf7e 100644 --- a/Compute/src/V1/SetIamPolicyDiskRequest.php +++ b/Compute/src/V1/SetIamPolicyDiskRequest.php @@ -20,25 +20,25 @@ class SetIamPolicyDiskRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.ZoneSetPolicyRequest zone_set_policy_request_resource = 382082107 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone_set_policy_request_resource = null; + protected $zone_set_policy_request_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetIamPolicyFirewallPolicyRequest.php b/Compute/src/V1/SetIamPolicyFirewallPolicyRequest.php index aa8535b1d57f..611925162b49 100644 --- a/Compute/src/V1/SetIamPolicyFirewallPolicyRequest.php +++ b/Compute/src/V1/SetIamPolicyFirewallPolicyRequest.php @@ -20,13 +20,13 @@ class SetIamPolicyFirewallPolicyRequest extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field .google.cloud.compute.v1.GlobalOrganizationSetPolicyRequest global_organization_set_policy_request_resource = 177408606 [(.google.api.field_behavior) = REQUIRED]; */ - private $global_organization_set_policy_request_resource = null; + protected $global_organization_set_policy_request_resource = null; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * @param string $resource Name or id of the resource for this request. diff --git a/Compute/src/V1/SetIamPolicyImageRequest.php b/Compute/src/V1/SetIamPolicyImageRequest.php index c26891a61c39..337e53b282e9 100644 --- a/Compute/src/V1/SetIamPolicyImageRequest.php +++ b/Compute/src/V1/SetIamPolicyImageRequest.php @@ -20,19 +20,19 @@ class SetIamPolicyImageRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.compute.v1.GlobalSetPolicyRequest global_set_policy_request_resource = 337048498 [(.google.api.field_behavior) = REQUIRED]; */ - private $global_set_policy_request_resource = null; + protected $global_set_policy_request_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetIamPolicyInstanceRequest.php b/Compute/src/V1/SetIamPolicyInstanceRequest.php index 5eb527fcac09..e8d34ab1b3aa 100644 --- a/Compute/src/V1/SetIamPolicyInstanceRequest.php +++ b/Compute/src/V1/SetIamPolicyInstanceRequest.php @@ -20,25 +20,25 @@ class SetIamPolicyInstanceRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.ZoneSetPolicyRequest zone_set_policy_request_resource = 382082107 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone_set_policy_request_resource = null; + protected $zone_set_policy_request_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetIamPolicyInstanceTemplateRequest.php b/Compute/src/V1/SetIamPolicyInstanceTemplateRequest.php index 1c4046c35947..48863c4df694 100644 --- a/Compute/src/V1/SetIamPolicyInstanceTemplateRequest.php +++ b/Compute/src/V1/SetIamPolicyInstanceTemplateRequest.php @@ -20,19 +20,19 @@ class SetIamPolicyInstanceTemplateRequest extends \Google\Protobuf\Internal\Mess * * Generated from protobuf field .google.cloud.compute.v1.GlobalSetPolicyRequest global_set_policy_request_resource = 337048498 [(.google.api.field_behavior) = REQUIRED]; */ - private $global_set_policy_request_resource = null; + protected $global_set_policy_request_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetIamPolicyInstantSnapshotRequest.php b/Compute/src/V1/SetIamPolicyInstantSnapshotRequest.php index b260dac86a2c..5bb26bd9a9ee 100644 --- a/Compute/src/V1/SetIamPolicyInstantSnapshotRequest.php +++ b/Compute/src/V1/SetIamPolicyInstantSnapshotRequest.php @@ -20,25 +20,25 @@ class SetIamPolicyInstantSnapshotRequest extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.ZoneSetPolicyRequest zone_set_policy_request_resource = 382082107 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone_set_policy_request_resource = null; + protected $zone_set_policy_request_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetIamPolicyInterconnectAttachmentGroupRequest.php b/Compute/src/V1/SetIamPolicyInterconnectAttachmentGroupRequest.php index 97062849961f..8233c3a28921 100644 --- a/Compute/src/V1/SetIamPolicyInterconnectAttachmentGroupRequest.php +++ b/Compute/src/V1/SetIamPolicyInterconnectAttachmentGroupRequest.php @@ -20,19 +20,19 @@ class SetIamPolicyInterconnectAttachmentGroupRequest extends \Google\Protobuf\In * * Generated from protobuf field .google.cloud.compute.v1.GlobalSetPolicyRequest global_set_policy_request_resource = 337048498 [(.google.api.field_behavior) = REQUIRED]; */ - private $global_set_policy_request_resource = null; + protected $global_set_policy_request_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetIamPolicyInterconnectGroupRequest.php b/Compute/src/V1/SetIamPolicyInterconnectGroupRequest.php index 4868d9e64b65..6c0227237ea1 100644 --- a/Compute/src/V1/SetIamPolicyInterconnectGroupRequest.php +++ b/Compute/src/V1/SetIamPolicyInterconnectGroupRequest.php @@ -20,19 +20,19 @@ class SetIamPolicyInterconnectGroupRequest extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field .google.cloud.compute.v1.GlobalSetPolicyRequest global_set_policy_request_resource = 337048498 [(.google.api.field_behavior) = REQUIRED]; */ - private $global_set_policy_request_resource = null; + protected $global_set_policy_request_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetIamPolicyLicenseRequest.php b/Compute/src/V1/SetIamPolicyLicenseRequest.php index 33647056a570..07455dfd7170 100644 --- a/Compute/src/V1/SetIamPolicyLicenseRequest.php +++ b/Compute/src/V1/SetIamPolicyLicenseRequest.php @@ -20,19 +20,19 @@ class SetIamPolicyLicenseRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.compute.v1.GlobalSetPolicyRequest global_set_policy_request_resource = 337048498 [(.google.api.field_behavior) = REQUIRED]; */ - private $global_set_policy_request_resource = null; + protected $global_set_policy_request_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetIamPolicyMachineImageRequest.php b/Compute/src/V1/SetIamPolicyMachineImageRequest.php index b9961cf2db06..7f2823d02d07 100644 --- a/Compute/src/V1/SetIamPolicyMachineImageRequest.php +++ b/Compute/src/V1/SetIamPolicyMachineImageRequest.php @@ -20,19 +20,19 @@ class SetIamPolicyMachineImageRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.compute.v1.GlobalSetPolicyRequest global_set_policy_request_resource = 337048498 [(.google.api.field_behavior) = REQUIRED]; */ - private $global_set_policy_request_resource = null; + protected $global_set_policy_request_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetIamPolicyNetworkAttachmentRequest.php b/Compute/src/V1/SetIamPolicyNetworkAttachmentRequest.php index df367a081584..816abbf5149e 100644 --- a/Compute/src/V1/SetIamPolicyNetworkAttachmentRequest.php +++ b/Compute/src/V1/SetIamPolicyNetworkAttachmentRequest.php @@ -20,25 +20,25 @@ class SetIamPolicyNetworkAttachmentRequest extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * The name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.RegionSetPolicyRequest region_set_policy_request_resource = 276489091 [(.google.api.field_behavior) = REQUIRED]; */ - private $region_set_policy_request_resource = null; + protected $region_set_policy_request_resource = null; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetIamPolicyNetworkFirewallPolicyRequest.php b/Compute/src/V1/SetIamPolicyNetworkFirewallPolicyRequest.php index 6f8d628365dd..0d49245f3261 100644 --- a/Compute/src/V1/SetIamPolicyNetworkFirewallPolicyRequest.php +++ b/Compute/src/V1/SetIamPolicyNetworkFirewallPolicyRequest.php @@ -20,19 +20,19 @@ class SetIamPolicyNetworkFirewallPolicyRequest extends \Google\Protobuf\Internal * * Generated from protobuf field .google.cloud.compute.v1.GlobalSetPolicyRequest global_set_policy_request_resource = 337048498 [(.google.api.field_behavior) = REQUIRED]; */ - private $global_set_policy_request_resource = null; + protected $global_set_policy_request_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetIamPolicyNodeGroupRequest.php b/Compute/src/V1/SetIamPolicyNodeGroupRequest.php index c810f4d2665b..23dfd08e15b2 100644 --- a/Compute/src/V1/SetIamPolicyNodeGroupRequest.php +++ b/Compute/src/V1/SetIamPolicyNodeGroupRequest.php @@ -20,25 +20,25 @@ class SetIamPolicyNodeGroupRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.ZoneSetPolicyRequest zone_set_policy_request_resource = 382082107 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone_set_policy_request_resource = null; + protected $zone_set_policy_request_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetIamPolicyNodeTemplateRequest.php b/Compute/src/V1/SetIamPolicyNodeTemplateRequest.php index 17249a27f5d5..abbe68a21464 100644 --- a/Compute/src/V1/SetIamPolicyNodeTemplateRequest.php +++ b/Compute/src/V1/SetIamPolicyNodeTemplateRequest.php @@ -20,25 +20,25 @@ class SetIamPolicyNodeTemplateRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * The name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.RegionSetPolicyRequest region_set_policy_request_resource = 276489091 [(.google.api.field_behavior) = REQUIRED]; */ - private $region_set_policy_request_resource = null; + protected $region_set_policy_request_resource = null; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetIamPolicyRegionBackendServiceRequest.php b/Compute/src/V1/SetIamPolicyRegionBackendServiceRequest.php index d2de52b380b9..519d640a2c1e 100644 --- a/Compute/src/V1/SetIamPolicyRegionBackendServiceRequest.php +++ b/Compute/src/V1/SetIamPolicyRegionBackendServiceRequest.php @@ -20,25 +20,25 @@ class SetIamPolicyRegionBackendServiceRequest extends \Google\Protobuf\Internal\ * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * The name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.RegionSetPolicyRequest region_set_policy_request_resource = 276489091 [(.google.api.field_behavior) = REQUIRED]; */ - private $region_set_policy_request_resource = null; + protected $region_set_policy_request_resource = null; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetIamPolicyRegionDiskRequest.php b/Compute/src/V1/SetIamPolicyRegionDiskRequest.php index eced92a3dee3..d7bc07c2073b 100644 --- a/Compute/src/V1/SetIamPolicyRegionDiskRequest.php +++ b/Compute/src/V1/SetIamPolicyRegionDiskRequest.php @@ -20,25 +20,25 @@ class SetIamPolicyRegionDiskRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * The name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.RegionSetPolicyRequest region_set_policy_request_resource = 276489091 [(.google.api.field_behavior) = REQUIRED]; */ - private $region_set_policy_request_resource = null; + protected $region_set_policy_request_resource = null; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetIamPolicyRegionInstantSnapshotRequest.php b/Compute/src/V1/SetIamPolicyRegionInstantSnapshotRequest.php index c93088f24046..17e2d1f9d921 100644 --- a/Compute/src/V1/SetIamPolicyRegionInstantSnapshotRequest.php +++ b/Compute/src/V1/SetIamPolicyRegionInstantSnapshotRequest.php @@ -20,25 +20,25 @@ class SetIamPolicyRegionInstantSnapshotRequest extends \Google\Protobuf\Internal * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * The name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.RegionSetPolicyRequest region_set_policy_request_resource = 276489091 [(.google.api.field_behavior) = REQUIRED]; */ - private $region_set_policy_request_resource = null; + protected $region_set_policy_request_resource = null; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetIamPolicyRegionNetworkFirewallPolicyRequest.php b/Compute/src/V1/SetIamPolicyRegionNetworkFirewallPolicyRequest.php index 03e0d18472d6..be1801989731 100644 --- a/Compute/src/V1/SetIamPolicyRegionNetworkFirewallPolicyRequest.php +++ b/Compute/src/V1/SetIamPolicyRegionNetworkFirewallPolicyRequest.php @@ -20,25 +20,25 @@ class SetIamPolicyRegionNetworkFirewallPolicyRequest extends \Google\Protobuf\In * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * The name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.RegionSetPolicyRequest region_set_policy_request_resource = 276489091 [(.google.api.field_behavior) = REQUIRED]; */ - private $region_set_policy_request_resource = null; + protected $region_set_policy_request_resource = null; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetIamPolicyReservationRequest.php b/Compute/src/V1/SetIamPolicyReservationRequest.php index 6c03a557da1c..4f762de9336d 100644 --- a/Compute/src/V1/SetIamPolicyReservationRequest.php +++ b/Compute/src/V1/SetIamPolicyReservationRequest.php @@ -20,25 +20,25 @@ class SetIamPolicyReservationRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.ZoneSetPolicyRequest zone_set_policy_request_resource = 382082107 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone_set_policy_request_resource = null; + protected $zone_set_policy_request_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetIamPolicyResourcePolicyRequest.php b/Compute/src/V1/SetIamPolicyResourcePolicyRequest.php index d847190befca..bfb459eb0401 100644 --- a/Compute/src/V1/SetIamPolicyResourcePolicyRequest.php +++ b/Compute/src/V1/SetIamPolicyResourcePolicyRequest.php @@ -20,25 +20,25 @@ class SetIamPolicyResourcePolicyRequest extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * The name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.RegionSetPolicyRequest region_set_policy_request_resource = 276489091 [(.google.api.field_behavior) = REQUIRED]; */ - private $region_set_policy_request_resource = null; + protected $region_set_policy_request_resource = null; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetIamPolicyServiceAttachmentRequest.php b/Compute/src/V1/SetIamPolicyServiceAttachmentRequest.php index c9afaca2afe0..87104468174a 100644 --- a/Compute/src/V1/SetIamPolicyServiceAttachmentRequest.php +++ b/Compute/src/V1/SetIamPolicyServiceAttachmentRequest.php @@ -20,25 +20,25 @@ class SetIamPolicyServiceAttachmentRequest extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * The name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.RegionSetPolicyRequest region_set_policy_request_resource = 276489091 [(.google.api.field_behavior) = REQUIRED]; */ - private $region_set_policy_request_resource = null; + protected $region_set_policy_request_resource = null; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetIamPolicySnapshotRequest.php b/Compute/src/V1/SetIamPolicySnapshotRequest.php index 7c3f7dcbd10a..935a1200033e 100644 --- a/Compute/src/V1/SetIamPolicySnapshotRequest.php +++ b/Compute/src/V1/SetIamPolicySnapshotRequest.php @@ -20,19 +20,19 @@ class SetIamPolicySnapshotRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.compute.v1.GlobalSetPolicyRequest global_set_policy_request_resource = 337048498 [(.google.api.field_behavior) = REQUIRED]; */ - private $global_set_policy_request_resource = null; + protected $global_set_policy_request_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetIamPolicyStoragePoolRequest.php b/Compute/src/V1/SetIamPolicyStoragePoolRequest.php index 248cfd7f7df8..f628b0595daf 100644 --- a/Compute/src/V1/SetIamPolicyStoragePoolRequest.php +++ b/Compute/src/V1/SetIamPolicyStoragePoolRequest.php @@ -20,25 +20,25 @@ class SetIamPolicyStoragePoolRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.ZoneSetPolicyRequest zone_set_policy_request_resource = 382082107 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone_set_policy_request_resource = null; + protected $zone_set_policy_request_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetIamPolicySubnetworkRequest.php b/Compute/src/V1/SetIamPolicySubnetworkRequest.php index ee4fc0814d0a..5ab89f4a4eaf 100644 --- a/Compute/src/V1/SetIamPolicySubnetworkRequest.php +++ b/Compute/src/V1/SetIamPolicySubnetworkRequest.php @@ -20,25 +20,25 @@ class SetIamPolicySubnetworkRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * The name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.RegionSetPolicyRequest region_set_policy_request_resource = 276489091 [(.google.api.field_behavior) = REQUIRED]; */ - private $region_set_policy_request_resource = null; + protected $region_set_policy_request_resource = null; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetInstanceTemplateInstanceGroupManagerRequest.php b/Compute/src/V1/SetInstanceTemplateInstanceGroupManagerRequest.php index c90431e5b49a..6c6e43c12b3b 100644 --- a/Compute/src/V1/SetInstanceTemplateInstanceGroupManagerRequest.php +++ b/Compute/src/V1/SetInstanceTemplateInstanceGroupManagerRequest.php @@ -20,31 +20,31 @@ class SetInstanceTemplateInstanceGroupManagerRequest extends \Google\Protobuf\In * * Generated from protobuf field string instance_group_manager = 249363395 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group_manager = ''; + protected $instance_group_manager = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.InstanceGroupManagersSetInstanceTemplateRequest instance_group_managers_set_instance_template_request_resource = 9809093 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group_managers_set_instance_template_request_resource = null; + protected $instance_group_managers_set_instance_template_request_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone where the managed instance group is located. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetInstanceTemplateRegionInstanceGroupManagerRequest.php b/Compute/src/V1/SetInstanceTemplateRegionInstanceGroupManagerRequest.php index b63a9050ecb0..45bf17b122af 100644 --- a/Compute/src/V1/SetInstanceTemplateRegionInstanceGroupManagerRequest.php +++ b/Compute/src/V1/SetInstanceTemplateRegionInstanceGroupManagerRequest.php @@ -20,31 +20,31 @@ class SetInstanceTemplateRegionInstanceGroupManagerRequest extends \Google\Proto * * Generated from protobuf field string instance_group_manager = 249363395 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group_manager = ''; + protected $instance_group_manager = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.RegionInstanceGroupManagersSetTemplateRequest region_instance_group_managers_set_template_request_resource = 187310412 [(.google.api.field_behavior) = REQUIRED]; */ - private $region_instance_group_managers_set_template_request_resource = null; + protected $region_instance_group_managers_set_template_request_resource = null; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetLabelsAddressRequest.php b/Compute/src/V1/SetLabelsAddressRequest.php index 5a9bc04b1f52..aea44a151789 100644 --- a/Compute/src/V1/SetLabelsAddressRequest.php +++ b/Compute/src/V1/SetLabelsAddressRequest.php @@ -20,31 +20,31 @@ class SetLabelsAddressRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * The region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.RegionSetLabelsRequest region_set_labels_request_resource = 259357782 [(.google.api.field_behavior) = REQUIRED]; */ - private $region_set_labels_request_resource = null; + protected $region_set_labels_request_resource = null; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetLabelsDiskRequest.php b/Compute/src/V1/SetLabelsDiskRequest.php index efe64b0d607f..59bac7b349bc 100644 --- a/Compute/src/V1/SetLabelsDiskRequest.php +++ b/Compute/src/V1/SetLabelsDiskRequest.php @@ -20,31 +20,31 @@ class SetLabelsDiskRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.ZoneSetLabelsRequest zone_set_labels_request_resource = 364950798 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone_set_labels_request_resource = null; + protected $zone_set_labels_request_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetLabelsExternalVpnGatewayRequest.php b/Compute/src/V1/SetLabelsExternalVpnGatewayRequest.php index cdfc0c57932c..331c226b2be7 100644 --- a/Compute/src/V1/SetLabelsExternalVpnGatewayRequest.php +++ b/Compute/src/V1/SetLabelsExternalVpnGatewayRequest.php @@ -20,19 +20,19 @@ class SetLabelsExternalVpnGatewayRequest extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field .google.cloud.compute.v1.GlobalSetLabelsRequest global_set_labels_request_resource = 319917189 [(.google.api.field_behavior) = REQUIRED]; */ - private $global_set_labels_request_resource = null; + protected $global_set_labels_request_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetLabelsForwardingRuleRequest.php b/Compute/src/V1/SetLabelsForwardingRuleRequest.php index fcac99331def..9834e154d045 100644 --- a/Compute/src/V1/SetLabelsForwardingRuleRequest.php +++ b/Compute/src/V1/SetLabelsForwardingRuleRequest.php @@ -20,31 +20,31 @@ class SetLabelsForwardingRuleRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * The region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.RegionSetLabelsRequest region_set_labels_request_resource = 259357782 [(.google.api.field_behavior) = REQUIRED]; */ - private $region_set_labels_request_resource = null; + protected $region_set_labels_request_resource = null; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetLabelsGlobalAddressRequest.php b/Compute/src/V1/SetLabelsGlobalAddressRequest.php index 71c097330ba9..d13ac9b3966f 100644 --- a/Compute/src/V1/SetLabelsGlobalAddressRequest.php +++ b/Compute/src/V1/SetLabelsGlobalAddressRequest.php @@ -20,19 +20,19 @@ class SetLabelsGlobalAddressRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.compute.v1.GlobalSetLabelsRequest global_set_labels_request_resource = 319917189 [(.google.api.field_behavior) = REQUIRED]; */ - private $global_set_labels_request_resource = null; + protected $global_set_labels_request_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetLabelsGlobalForwardingRuleRequest.php b/Compute/src/V1/SetLabelsGlobalForwardingRuleRequest.php index d469344705e3..7dc14c89c262 100644 --- a/Compute/src/V1/SetLabelsGlobalForwardingRuleRequest.php +++ b/Compute/src/V1/SetLabelsGlobalForwardingRuleRequest.php @@ -20,19 +20,19 @@ class SetLabelsGlobalForwardingRuleRequest extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field .google.cloud.compute.v1.GlobalSetLabelsRequest global_set_labels_request_resource = 319917189 [(.google.api.field_behavior) = REQUIRED]; */ - private $global_set_labels_request_resource = null; + protected $global_set_labels_request_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetLabelsImageRequest.php b/Compute/src/V1/SetLabelsImageRequest.php index c8d921562875..519be6999c13 100644 --- a/Compute/src/V1/SetLabelsImageRequest.php +++ b/Compute/src/V1/SetLabelsImageRequest.php @@ -20,19 +20,19 @@ class SetLabelsImageRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.compute.v1.GlobalSetLabelsRequest global_set_labels_request_resource = 319917189 [(.google.api.field_behavior) = REQUIRED]; */ - private $global_set_labels_request_resource = null; + protected $global_set_labels_request_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetLabelsInstanceRequest.php b/Compute/src/V1/SetLabelsInstanceRequest.php index 4c6799ae7305..bc70186b2caf 100644 --- a/Compute/src/V1/SetLabelsInstanceRequest.php +++ b/Compute/src/V1/SetLabelsInstanceRequest.php @@ -20,31 +20,31 @@ class SetLabelsInstanceRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string instance = 18257045 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance = ''; + protected $instance = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.InstancesSetLabelsRequest instances_set_labels_request_resource = 207749344 [(.google.api.field_behavior) = REQUIRED]; */ - private $instances_set_labels_request_resource = null; + protected $instances_set_labels_request_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetLabelsInstantSnapshotRequest.php b/Compute/src/V1/SetLabelsInstantSnapshotRequest.php index a31b963294ce..ccfe551025cf 100644 --- a/Compute/src/V1/SetLabelsInstantSnapshotRequest.php +++ b/Compute/src/V1/SetLabelsInstantSnapshotRequest.php @@ -20,31 +20,31 @@ class SetLabelsInstantSnapshotRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.ZoneSetLabelsRequest zone_set_labels_request_resource = 364950798 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone_set_labels_request_resource = null; + protected $zone_set_labels_request_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetLabelsInterconnectAttachmentRequest.php b/Compute/src/V1/SetLabelsInterconnectAttachmentRequest.php index 1a498b5d15b8..0b8aa5b2f851 100644 --- a/Compute/src/V1/SetLabelsInterconnectAttachmentRequest.php +++ b/Compute/src/V1/SetLabelsInterconnectAttachmentRequest.php @@ -20,31 +20,31 @@ class SetLabelsInterconnectAttachmentRequest extends \Google\Protobuf\Internal\M * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * The region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.RegionSetLabelsRequest region_set_labels_request_resource = 259357782 [(.google.api.field_behavior) = REQUIRED]; */ - private $region_set_labels_request_resource = null; + protected $region_set_labels_request_resource = null; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetLabelsInterconnectRequest.php b/Compute/src/V1/SetLabelsInterconnectRequest.php index 945c4b2dad3e..d342dc95307e 100644 --- a/Compute/src/V1/SetLabelsInterconnectRequest.php +++ b/Compute/src/V1/SetLabelsInterconnectRequest.php @@ -20,19 +20,19 @@ class SetLabelsInterconnectRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.compute.v1.GlobalSetLabelsRequest global_set_labels_request_resource = 319917189 [(.google.api.field_behavior) = REQUIRED]; */ - private $global_set_labels_request_resource = null; + protected $global_set_labels_request_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetLabelsMachineImageRequest.php b/Compute/src/V1/SetLabelsMachineImageRequest.php index 5d5a86a498fa..6a5e4b907d91 100644 --- a/Compute/src/V1/SetLabelsMachineImageRequest.php +++ b/Compute/src/V1/SetLabelsMachineImageRequest.php @@ -20,19 +20,19 @@ class SetLabelsMachineImageRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.compute.v1.GlobalSetLabelsRequest global_set_labels_request_resource = 319917189 [(.google.api.field_behavior) = REQUIRED]; */ - private $global_set_labels_request_resource = null; + protected $global_set_labels_request_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetLabelsRegionDiskRequest.php b/Compute/src/V1/SetLabelsRegionDiskRequest.php index 1dcf228d13f9..a9af4a5a239e 100644 --- a/Compute/src/V1/SetLabelsRegionDiskRequest.php +++ b/Compute/src/V1/SetLabelsRegionDiskRequest.php @@ -20,31 +20,31 @@ class SetLabelsRegionDiskRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * The region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.RegionSetLabelsRequest region_set_labels_request_resource = 259357782 [(.google.api.field_behavior) = REQUIRED]; */ - private $region_set_labels_request_resource = null; + protected $region_set_labels_request_resource = null; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetLabelsRegionInstantSnapshotRequest.php b/Compute/src/V1/SetLabelsRegionInstantSnapshotRequest.php index 281a7248bc9e..f3317199bfd0 100644 --- a/Compute/src/V1/SetLabelsRegionInstantSnapshotRequest.php +++ b/Compute/src/V1/SetLabelsRegionInstantSnapshotRequest.php @@ -20,31 +20,31 @@ class SetLabelsRegionInstantSnapshotRequest extends \Google\Protobuf\Internal\Me * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * The region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.RegionSetLabelsRequest region_set_labels_request_resource = 259357782 [(.google.api.field_behavior) = REQUIRED]; */ - private $region_set_labels_request_resource = null; + protected $region_set_labels_request_resource = null; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetLabelsRegionSecurityPolicyRequest.php b/Compute/src/V1/SetLabelsRegionSecurityPolicyRequest.php index 5883c650b16d..013d35adf77e 100644 --- a/Compute/src/V1/SetLabelsRegionSecurityPolicyRequest.php +++ b/Compute/src/V1/SetLabelsRegionSecurityPolicyRequest.php @@ -20,31 +20,31 @@ class SetLabelsRegionSecurityPolicyRequest extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * The region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.RegionSetLabelsRequest region_set_labels_request_resource = 259357782 [(.google.api.field_behavior) = REQUIRED]; */ - private $region_set_labels_request_resource = null; + protected $region_set_labels_request_resource = null; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetLabelsSecurityPolicyRequest.php b/Compute/src/V1/SetLabelsSecurityPolicyRequest.php index bd1b7cafd45f..7a2a144f62ec 100644 --- a/Compute/src/V1/SetLabelsSecurityPolicyRequest.php +++ b/Compute/src/V1/SetLabelsSecurityPolicyRequest.php @@ -20,19 +20,19 @@ class SetLabelsSecurityPolicyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.compute.v1.GlobalSetLabelsRequest global_set_labels_request_resource = 319917189 [(.google.api.field_behavior) = REQUIRED]; */ - private $global_set_labels_request_resource = null; + protected $global_set_labels_request_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetLabelsSnapshotRequest.php b/Compute/src/V1/SetLabelsSnapshotRequest.php index a92093d973c1..7c1ed2a4089e 100644 --- a/Compute/src/V1/SetLabelsSnapshotRequest.php +++ b/Compute/src/V1/SetLabelsSnapshotRequest.php @@ -20,19 +20,19 @@ class SetLabelsSnapshotRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field .google.cloud.compute.v1.GlobalSetLabelsRequest global_set_labels_request_resource = 319917189 [(.google.api.field_behavior) = REQUIRED]; */ - private $global_set_labels_request_resource = null; + protected $global_set_labels_request_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetLabelsTargetVpnGatewayRequest.php b/Compute/src/V1/SetLabelsTargetVpnGatewayRequest.php index 08d1a60d7186..ee0d4585d29a 100644 --- a/Compute/src/V1/SetLabelsTargetVpnGatewayRequest.php +++ b/Compute/src/V1/SetLabelsTargetVpnGatewayRequest.php @@ -20,31 +20,31 @@ class SetLabelsTargetVpnGatewayRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * The region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.RegionSetLabelsRequest region_set_labels_request_resource = 259357782 [(.google.api.field_behavior) = REQUIRED]; */ - private $region_set_labels_request_resource = null; + protected $region_set_labels_request_resource = null; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetLabelsVpnGatewayRequest.php b/Compute/src/V1/SetLabelsVpnGatewayRequest.php index 21765b6418ce..cffb7feacc24 100644 --- a/Compute/src/V1/SetLabelsVpnGatewayRequest.php +++ b/Compute/src/V1/SetLabelsVpnGatewayRequest.php @@ -20,31 +20,31 @@ class SetLabelsVpnGatewayRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * The region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.RegionSetLabelsRequest region_set_labels_request_resource = 259357782 [(.google.api.field_behavior) = REQUIRED]; */ - private $region_set_labels_request_resource = null; + protected $region_set_labels_request_resource = null; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetLabelsVpnTunnelRequest.php b/Compute/src/V1/SetLabelsVpnTunnelRequest.php index 7069117bba9c..980a2df715e4 100644 --- a/Compute/src/V1/SetLabelsVpnTunnelRequest.php +++ b/Compute/src/V1/SetLabelsVpnTunnelRequest.php @@ -20,31 +20,31 @@ class SetLabelsVpnTunnelRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * The region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.RegionSetLabelsRequest region_set_labels_request_resource = 259357782 [(.google.api.field_behavior) = REQUIRED]; */ - private $region_set_labels_request_resource = null; + protected $region_set_labels_request_resource = null; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetMachineResourcesInstanceRequest.php b/Compute/src/V1/SetMachineResourcesInstanceRequest.php index 6ea38d12e5ad..557ed2176874 100644 --- a/Compute/src/V1/SetMachineResourcesInstanceRequest.php +++ b/Compute/src/V1/SetMachineResourcesInstanceRequest.php @@ -20,31 +20,31 @@ class SetMachineResourcesInstanceRequest extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field string instance = 18257045 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance = ''; + protected $instance = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.InstancesSetMachineResourcesRequest instances_set_machine_resources_request_resource = 196286318 [(.google.api.field_behavior) = REQUIRED]; */ - private $instances_set_machine_resources_request_resource = null; + protected $instances_set_machine_resources_request_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetMachineTypeInstanceRequest.php b/Compute/src/V1/SetMachineTypeInstanceRequest.php index f04337e81665..b8cd1141e994 100644 --- a/Compute/src/V1/SetMachineTypeInstanceRequest.php +++ b/Compute/src/V1/SetMachineTypeInstanceRequest.php @@ -20,31 +20,31 @@ class SetMachineTypeInstanceRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string instance = 18257045 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance = ''; + protected $instance = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.InstancesSetMachineTypeRequest instances_set_machine_type_request_resource = 254157709 [(.google.api.field_behavior) = REQUIRED]; */ - private $instances_set_machine_type_request_resource = null; + protected $instances_set_machine_type_request_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetMetadataInstanceRequest.php b/Compute/src/V1/SetMetadataInstanceRequest.php index 8872f25a551a..503e741d9a96 100644 --- a/Compute/src/V1/SetMetadataInstanceRequest.php +++ b/Compute/src/V1/SetMetadataInstanceRequest.php @@ -20,31 +20,31 @@ class SetMetadataInstanceRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string instance = 18257045 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance = ''; + protected $instance = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.Metadata metadata_resource = 291086110 [(.google.api.field_behavior) = REQUIRED]; */ - private $metadata_resource = null; + protected $metadata_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetMinCpuPlatformInstanceRequest.php b/Compute/src/V1/SetMinCpuPlatformInstanceRequest.php index e7a50a9435d0..f4c67ce76ea1 100644 --- a/Compute/src/V1/SetMinCpuPlatformInstanceRequest.php +++ b/Compute/src/V1/SetMinCpuPlatformInstanceRequest.php @@ -20,31 +20,31 @@ class SetMinCpuPlatformInstanceRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string instance = 18257045 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance = ''; + protected $instance = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.InstancesSetMinCpuPlatformRequest instances_set_min_cpu_platform_request_resource = 148459368 [(.google.api.field_behavior) = REQUIRED]; */ - private $instances_set_min_cpu_platform_request_resource = null; + protected $instances_set_min_cpu_platform_request_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetNameInstanceRequest.php b/Compute/src/V1/SetNameInstanceRequest.php index d4e4fd0749d4..9817ad22a65c 100644 --- a/Compute/src/V1/SetNameInstanceRequest.php +++ b/Compute/src/V1/SetNameInstanceRequest.php @@ -20,31 +20,31 @@ class SetNameInstanceRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string instance = 18257045 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance = ''; + protected $instance = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.InstancesSetNameRequest instances_set_name_request_resource = 272080980 [(.google.api.field_behavior) = REQUIRED]; */ - private $instances_set_name_request_resource = null; + protected $instances_set_name_request_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetNamedPortsInstanceGroupRequest.php b/Compute/src/V1/SetNamedPortsInstanceGroupRequest.php index 69920fd1b642..2871f2bd7132 100644 --- a/Compute/src/V1/SetNamedPortsInstanceGroupRequest.php +++ b/Compute/src/V1/SetNamedPortsInstanceGroupRequest.php @@ -20,31 +20,31 @@ class SetNamedPortsInstanceGroupRequest extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field string instance_group = 81095253 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group = ''; + protected $instance_group = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.InstanceGroupsSetNamedPortsRequest instance_groups_set_named_ports_request_resource = 385151535 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_groups_set_named_ports_request_resource = null; + protected $instance_groups_set_named_ports_request_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone where the instance group is located. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetNamedPortsRegionInstanceGroupRequest.php b/Compute/src/V1/SetNamedPortsRegionInstanceGroupRequest.php index 0df50110cedf..b10aa0c00f96 100644 --- a/Compute/src/V1/SetNamedPortsRegionInstanceGroupRequest.php +++ b/Compute/src/V1/SetNamedPortsRegionInstanceGroupRequest.php @@ -20,31 +20,31 @@ class SetNamedPortsRegionInstanceGroupRequest extends \Google\Protobuf\Internal\ * * Generated from protobuf field string instance_group = 81095253 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group = ''; + protected $instance_group = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.RegionInstanceGroupsSetNamedPortsRequest region_instance_groups_set_named_ports_request_resource = 1574938 [(.google.api.field_behavior) = REQUIRED]; */ - private $region_instance_groups_set_named_ports_request_resource = null; + protected $region_instance_groups_set_named_ports_request_resource = null; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetNodeTemplateNodeGroupRequest.php b/Compute/src/V1/SetNodeTemplateNodeGroupRequest.php index fdcf96995100..25178cd04561 100644 --- a/Compute/src/V1/SetNodeTemplateNodeGroupRequest.php +++ b/Compute/src/V1/SetNodeTemplateNodeGroupRequest.php @@ -20,31 +20,31 @@ class SetNodeTemplateNodeGroupRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string node_group = 469958146 [(.google.api.field_behavior) = REQUIRED]; */ - private $node_group = ''; + protected $node_group = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.NodeGroupsSetNodeTemplateRequest node_groups_set_node_template_request_resource = 117382321 [(.google.api.field_behavior) = REQUIRED]; */ - private $node_groups_set_node_template_request_resource = null; + protected $node_groups_set_node_template_request_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetPrivateIpGoogleAccessSubnetworkRequest.php b/Compute/src/V1/SetPrivateIpGoogleAccessSubnetworkRequest.php index 423cdd65127b..ba10d41e4808 100644 --- a/Compute/src/V1/SetPrivateIpGoogleAccessSubnetworkRequest.php +++ b/Compute/src/V1/SetPrivateIpGoogleAccessSubnetworkRequest.php @@ -20,31 +20,31 @@ class SetPrivateIpGoogleAccessSubnetworkRequest extends \Google\Protobuf\Interna * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name of the Subnetwork resource. * * Generated from protobuf field string subnetwork = 307827694 [(.google.api.field_behavior) = REQUIRED]; */ - private $subnetwork = ''; + protected $subnetwork = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.SubnetworksSetPrivateIpGoogleAccessRequest subnetworks_set_private_ip_google_access_request_resource = 268920696 [(.google.api.field_behavior) = REQUIRED]; */ - private $subnetworks_set_private_ip_google_access_request_resource = null; + protected $subnetworks_set_private_ip_google_access_request_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetProxyHeaderTargetSslProxyRequest.php b/Compute/src/V1/SetProxyHeaderTargetSslProxyRequest.php index 83f6911bddbc..3bfab1f2bb3e 100644 --- a/Compute/src/V1/SetProxyHeaderTargetSslProxyRequest.php +++ b/Compute/src/V1/SetProxyHeaderTargetSslProxyRequest.php @@ -20,25 +20,25 @@ class SetProxyHeaderTargetSslProxyRequest extends \Google\Protobuf\Internal\Mess * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.TargetSslProxiesSetProxyHeaderRequest target_ssl_proxies_set_proxy_header_request_resource = 205284526 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_ssl_proxies_set_proxy_header_request_resource = null; + protected $target_ssl_proxies_set_proxy_header_request_resource = null; /** * Name of the TargetSslProxy resource whose ProxyHeader is to be set. * * Generated from protobuf field string target_ssl_proxy = 338795853 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_ssl_proxy = ''; + protected $target_ssl_proxy = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetProxyHeaderTargetTcpProxyRequest.php b/Compute/src/V1/SetProxyHeaderTargetTcpProxyRequest.php index 455e7ce6cb2e..6ba4edd03a63 100644 --- a/Compute/src/V1/SetProxyHeaderTargetTcpProxyRequest.php +++ b/Compute/src/V1/SetProxyHeaderTargetTcpProxyRequest.php @@ -20,25 +20,25 @@ class SetProxyHeaderTargetTcpProxyRequest extends \Google\Protobuf\Internal\Mess * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.TargetTcpProxiesSetProxyHeaderRequest target_tcp_proxies_set_proxy_header_request_resource = 219958339 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_tcp_proxies_set_proxy_header_request_resource = null; + protected $target_tcp_proxies_set_proxy_header_request_resource = null; /** * Name of the TargetTcpProxy resource whose ProxyHeader is to be set. * * Generated from protobuf field string target_tcp_proxy = 503065442 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_tcp_proxy = ''; + protected $target_tcp_proxy = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetQuicOverrideTargetHttpsProxyRequest.php b/Compute/src/V1/SetQuicOverrideTargetHttpsProxyRequest.php index 1d21a97e13a9..981809ab40f2 100644 --- a/Compute/src/V1/SetQuicOverrideTargetHttpsProxyRequest.php +++ b/Compute/src/V1/SetQuicOverrideTargetHttpsProxyRequest.php @@ -20,25 +20,25 @@ class SetQuicOverrideTargetHttpsProxyRequest extends \Google\Protobuf\Internal\M * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.TargetHttpsProxiesSetQuicOverrideRequest target_https_proxies_set_quic_override_request_resource = 72940258 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_https_proxies_set_quic_override_request_resource = null; + protected $target_https_proxies_set_quic_override_request_resource = null; /** * Name of the TargetHttpsProxy resource to set the QUIC override policy for. The name should conform to RFC1035. * * Generated from protobuf field string target_https_proxy = 52336748 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_https_proxy = ''; + protected $target_https_proxy = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetSchedulingInstanceRequest.php b/Compute/src/V1/SetSchedulingInstanceRequest.php index 4f286dda9360..1c812ffed357 100644 --- a/Compute/src/V1/SetSchedulingInstanceRequest.php +++ b/Compute/src/V1/SetSchedulingInstanceRequest.php @@ -20,31 +20,31 @@ class SetSchedulingInstanceRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string instance = 18257045 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance = ''; + protected $instance = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.Scheduling scheduling_resource = 463181401 [(.google.api.field_behavior) = REQUIRED]; */ - private $scheduling_resource = null; + protected $scheduling_resource = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetSecurityPolicyBackendServiceRequest.php b/Compute/src/V1/SetSecurityPolicyBackendServiceRequest.php index 590d49294d10..6aa0bb298999 100644 --- a/Compute/src/V1/SetSecurityPolicyBackendServiceRequest.php +++ b/Compute/src/V1/SetSecurityPolicyBackendServiceRequest.php @@ -20,25 +20,25 @@ class SetSecurityPolicyBackendServiceRequest extends \Google\Protobuf\Internal\M * * Generated from protobuf field string backend_service = 306946058 [(.google.api.field_behavior) = REQUIRED]; */ - private $backend_service = ''; + protected $backend_service = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.SecurityPolicyReference security_policy_reference_resource = 204135024 [(.google.api.field_behavior) = REQUIRED]; */ - private $security_policy_reference_resource = null; + protected $security_policy_reference_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetSecurityPolicyInstanceRequest.php b/Compute/src/V1/SetSecurityPolicyInstanceRequest.php index d391214e33db..956cf5f3ad69 100644 --- a/Compute/src/V1/SetSecurityPolicyInstanceRequest.php +++ b/Compute/src/V1/SetSecurityPolicyInstanceRequest.php @@ -20,31 +20,31 @@ class SetSecurityPolicyInstanceRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string instance = 18257045 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance = ''; + protected $instance = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.InstancesSetSecurityPolicyRequest instances_set_security_policy_request_resource = 248424586 [(.google.api.field_behavior) = REQUIRED]; */ - private $instances_set_security_policy_request_resource = null; + protected $instances_set_security_policy_request_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name of the zone scoping this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetSecurityPolicyRegionBackendServiceRequest.php b/Compute/src/V1/SetSecurityPolicyRegionBackendServiceRequest.php index b6eb5d8873ea..6e632fbe046c 100644 --- a/Compute/src/V1/SetSecurityPolicyRegionBackendServiceRequest.php +++ b/Compute/src/V1/SetSecurityPolicyRegionBackendServiceRequest.php @@ -20,31 +20,31 @@ class SetSecurityPolicyRegionBackendServiceRequest extends \Google\Protobuf\Inte * * Generated from protobuf field string backend_service = 306946058 [(.google.api.field_behavior) = REQUIRED]; */ - private $backend_service = ''; + protected $backend_service = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.SecurityPolicyReference security_policy_reference_resource = 204135024 [(.google.api.field_behavior) = REQUIRED]; */ - private $security_policy_reference_resource = null; + protected $security_policy_reference_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetSecurityPolicyTargetInstanceRequest.php b/Compute/src/V1/SetSecurityPolicyTargetInstanceRequest.php index d2da2f94168e..d58be6cb7c5e 100644 --- a/Compute/src/V1/SetSecurityPolicyTargetInstanceRequest.php +++ b/Compute/src/V1/SetSecurityPolicyTargetInstanceRequest.php @@ -20,31 +20,31 @@ class SetSecurityPolicyTargetInstanceRequest extends \Google\Protobuf\Internal\M * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.SecurityPolicyReference security_policy_reference_resource = 204135024 [(.google.api.field_behavior) = REQUIRED]; */ - private $security_policy_reference_resource = null; + protected $security_policy_reference_resource = null; /** * Name of the TargetInstance resource to which the security policy should be set. The name should conform to RFC1035. * * Generated from protobuf field string target_instance = 289769347 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_instance = ''; + protected $target_instance = ''; /** * Name of the zone scoping this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetSecurityPolicyTargetPoolRequest.php b/Compute/src/V1/SetSecurityPolicyTargetPoolRequest.php index 783e28f7cdf5..7d406d53c55d 100644 --- a/Compute/src/V1/SetSecurityPolicyTargetPoolRequest.php +++ b/Compute/src/V1/SetSecurityPolicyTargetPoolRequest.php @@ -20,31 +20,31 @@ class SetSecurityPolicyTargetPoolRequest extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.SecurityPolicyReference security_policy_reference_resource = 204135024 [(.google.api.field_behavior) = REQUIRED]; */ - private $security_policy_reference_resource = null; + protected $security_policy_reference_resource = null; /** * Name of the TargetPool resource to which the security policy should be set. The name should conform to RFC1035. * * Generated from protobuf field string target_pool = 62796298 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_pool = ''; + protected $target_pool = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetServiceAccountInstanceRequest.php b/Compute/src/V1/SetServiceAccountInstanceRequest.php index aced7a60b341..9db33e84f705 100644 --- a/Compute/src/V1/SetServiceAccountInstanceRequest.php +++ b/Compute/src/V1/SetServiceAccountInstanceRequest.php @@ -20,31 +20,31 @@ class SetServiceAccountInstanceRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string instance = 18257045 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance = ''; + protected $instance = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.InstancesSetServiceAccountRequest instances_set_service_account_request_resource = 275550008 [(.google.api.field_behavior) = REQUIRED]; */ - private $instances_set_service_account_request_resource = null; + protected $instances_set_service_account_request_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetShieldedInstanceIntegrityPolicyInstanceRequest.php b/Compute/src/V1/SetShieldedInstanceIntegrityPolicyInstanceRequest.php index 81149d85b624..09e1d294aaee 100644 --- a/Compute/src/V1/SetShieldedInstanceIntegrityPolicyInstanceRequest.php +++ b/Compute/src/V1/SetShieldedInstanceIntegrityPolicyInstanceRequest.php @@ -20,31 +20,31 @@ class SetShieldedInstanceIntegrityPolicyInstanceRequest extends \Google\Protobuf * * Generated from protobuf field string instance = 18257045 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance = ''; + protected $instance = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.ShieldedInstanceIntegrityPolicy shielded_instance_integrity_policy_resource = 409169462 [(.google.api.field_behavior) = REQUIRED]; */ - private $shielded_instance_integrity_policy_resource = null; + protected $shielded_instance_integrity_policy_resource = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetSslCertificatesRegionTargetHttpsProxyRequest.php b/Compute/src/V1/SetSslCertificatesRegionTargetHttpsProxyRequest.php index 571c4d005745..76b7906f24c6 100644 --- a/Compute/src/V1/SetSslCertificatesRegionTargetHttpsProxyRequest.php +++ b/Compute/src/V1/SetSslCertificatesRegionTargetHttpsProxyRequest.php @@ -20,31 +20,31 @@ class SetSslCertificatesRegionTargetHttpsProxyRequest extends \Google\Protobuf\I * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.RegionTargetHttpsProxiesSetSslCertificatesRequest region_target_https_proxies_set_ssl_certificates_request_resource = 390693383 [(.google.api.field_behavior) = REQUIRED]; */ - private $region_target_https_proxies_set_ssl_certificates_request_resource = null; + protected $region_target_https_proxies_set_ssl_certificates_request_resource = null; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name of the TargetHttpsProxy resource to set an SslCertificates resource for. * * Generated from protobuf field string target_https_proxy = 52336748 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_https_proxy = ''; + protected $target_https_proxy = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetSslCertificatesTargetHttpsProxyRequest.php b/Compute/src/V1/SetSslCertificatesTargetHttpsProxyRequest.php index 5434fb66de98..ef4ee3d645a5 100644 --- a/Compute/src/V1/SetSslCertificatesTargetHttpsProxyRequest.php +++ b/Compute/src/V1/SetSslCertificatesTargetHttpsProxyRequest.php @@ -20,25 +20,25 @@ class SetSslCertificatesTargetHttpsProxyRequest extends \Google\Protobuf\Interna * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.TargetHttpsProxiesSetSslCertificatesRequest target_https_proxies_set_ssl_certificates_request_resource = 223122908 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_https_proxies_set_ssl_certificates_request_resource = null; + protected $target_https_proxies_set_ssl_certificates_request_resource = null; /** * Name of the TargetHttpsProxy resource to set an SslCertificates resource for. * * Generated from protobuf field string target_https_proxy = 52336748 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_https_proxy = ''; + protected $target_https_proxy = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetSslCertificatesTargetSslProxyRequest.php b/Compute/src/V1/SetSslCertificatesTargetSslProxyRequest.php index ae57540b19b3..d00ba425da87 100644 --- a/Compute/src/V1/SetSslCertificatesTargetSslProxyRequest.php +++ b/Compute/src/V1/SetSslCertificatesTargetSslProxyRequest.php @@ -20,25 +20,25 @@ class SetSslCertificatesTargetSslProxyRequest extends \Google\Protobuf\Internal\ * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.TargetSslProxiesSetSslCertificatesRequest target_ssl_proxies_set_ssl_certificates_request_resource = 147940797 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_ssl_proxies_set_ssl_certificates_request_resource = null; + protected $target_ssl_proxies_set_ssl_certificates_request_resource = null; /** * Name of the TargetSslProxy resource whose SslCertificate resource is to be set. * * Generated from protobuf field string target_ssl_proxy = 338795853 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_ssl_proxy = ''; + protected $target_ssl_proxy = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetSslPolicyTargetHttpsProxyRequest.php b/Compute/src/V1/SetSslPolicyTargetHttpsProxyRequest.php index abd10d482aab..60765ce1cc34 100644 --- a/Compute/src/V1/SetSslPolicyTargetHttpsProxyRequest.php +++ b/Compute/src/V1/SetSslPolicyTargetHttpsProxyRequest.php @@ -20,25 +20,25 @@ class SetSslPolicyTargetHttpsProxyRequest extends \Google\Protobuf\Internal\Mess * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.SslPolicyReference ssl_policy_reference_resource = 235403836 [(.google.api.field_behavior) = REQUIRED]; */ - private $ssl_policy_reference_resource = null; + protected $ssl_policy_reference_resource = null; /** * Name of the TargetHttpsProxy resource whose SSL policy is to be set. The name must be 1-63 characters long, and comply with RFC1035. * * Generated from protobuf field string target_https_proxy = 52336748 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_https_proxy = ''; + protected $target_https_proxy = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetSslPolicyTargetSslProxyRequest.php b/Compute/src/V1/SetSslPolicyTargetSslProxyRequest.php index e2e262d4f6da..1d575555eb22 100644 --- a/Compute/src/V1/SetSslPolicyTargetSslProxyRequest.php +++ b/Compute/src/V1/SetSslPolicyTargetSslProxyRequest.php @@ -20,25 +20,25 @@ class SetSslPolicyTargetSslProxyRequest extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.SslPolicyReference ssl_policy_reference_resource = 235403836 [(.google.api.field_behavior) = REQUIRED]; */ - private $ssl_policy_reference_resource = null; + protected $ssl_policy_reference_resource = null; /** * Name of the TargetSslProxy resource whose SSL policy is to be set. The name must be 1-63 characters long, and comply with RFC1035. * * Generated from protobuf field string target_ssl_proxy = 338795853 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_ssl_proxy = ''; + protected $target_ssl_proxy = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetTagsInstanceRequest.php b/Compute/src/V1/SetTagsInstanceRequest.php index 384be9828df9..c69d3bcf1eda 100644 --- a/Compute/src/V1/SetTagsInstanceRequest.php +++ b/Compute/src/V1/SetTagsInstanceRequest.php @@ -20,31 +20,31 @@ class SetTagsInstanceRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string instance = 18257045 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance = ''; + protected $instance = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.Tags tags_resource = 331435380 [(.google.api.field_behavior) = REQUIRED]; */ - private $tags_resource = null; + protected $tags_resource = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetTargetForwardingRuleRequest.php b/Compute/src/V1/SetTargetForwardingRuleRequest.php index 4eb94cf338ca..71907f4cf4ba 100644 --- a/Compute/src/V1/SetTargetForwardingRuleRequest.php +++ b/Compute/src/V1/SetTargetForwardingRuleRequest.php @@ -20,31 +20,31 @@ class SetTargetForwardingRuleRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string forwarding_rule = 269964030 [(.google.api.field_behavior) = REQUIRED]; */ - private $forwarding_rule = ''; + protected $forwarding_rule = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.TargetReference target_reference_resource = 523721712 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_reference_resource = null; + protected $target_reference_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetTargetGlobalForwardingRuleRequest.php b/Compute/src/V1/SetTargetGlobalForwardingRuleRequest.php index f151aeacd42a..a00a31b22f2e 100644 --- a/Compute/src/V1/SetTargetGlobalForwardingRuleRequest.php +++ b/Compute/src/V1/SetTargetGlobalForwardingRuleRequest.php @@ -20,25 +20,25 @@ class SetTargetGlobalForwardingRuleRequest extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field string forwarding_rule = 269964030 [(.google.api.field_behavior) = REQUIRED]; */ - private $forwarding_rule = ''; + protected $forwarding_rule = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.TargetReference target_reference_resource = 523721712 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_reference_resource = null; + protected $target_reference_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetTargetPoolsInstanceGroupManagerRequest.php b/Compute/src/V1/SetTargetPoolsInstanceGroupManagerRequest.php index 7e0f9bc5fbb6..adc898f8fabd 100644 --- a/Compute/src/V1/SetTargetPoolsInstanceGroupManagerRequest.php +++ b/Compute/src/V1/SetTargetPoolsInstanceGroupManagerRequest.php @@ -20,31 +20,31 @@ class SetTargetPoolsInstanceGroupManagerRequest extends \Google\Protobuf\Interna * * Generated from protobuf field string instance_group_manager = 249363395 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group_manager = ''; + protected $instance_group_manager = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.InstanceGroupManagersSetTargetPoolsRequest instance_group_managers_set_target_pools_request_resource = 281150216 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group_managers_set_target_pools_request_resource = null; + protected $instance_group_managers_set_target_pools_request_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone where the managed instance group is located. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetTargetPoolsRegionInstanceGroupManagerRequest.php b/Compute/src/V1/SetTargetPoolsRegionInstanceGroupManagerRequest.php index 39f24830bc87..45d1be5ca21b 100644 --- a/Compute/src/V1/SetTargetPoolsRegionInstanceGroupManagerRequest.php +++ b/Compute/src/V1/SetTargetPoolsRegionInstanceGroupManagerRequest.php @@ -20,31 +20,31 @@ class SetTargetPoolsRegionInstanceGroupManagerRequest extends \Google\Protobuf\I * * Generated from protobuf field string instance_group_manager = 249363395 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group_manager = ''; + protected $instance_group_manager = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.RegionInstanceGroupManagersSetTargetPoolsRequest region_instance_group_managers_set_target_pools_request_resource = 78734717 [(.google.api.field_behavior) = REQUIRED]; */ - private $region_instance_group_managers_set_target_pools_request_resource = null; + protected $region_instance_group_managers_set_target_pools_request_resource = null; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetUrlMapRegionTargetHttpProxyRequest.php b/Compute/src/V1/SetUrlMapRegionTargetHttpProxyRequest.php index bfd593b14f47..ac999df310cd 100644 --- a/Compute/src/V1/SetUrlMapRegionTargetHttpProxyRequest.php +++ b/Compute/src/V1/SetUrlMapRegionTargetHttpProxyRequest.php @@ -20,31 +20,31 @@ class SetUrlMapRegionTargetHttpProxyRequest extends \Google\Protobuf\Internal\Me * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name of the TargetHttpProxy to set a URL map for. * * Generated from protobuf field string target_http_proxy = 206872421 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_http_proxy = ''; + protected $target_http_proxy = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.UrlMapReference url_map_reference_resource = 398701333 [(.google.api.field_behavior) = REQUIRED]; */ - private $url_map_reference_resource = null; + protected $url_map_reference_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetUrlMapRegionTargetHttpsProxyRequest.php b/Compute/src/V1/SetUrlMapRegionTargetHttpsProxyRequest.php index c3e1f9edebd5..36383272a46a 100644 --- a/Compute/src/V1/SetUrlMapRegionTargetHttpsProxyRequest.php +++ b/Compute/src/V1/SetUrlMapRegionTargetHttpsProxyRequest.php @@ -20,31 +20,31 @@ class SetUrlMapRegionTargetHttpsProxyRequest extends \Google\Protobuf\Internal\M * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name of the TargetHttpsProxy to set a URL map for. * * Generated from protobuf field string target_https_proxy = 52336748 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_https_proxy = ''; + protected $target_https_proxy = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.UrlMapReference url_map_reference_resource = 398701333 [(.google.api.field_behavior) = REQUIRED]; */ - private $url_map_reference_resource = null; + protected $url_map_reference_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetUrlMapTargetHttpProxyRequest.php b/Compute/src/V1/SetUrlMapTargetHttpProxyRequest.php index 62288d31bae9..fb7745142b55 100644 --- a/Compute/src/V1/SetUrlMapTargetHttpProxyRequest.php +++ b/Compute/src/V1/SetUrlMapTargetHttpProxyRequest.php @@ -20,25 +20,25 @@ class SetUrlMapTargetHttpProxyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name of the TargetHttpProxy to set a URL map for. * * Generated from protobuf field string target_http_proxy = 206872421 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_http_proxy = ''; + protected $target_http_proxy = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.UrlMapReference url_map_reference_resource = 398701333 [(.google.api.field_behavior) = REQUIRED]; */ - private $url_map_reference_resource = null; + protected $url_map_reference_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetUrlMapTargetHttpsProxyRequest.php b/Compute/src/V1/SetUrlMapTargetHttpsProxyRequest.php index e81fb8813a09..1461f6f69eab 100644 --- a/Compute/src/V1/SetUrlMapTargetHttpsProxyRequest.php +++ b/Compute/src/V1/SetUrlMapTargetHttpsProxyRequest.php @@ -20,25 +20,25 @@ class SetUrlMapTargetHttpsProxyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name of the TargetHttpsProxy resource whose URL map is to be set. * * Generated from protobuf field string target_https_proxy = 52336748 [(.google.api.field_behavior) = REQUIRED]; */ - private $target_https_proxy = ''; + protected $target_https_proxy = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.UrlMapReference url_map_reference_resource = 398701333 [(.google.api.field_behavior) = REQUIRED]; */ - private $url_map_reference_resource = null; + protected $url_map_reference_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SetUsageExportBucketProjectRequest.php b/Compute/src/V1/SetUsageExportBucketProjectRequest.php index c4800632c3dd..8f0473ac61a9 100644 --- a/Compute/src/V1/SetUsageExportBucketProjectRequest.php +++ b/Compute/src/V1/SetUsageExportBucketProjectRequest.php @@ -20,19 +20,19 @@ class SetUsageExportBucketProjectRequest extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.UsageExportLocation usage_export_location_resource = 20260459 [(.google.api.field_behavior) = REQUIRED]; */ - private $usage_export_location_resource = null; + protected $usage_export_location_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ShareSettings.php b/Compute/src/V1/ShareSettings.php index 7a796689d1ef..15b1bc2bd3e5 100644 --- a/Compute/src/V1/ShareSettings.php +++ b/Compute/src/V1/ShareSettings.php @@ -27,7 +27,7 @@ class ShareSettings extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string share_type = 359533466; */ - private $share_type = null; + protected $share_type = null; /** * Constructor. diff --git a/Compute/src/V1/ShareSettingsProjectConfig.php b/Compute/src/V1/ShareSettingsProjectConfig.php index fbb10afea2ff..85bddab767cf 100644 --- a/Compute/src/V1/ShareSettingsProjectConfig.php +++ b/Compute/src/V1/ShareSettingsProjectConfig.php @@ -20,7 +20,7 @@ class ShareSettingsProjectConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string project_id = 177513473; */ - private $project_id = null; + protected $project_id = null; /** * Constructor. diff --git a/Compute/src/V1/ShieldedInstanceConfig.php b/Compute/src/V1/ShieldedInstanceConfig.php index be8dce00e776..81eded53679b 100644 --- a/Compute/src/V1/ShieldedInstanceConfig.php +++ b/Compute/src/V1/ShieldedInstanceConfig.php @@ -20,19 +20,19 @@ class ShieldedInstanceConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional bool enable_integrity_monitoring = 409071030; */ - private $enable_integrity_monitoring = null; + protected $enable_integrity_monitoring = null; /** * Defines whether the instance has Secure Boot enabled. Disabled by default. * * Generated from protobuf field optional bool enable_secure_boot = 123568638; */ - private $enable_secure_boot = null; + protected $enable_secure_boot = null; /** * Defines whether the instance has the vTPM enabled. Enabled by default. * * Generated from protobuf field optional bool enable_vtpm = 181858935; */ - private $enable_vtpm = null; + protected $enable_vtpm = null; /** * Constructor. diff --git a/Compute/src/V1/ShieldedInstanceIdentity.php b/Compute/src/V1/ShieldedInstanceIdentity.php index c165465ed01f..bfb585c42f54 100644 --- a/Compute/src/V1/ShieldedInstanceIdentity.php +++ b/Compute/src/V1/ShieldedInstanceIdentity.php @@ -20,19 +20,19 @@ class ShieldedInstanceIdentity extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.ShieldedInstanceIdentityEntry encryption_key = 488268707; */ - private $encryption_key = null; + protected $encryption_key = null; /** * [Output Only] Type of the resource. Always compute#shieldedInstanceIdentity for shielded Instance identity entry. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * An Attestation Key (AK) made by the RSA 2048 algorithm issued to the Shielded Instance's vTPM. * * Generated from protobuf field optional .google.cloud.compute.v1.ShieldedInstanceIdentityEntry signing_key = 320948261; */ - private $signing_key = null; + protected $signing_key = null; /** * Constructor. diff --git a/Compute/src/V1/ShieldedInstanceIdentityEntry.php b/Compute/src/V1/ShieldedInstanceIdentityEntry.php index b31692f8eb06..9f28c5be3f0e 100644 --- a/Compute/src/V1/ShieldedInstanceIdentityEntry.php +++ b/Compute/src/V1/ShieldedInstanceIdentityEntry.php @@ -20,13 +20,13 @@ class ShieldedInstanceIdentityEntry extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string ek_cert = 450178589; */ - private $ek_cert = null; + protected $ek_cert = null; /** * A PEM-encoded public key. * * Generated from protobuf field optional string ek_pub = 308947940; */ - private $ek_pub = null; + protected $ek_pub = null; /** * Constructor. diff --git a/Compute/src/V1/ShieldedInstanceIntegrityPolicy.php b/Compute/src/V1/ShieldedInstanceIntegrityPolicy.php index 543e0ca08eeb..a8f02bfc3e65 100644 --- a/Compute/src/V1/ShieldedInstanceIntegrityPolicy.php +++ b/Compute/src/V1/ShieldedInstanceIntegrityPolicy.php @@ -20,7 +20,7 @@ class ShieldedInstanceIntegrityPolicy extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional bool update_auto_learn_policy = 245490215; */ - private $update_auto_learn_policy = null; + protected $update_auto_learn_policy = null; /** * Constructor. diff --git a/Compute/src/V1/SignedUrlKey.php b/Compute/src/V1/SignedUrlKey.php index 17e138a01637..692d45166f6b 100644 --- a/Compute/src/V1/SignedUrlKey.php +++ b/Compute/src/V1/SignedUrlKey.php @@ -20,13 +20,13 @@ class SignedUrlKey extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string key_name = 500938859; */ - private $key_name = null; + protected $key_name = null; /** * 128-bit key value used for signing the URL. The key value must be a valid RFC 4648 Section 5 base64url encoded string. * * Generated from protobuf field optional string key_value = 504106897; */ - private $key_value = null; + protected $key_value = null; /** * Constructor. diff --git a/Compute/src/V1/SimulateMaintenanceEventInstanceRequest.php b/Compute/src/V1/SimulateMaintenanceEventInstanceRequest.php index 0dc529d8832a..41bdb9212ba9 100644 --- a/Compute/src/V1/SimulateMaintenanceEventInstanceRequest.php +++ b/Compute/src/V1/SimulateMaintenanceEventInstanceRequest.php @@ -20,31 +20,31 @@ class SimulateMaintenanceEventInstanceRequest extends \Google\Protobuf\Internal\ * * Generated from protobuf field string instance = 18257045 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance = ''; + protected $instance = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Determines whether the customers receive notifications before migration. Only applicable to SF vms. * * Generated from protobuf field optional bool with_extended_notifications = 405957627; */ - private $with_extended_notifications = null; + protected $with_extended_notifications = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SimulateMaintenanceEventNodeGroupRequest.php b/Compute/src/V1/SimulateMaintenanceEventNodeGroupRequest.php index b44de9972bda..d6a66d782911 100644 --- a/Compute/src/V1/SimulateMaintenanceEventNodeGroupRequest.php +++ b/Compute/src/V1/SimulateMaintenanceEventNodeGroupRequest.php @@ -20,31 +20,31 @@ class SimulateMaintenanceEventNodeGroupRequest extends \Google\Protobuf\Internal * * Generated from protobuf field string node_group = 469958146 [(.google.api.field_behavior) = REQUIRED]; */ - private $node_group = ''; + protected $node_group = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.NodeGroupsSimulateMaintenanceEventRequest node_groups_simulate_maintenance_event_request_resource = 351468764 [(.google.api.field_behavior) = REQUIRED]; */ - private $node_groups_simulate_maintenance_event_request_resource = null; + protected $node_groups_simulate_maintenance_event_request_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/Snapshot.php b/Compute/src/V1/Snapshot.php index 398c0d46fcb9..26b8fd8ddcd9 100644 --- a/Compute/src/V1/Snapshot.php +++ b/Compute/src/V1/Snapshot.php @@ -21,61 +21,61 @@ class Snapshot extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string architecture = 302803283; */ - private $architecture = null; + protected $architecture = null; /** * [Output Only] Set to true if snapshots are automatically created by applying resource policy on the target disk. * * Generated from protobuf field optional bool auto_created = 463922264; */ - private $auto_created = null; + protected $auto_created = null; /** * Creates the new snapshot in the snapshot chain labeled with the specified name. The chain name must be 1-63 characters long and comply with RFC1035. This is an uncommon option only for advanced service owners who needs to create separate snapshot chains, for example, for chargeback tracking. When you describe your snapshot resource, this field is visible only if it has a non-empty value. * * Generated from protobuf field optional string chain_name = 68644169; */ - private $chain_name = null; + protected $chain_name = null; /** * [Output Only] Size in bytes of the snapshot at creation time. * * Generated from protobuf field optional int64 creation_size_bytes = 125400077; */ - private $creation_size_bytes = null; + protected $creation_size_bytes = null; /** * [Output Only] Creation timestamp in RFC3339 text format. * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * An optional description of this resource. Provide this property when you create the resource. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * [Output Only] Size of the source disk, specified in GB. * * Generated from protobuf field optional int64 disk_size_gb = 316263735; */ - private $disk_size_gb = null; + protected $disk_size_gb = null; /** * [Output Only] Number of bytes downloaded to restore a snapshot to a disk. * * Generated from protobuf field optional int64 download_bytes = 435054068; */ - private $download_bytes = null; + protected $download_bytes = null; /** * Whether this snapshot is created from a confidential compute mode disk. [Output Only]: This field is not set by user, but from source disk. * * Generated from protobuf field optional bool enable_confidential_compute = 102135228; */ - private $enable_confidential_compute = null; + protected $enable_confidential_compute = null; /** * [Input Only] Whether to attempt an application consistent snapshot by informing the OS to prepare for the snapshot process. * * Generated from protobuf field optional bool guest_flush = 385550813; */ - private $guest_flush = null; + protected $guest_flush = null; /** * [Output Only] A list of features to enable on the guest operating system. Applicable only for bootable images. Read Enabling guest operating system features to see a list of available options. * @@ -87,19 +87,19 @@ class Snapshot extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * [Output Only] Type of the resource. Always compute#snapshot for Snapshot resources. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * A fingerprint for the labels being applied to this snapshot, which is essentially a hash of the labels set used for optimistic locking. The fingerprint is initially generated by Compute Engine and changes after every request to modify or update labels. You must always provide an up-to-date fingerprint hash in order to update or change labels, otherwise the request will fail with error 412 conditionNotMet. To see the latest fingerprint, make a get() request to retrieve a snapshot. * * Generated from protobuf field optional string label_fingerprint = 178124825; */ - private $label_fingerprint = null; + protected $label_fingerprint = null; /** * Labels to apply to this snapshot. These can be later modified by the setLabels method. Label values may be empty. * @@ -123,118 +123,118 @@ class Snapshot extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string location_hint = 350519505; */ - private $location_hint = null; + protected $location_hint = null; /** * Name of the resource; provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * Output only. Reserved for future use. * * Generated from protobuf field optional bool satisfies_pzi = 480964257; */ - private $satisfies_pzi = null; + protected $satisfies_pzi = null; /** * [Output Only] Reserved for future use. * * Generated from protobuf field optional bool satisfies_pzs = 480964267; */ - private $satisfies_pzs = null; + protected $satisfies_pzs = null; /** * [Output Only] Server-defined URL for the resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * Encrypts the snapshot using a customer-supplied encryption key. After you encrypt a snapshot using a customer-supplied key, you must provide the same key if you use the snapshot later. For example, you must provide the encryption key when you create a disk from the encrypted snapshot in a future request. Customer-supplied encryption keys do not protect access to metadata of the snapshot. If you do not provide an encryption key when creating the snapshot, then the snapshot will be encrypted using an automatically generated key and you do not need to provide a key to use the snapshot later. * * Generated from protobuf field optional .google.cloud.compute.v1.CustomerEncryptionKey snapshot_encryption_key = 43334526; */ - private $snapshot_encryption_key = null; + protected $snapshot_encryption_key = null; /** * Indicates the type of the snapshot. * Check the SnapshotType enum for the list of possible values. * * Generated from protobuf field optional string snapshot_type = 124349653; */ - private $snapshot_type = null; + protected $snapshot_type = null; /** * The source disk used to create this snapshot. * * Generated from protobuf field optional string source_disk = 451753793; */ - private $source_disk = null; + protected $source_disk = null; /** * The customer-supplied encryption key of the source disk. Required if the source disk is protected by a customer-supplied encryption key. * * Generated from protobuf field optional .google.cloud.compute.v1.CustomerEncryptionKey source_disk_encryption_key = 531501153; */ - private $source_disk_encryption_key = null; + protected $source_disk_encryption_key = null; /** * The source disk whose recovery checkpoint will be used to create this snapshot. * * Generated from protobuf field optional string source_disk_for_recovery_checkpoint = 359837950; */ - private $source_disk_for_recovery_checkpoint = null; + protected $source_disk_for_recovery_checkpoint = null; /** * [Output Only] The ID value of the disk used to create this snapshot. This value may be used to determine whether the snapshot was taken from the current or a previous instance of a given disk name. * * Generated from protobuf field optional string source_disk_id = 454190809; */ - private $source_disk_id = null; + protected $source_disk_id = null; /** * The source instant snapshot used to create this snapshot. You can provide this as a partial or full URL to the resource. For example, the following are valid values: - https://www.googleapis.com/compute/v1/projects/project/zones/zone /instantSnapshots/instantSnapshot - projects/project/zones/zone/instantSnapshots/instantSnapshot - zones/zone/instantSnapshots/instantSnapshot * * Generated from protobuf field optional string source_instant_snapshot = 219202054; */ - private $source_instant_snapshot = null; + protected $source_instant_snapshot = null; /** * Customer provided encryption key when creating Snapshot from Instant Snapshot. * * Generated from protobuf field optional .google.cloud.compute.v1.CustomerEncryptionKey source_instant_snapshot_encryption_key = 436536060; */ - private $source_instant_snapshot_encryption_key = null; + protected $source_instant_snapshot_encryption_key = null; /** * [Output Only] The unique ID of the instant snapshot used to create this snapshot. This value identifies the exact instant snapshot that was used to create this snapshot. For example, if you created the snapshot from an instant snapshot that was later deleted and recreated under the same name, the source instant snapshot ID would identify the exact instant snapshot that was used. * * Generated from protobuf field optional string source_instant_snapshot_id = 287582708; */ - private $source_instant_snapshot_id = null; + protected $source_instant_snapshot_id = null; /** * [Output Only] URL of the resource policy which created this scheduled snapshot. * * Generated from protobuf field optional string source_snapshot_schedule_policy = 235756291; */ - private $source_snapshot_schedule_policy = null; + protected $source_snapshot_schedule_policy = null; /** * [Output Only] ID of the resource policy which created this scheduled snapshot. * * Generated from protobuf field optional string source_snapshot_schedule_policy_id = 70489047; */ - private $source_snapshot_schedule_policy_id = null; + protected $source_snapshot_schedule_policy_id = null; /** * [Output Only] The status of the snapshot. This can be CREATING, DELETING, FAILED, READY, or UPLOADING. * Check the Status enum for the list of possible values. * * Generated from protobuf field optional string status = 181260274; */ - private $status = null; + protected $status = null; /** * [Output Only] A size of the storage used by the snapshot. As snapshots share storage, this number is expected to change with snapshot creation/deletion. * * Generated from protobuf field optional int64 storage_bytes = 424631719; */ - private $storage_bytes = null; + protected $storage_bytes = null; /** * [Output Only] An indicator whether storageBytes is in a stable state or it is being adjusted as a result of shared storage reallocation. This status can either be UPDATING, meaning the size of the snapshot is being updated, or UP_TO_DATE, meaning the size of the snapshot is up-to-date. * Check the StorageBytesStatus enum for the list of possible values. * * Generated from protobuf field optional string storage_bytes_status = 490739082; */ - private $storage_bytes_status = null; + protected $storage_bytes_status = null; /** * Cloud Storage bucket storage location of the snapshot (regional or multi-regional). * diff --git a/Compute/src/V1/SnapshotList.php b/Compute/src/V1/SnapshotList.php index 73ac9b8d786a..de072186682d 100644 --- a/Compute/src/V1/SnapshotList.php +++ b/Compute/src/V1/SnapshotList.php @@ -20,7 +20,7 @@ class SnapshotList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of Snapshot resources. * @@ -32,25 +32,25 @@ class SnapshotList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/SnapshotSettings.php b/Compute/src/V1/SnapshotSettings.php index b293af607adc..932deecd5385 100644 --- a/Compute/src/V1/SnapshotSettings.php +++ b/Compute/src/V1/SnapshotSettings.php @@ -19,7 +19,7 @@ class SnapshotSettings extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.SnapshotSettingsStorageLocationSettings storage_location = 460859641; */ - private $storage_location = null; + protected $storage_location = null; /** * Constructor. diff --git a/Compute/src/V1/SnapshotSettingsServiceClient.php b/Compute/src/V1/SnapshotSettingsServiceClient.php deleted file mode 100644 index 87fb43132e01..000000000000 --- a/Compute/src/V1/SnapshotSettingsServiceClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional string policy = 91071794; */ - private $policy = null; + protected $policy = null; /** * Constructor. diff --git a/Compute/src/V1/SnapshotSettingsStorageLocationSettingsStorageLocationPreference.php b/Compute/src/V1/SnapshotSettingsStorageLocationSettingsStorageLocationPreference.php index b427ce2d026a..d3f309218c82 100644 --- a/Compute/src/V1/SnapshotSettingsStorageLocationSettingsStorageLocationPreference.php +++ b/Compute/src/V1/SnapshotSettingsStorageLocationSettingsStorageLocationPreference.php @@ -20,7 +20,7 @@ class SnapshotSettingsStorageLocationSettingsStorageLocationPreference extends \ * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * Constructor. diff --git a/Compute/src/V1/SnapshotsClient.php b/Compute/src/V1/SnapshotsClient.php deleted file mode 100644 index c96ffe152f97..000000000000 --- a/Compute/src/V1/SnapshotsClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional .google.cloud.compute.v1.CustomerEncryptionKey disk_encryption_key = 271660677; */ - private $disk_encryption_key = null; + protected $disk_encryption_key = null; /** * URL of the disk attached to the source instance. This can be a full or valid partial URL. For example, the following are valid values: - https://www.googleapis.com/compute/v1/projects/project/zones/zone /disks/disk - projects/project/zones/zone/disks/disk - zones/zone/disks/disk * * Generated from protobuf field optional string source_disk = 451753793; */ - private $source_disk = null; + protected $source_disk = null; /** * Constructor. diff --git a/Compute/src/V1/SourceInstanceProperties.php b/Compute/src/V1/SourceInstanceProperties.php index 0a03a4b01d6a..148701fc8ec8 100644 --- a/Compute/src/V1/SourceInstanceProperties.php +++ b/Compute/src/V1/SourceInstanceProperties.php @@ -20,19 +20,19 @@ class SourceInstanceProperties extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional bool can_ip_forward = 467731324; */ - private $can_ip_forward = null; + protected $can_ip_forward = null; /** * Whether the instance created from this machine image should be protected against deletion. * * Generated from protobuf field optional bool deletion_protection = 458014698; */ - private $deletion_protection = null; + protected $deletion_protection = null; /** * An optional text description for the instances that are created from this machine image. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * An array of disks that are associated with the instances that are created from this machine image. * @@ -51,7 +51,7 @@ class SourceInstanceProperties extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string key_revocation_action_type = 235941474; */ - private $key_revocation_action_type = null; + protected $key_revocation_action_type = null; /** * Labels to apply to instances that are created from this machine image. * @@ -63,19 +63,19 @@ class SourceInstanceProperties extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string machine_type = 227711026; */ - private $machine_type = null; + protected $machine_type = null; /** * The metadata key/value pairs to assign to instances that are created from this machine image. These pairs can consist of custom metadata or predefined keys. See Project and instance metadata for more information. * * Generated from protobuf field optional .google.cloud.compute.v1.Metadata metadata = 86866735; */ - private $metadata = null; + protected $metadata = null; /** * Minimum cpu/platform to be used by instances created from this machine image. The instance may be scheduled on the specified or newer cpu/platform. Applicable values are the friendly names of CPU platforms, such as minCpuPlatform: "Intel Haswell" or minCpuPlatform: "Intel Sandy Bridge". For more information, read Specifying a Minimum CPU Platform. * * Generated from protobuf field optional string min_cpu_platform = 242912759; */ - private $min_cpu_platform = null; + protected $min_cpu_platform = null; /** * An array of network access configurations for this interface. * @@ -87,7 +87,7 @@ class SourceInstanceProperties extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.Scheduling scheduling = 386688404; */ - private $scheduling = null; + protected $scheduling = null; /** * A list of service accounts with specified scopes. Access tokens for these service accounts are available to the instances that are created from this machine image. Use metadata queries to obtain the access tokens for these instances. * @@ -99,7 +99,7 @@ class SourceInstanceProperties extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.Tags tags = 3552281; */ - private $tags = null; + protected $tags = null; /** * Constructor. diff --git a/Compute/src/V1/SslCertificate.php b/Compute/src/V1/SslCertificate.php index 69427a806641..cdaa642665d5 100644 --- a/Compute/src/V1/SslCertificate.php +++ b/Compute/src/V1/SslCertificate.php @@ -9,7 +9,7 @@ use Google\Protobuf\Internal\GPBUtil; /** - * Represents an SSL certificate resource. Google Compute Engine has two SSL certificate resources: * [Global](/compute/docs/reference/rest/v1/sslCertificates) * [Regional](https://cloud.google.com/compute/docs/reference/rest/v1/regionSslCertificates) The global SSL certificates (sslCertificates) are used by: - Global external Application Load Balancers - Classic Application Load Balancers - Proxy Network Load Balancers (with target SSL proxies) The regional SSL certificates (regionSslCertificates) are used by: - Regional external Application Load Balancers - Regional internal Application Load Balancers Optionally, certificate file contents that you upload can contain a set of up to five PEM-encoded certificates. The API call creates an object (sslCertificate) that holds this data. You can use SSL keys and certificates to secure connections to a load balancer. For more information, read Creating and using SSL certificates, SSL certificates quotas and limits, and Troubleshooting SSL certificates. + * Represents an SSL certificate resource. Google Compute Engine has two SSL certificate resources: * [Global](/compute/docs/reference/rest/v1/sslCertificates) * [Regional](/compute/docs/reference/rest/v1/regionSslCertificates) The global SSL certificates (sslCertificates) are used by: - Global external Application Load Balancers - Classic Application Load Balancers - Proxy Network Load Balancers (with target SSL proxies) The regional SSL certificates (regionSslCertificates) are used by: - Regional external Application Load Balancers - Regional internal Application Load Balancers Optionally, certificate file contents that you upload can contain a set of up to five PEM-encoded certificates. The API call creates an object (sslCertificate) that holds this data. You can use SSL keys and certificates to secure connections to a load balancer. For more information, read Creating and using SSL certificates, SSL certificates quotas and limits, and Troubleshooting SSL certificates. * * Generated from protobuf message google.cloud.compute.v1.SslCertificate */ @@ -20,73 +20,73 @@ class SslCertificate extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string certificate = 341787031; */ - private $certificate = null; + protected $certificate = null; /** * [Output Only] Creation timestamp in RFC3339 text format. * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * An optional description of this resource. Provide this property when you create the resource. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * [Output Only] Expire time of the certificate. RFC3339 * * Generated from protobuf field optional string expire_time = 440691181; */ - private $expire_time = null; + protected $expire_time = null; /** * [Output Only] The unique identifier for the resource. This identifier is defined by the server. * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * [Output Only] Type of the resource. Always compute#sslCertificate for SSL certificates. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * Configuration and status of a managed SSL certificate. * * Generated from protobuf field optional .google.cloud.compute.v1.SslCertificateManagedSslCertificate managed = 298389407; */ - private $managed = null; + protected $managed = null; /** * Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * A value read into memory from a write-only private key file. The private key file must be in PEM format. For security, only insert requests include this field. * * Generated from protobuf field optional string private_key = 361331107; */ - private $private_key = null; + protected $private_key = null; /** * [Output Only] URL of the region where the regional SSL Certificate resides. This field is not applicable to global SSL Certificate. * * Generated from protobuf field optional string region = 138946292; */ - private $region = null; + protected $region = null; /** * [Output only] Server-defined URL for the resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * Configuration and status of a self-managed SSL certificate. * * Generated from protobuf field optional .google.cloud.compute.v1.SslCertificateSelfManagedSslCertificate self_managed = 329284012; */ - private $self_managed = null; + protected $self_managed = null; /** * [Output Only] Domains associated with the certificate via Subject Alternative Name. * @@ -99,7 +99,7 @@ class SslCertificate extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string type = 3575610; */ - private $type = null; + protected $type = null; /** * Constructor. diff --git a/Compute/src/V1/SslCertificateAggregatedList.php b/Compute/src/V1/SslCertificateAggregatedList.php index 72f509a24329..75f0ec6f5dfc 100644 --- a/Compute/src/V1/SslCertificateAggregatedList.php +++ b/Compute/src/V1/SslCertificateAggregatedList.php @@ -19,7 +19,7 @@ class SslCertificateAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of SslCertificatesScopedList resources. * @@ -31,19 +31,19 @@ class SslCertificateAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Unreachable resources. * @@ -55,7 +55,7 @@ class SslCertificateAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/SslCertificateList.php b/Compute/src/V1/SslCertificateList.php index fff5daa70d37..8e4026985531 100644 --- a/Compute/src/V1/SslCertificateList.php +++ b/Compute/src/V1/SslCertificateList.php @@ -20,7 +20,7 @@ class SslCertificateList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of SslCertificate resources. * @@ -32,25 +32,25 @@ class SslCertificateList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/SslCertificateManagedSslCertificate.php b/Compute/src/V1/SslCertificateManagedSslCertificate.php index 0b2102fb782d..ad4afe804104 100644 --- a/Compute/src/V1/SslCertificateManagedSslCertificate.php +++ b/Compute/src/V1/SslCertificateManagedSslCertificate.php @@ -22,7 +22,7 @@ class SslCertificateManagedSslCertificate extends \Google\Protobuf\Internal\Mess */ private $domain_status; /** - * The domains for which a managed SSL certificate will be generated. Each Google-managed SSL certificate supports up to the [maximum number of domains per Google-managed SSL certificate](https://cloud.google.com/load-balancing/docs/quotas#ssl_certificates). + * The domains for which a managed SSL certificate will be generated. Each Google-managed SSL certificate supports up to the [maximum number of domains per Google-managed SSL certificate](/load-balancing/docs/quotas#ssl_certificates). * * Generated from protobuf field repeated string domains = 226935855; */ @@ -33,7 +33,7 @@ class SslCertificateManagedSslCertificate extends \Google\Protobuf\Internal\Mess * * Generated from protobuf field optional string status = 181260274; */ - private $status = null; + protected $status = null; /** * Constructor. @@ -44,7 +44,7 @@ class SslCertificateManagedSslCertificate extends \Google\Protobuf\Internal\Mess * @type array|\Google\Protobuf\Internal\MapField $domain_status * [Output only] Detailed statuses of the domains specified for managed certificate resource. * @type array|\Google\Protobuf\Internal\RepeatedField $domains - * The domains for which a managed SSL certificate will be generated. Each Google-managed SSL certificate supports up to the [maximum number of domains per Google-managed SSL certificate](https://cloud.google.com/load-balancing/docs/quotas#ssl_certificates). + * The domains for which a managed SSL certificate will be generated. Each Google-managed SSL certificate supports up to the [maximum number of domains per Google-managed SSL certificate](/load-balancing/docs/quotas#ssl_certificates). * @type string $status * [Output only] Status of the managed certificate resource. * Check the Status enum for the list of possible values. @@ -82,7 +82,7 @@ public function setDomainStatus($var) } /** - * The domains for which a managed SSL certificate will be generated. Each Google-managed SSL certificate supports up to the [maximum number of domains per Google-managed SSL certificate](https://cloud.google.com/load-balancing/docs/quotas#ssl_certificates). + * The domains for which a managed SSL certificate will be generated. Each Google-managed SSL certificate supports up to the [maximum number of domains per Google-managed SSL certificate](/load-balancing/docs/quotas#ssl_certificates). * * Generated from protobuf field repeated string domains = 226935855; * @return \Google\Protobuf\Internal\RepeatedField @@ -93,7 +93,7 @@ public function getDomains() } /** - * The domains for which a managed SSL certificate will be generated. Each Google-managed SSL certificate supports up to the [maximum number of domains per Google-managed SSL certificate](https://cloud.google.com/load-balancing/docs/quotas#ssl_certificates). + * The domains for which a managed SSL certificate will be generated. Each Google-managed SSL certificate supports up to the [maximum number of domains per Google-managed SSL certificate](/load-balancing/docs/quotas#ssl_certificates). * * Generated from protobuf field repeated string domains = 226935855; * @param array|\Google\Protobuf\Internal\RepeatedField $var diff --git a/Compute/src/V1/SslCertificateSelfManagedSslCertificate.php b/Compute/src/V1/SslCertificateSelfManagedSslCertificate.php index 07abedfac962..68cbc09e74be 100644 --- a/Compute/src/V1/SslCertificateSelfManagedSslCertificate.php +++ b/Compute/src/V1/SslCertificateSelfManagedSslCertificate.php @@ -20,13 +20,13 @@ class SslCertificateSelfManagedSslCertificate extends \Google\Protobuf\Internal\ * * Generated from protobuf field optional string certificate = 341787031; */ - private $certificate = null; + protected $certificate = null; /** * A write-only private key in PEM format. Only insert requests will include this field. * * Generated from protobuf field optional string private_key = 361331107; */ - private $private_key = null; + protected $private_key = null; /** * Constructor. diff --git a/Compute/src/V1/SslCertificatesClient.php b/Compute/src/V1/SslCertificatesClient.php deleted file mode 100644 index 47ffe243d564..000000000000 --- a/Compute/src/V1/SslCertificatesClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/SslPoliciesAggregatedList.php b/Compute/src/V1/SslPoliciesAggregatedList.php index db5ff728344b..55af644842d5 100644 --- a/Compute/src/V1/SslPoliciesAggregatedList.php +++ b/Compute/src/V1/SslPoliciesAggregatedList.php @@ -17,13 +17,13 @@ class SslPoliciesAggregatedList extends \Google\Protobuf\Internal\Message /** * Generated from protobuf field optional string etag = 3123477; */ - private $etag = null; + protected $etag = null; /** * [Output Only] Unique identifier for the resource; defined by the server. * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of SslPoliciesScopedList resources. * @@ -35,19 +35,19 @@ class SslPoliciesAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Unreachable resources. * @@ -59,7 +59,7 @@ class SslPoliciesAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/SslPoliciesClient.php b/Compute/src/V1/SslPoliciesClient.php deleted file mode 100644 index d233ecc41471..000000000000 --- a/Compute/src/V1/SslPoliciesClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of SslPolicy resources. * @@ -31,25 +31,25 @@ class SslPoliciesList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/SslPoliciesScopedList.php b/Compute/src/V1/SslPoliciesScopedList.php index ec46fbc7cc32..63a901c49156 100644 --- a/Compute/src/V1/SslPoliciesScopedList.php +++ b/Compute/src/V1/SslPoliciesScopedList.php @@ -25,7 +25,7 @@ class SslPoliciesScopedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/SslPolicy.php b/Compute/src/V1/SslPolicy.php index 023acf45affa..18c709b4d9a4 100644 --- a/Compute/src/V1/SslPolicy.php +++ b/Compute/src/V1/SslPolicy.php @@ -20,7 +20,7 @@ class SslPolicy extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * A list of features enabled when the selected profile is CUSTOM. The method returns the set of features that can be specified in this list. This field must be empty if the profile is not CUSTOM. * @@ -32,7 +32,7 @@ class SslPolicy extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * [Output Only] The list of features enabled in the SSL policy. * @@ -44,51 +44,51 @@ class SslPolicy extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string fingerprint = 234678500; */ - private $fingerprint = null; + protected $fingerprint = null; /** * [Output Only] The unique identifier for the resource. This identifier is defined by the server. * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * [Output only] Type of the resource. Always compute#sslPolicyfor SSL policies. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * The minimum version of SSL protocol that can be used by the clients to establish a connection with the load balancer. This can be one of TLS_1_0, TLS_1_1, TLS_1_2. * Check the MinTlsVersion enum for the list of possible values. * * Generated from protobuf field optional string min_tls_version = 8155943; */ - private $min_tls_version = null; + protected $min_tls_version = null; /** * Name of the resource. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * Profile specifies the set of SSL features that can be used by the load balancer when negotiating SSL with clients. This can be one of COMPATIBLE, MODERN, RESTRICTED, or CUSTOM. If using CUSTOM, the set of SSL features to enable must be specified in the customFeatures field. * Check the Profile enum for the list of possible values. * * Generated from protobuf field optional string profile = 227445161; */ - private $profile = null; + protected $profile = null; /** * [Output Only] URL of the region where the regional SSL policy resides. This field is not applicable to global SSL policies. * * Generated from protobuf field optional string region = 138946292; */ - private $region = null; + protected $region = null; /** * [Output Only] Server-defined URL for the resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] If potential misconfigurations are detected for this SSL policy, this field will be populated with warning messages. * diff --git a/Compute/src/V1/SslPolicyReference.php b/Compute/src/V1/SslPolicyReference.php index b713aece7dee..3312493c7aee 100644 --- a/Compute/src/V1/SslPolicyReference.php +++ b/Compute/src/V1/SslPolicyReference.php @@ -19,7 +19,7 @@ class SslPolicyReference extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string ssl_policy = 295190213; */ - private $ssl_policy = null; + protected $ssl_policy = null; /** * Constructor. diff --git a/Compute/src/V1/StartAsyncReplicationDiskRequest.php b/Compute/src/V1/StartAsyncReplicationDiskRequest.php index ce173286de4b..9d5474042b77 100644 --- a/Compute/src/V1/StartAsyncReplicationDiskRequest.php +++ b/Compute/src/V1/StartAsyncReplicationDiskRequest.php @@ -20,31 +20,31 @@ class StartAsyncReplicationDiskRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string disk = 3083677 [(.google.api.field_behavior) = REQUIRED]; */ - private $disk = ''; + protected $disk = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.DisksStartAsyncReplicationRequest disks_start_async_replication_request_resource = 470814554 [(.google.api.field_behavior) = REQUIRED]; */ - private $disks_start_async_replication_request_resource = null; + protected $disks_start_async_replication_request_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/StartAsyncReplicationRegionDiskRequest.php b/Compute/src/V1/StartAsyncReplicationRegionDiskRequest.php index f949a675a1e1..9b406bf6285e 100644 --- a/Compute/src/V1/StartAsyncReplicationRegionDiskRequest.php +++ b/Compute/src/V1/StartAsyncReplicationRegionDiskRequest.php @@ -20,31 +20,31 @@ class StartAsyncReplicationRegionDiskRequest extends \Google\Protobuf\Internal\M * * Generated from protobuf field string disk = 3083677 [(.google.api.field_behavior) = REQUIRED]; */ - private $disk = ''; + protected $disk = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * The name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.RegionDisksStartAsyncReplicationRequest region_disks_start_async_replication_request_resource = 474326021 [(.google.api.field_behavior) = REQUIRED]; */ - private $region_disks_start_async_replication_request_resource = null; + protected $region_disks_start_async_replication_request_resource = null; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/StartInstanceRequest.php b/Compute/src/V1/StartInstanceRequest.php index 31e4f3a256c6..b22885f08fcb 100644 --- a/Compute/src/V1/StartInstanceRequest.php +++ b/Compute/src/V1/StartInstanceRequest.php @@ -20,25 +20,25 @@ class StartInstanceRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string instance = 18257045 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance = ''; + protected $instance = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/StartInstancesInstanceGroupManagerRequest.php b/Compute/src/V1/StartInstancesInstanceGroupManagerRequest.php index 5a8707e8c23d..b0dd6dd2d23b 100644 --- a/Compute/src/V1/StartInstancesInstanceGroupManagerRequest.php +++ b/Compute/src/V1/StartInstancesInstanceGroupManagerRequest.php @@ -20,31 +20,31 @@ class StartInstancesInstanceGroupManagerRequest extends \Google\Protobuf\Interna * * Generated from protobuf field string instance_group_manager = 249363395 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group_manager = ''; + protected $instance_group_manager = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.InstanceGroupManagersStartInstancesRequest instance_group_managers_start_instances_request_resource = 261083819 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group_managers_start_instances_request_resource = null; + protected $instance_group_managers_start_instances_request_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone where the managed instance group is located. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/StartInstancesRegionInstanceGroupManagerRequest.php b/Compute/src/V1/StartInstancesRegionInstanceGroupManagerRequest.php index 0e5038d1b67a..f4e976c0811a 100644 --- a/Compute/src/V1/StartInstancesRegionInstanceGroupManagerRequest.php +++ b/Compute/src/V1/StartInstancesRegionInstanceGroupManagerRequest.php @@ -20,31 +20,31 @@ class StartInstancesRegionInstanceGroupManagerRequest extends \Google\Protobuf\I * * Generated from protobuf field string instance_group_manager = 249363395 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group_manager = ''; + protected $instance_group_manager = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.RegionInstanceGroupManagersStartInstancesRequest region_instance_group_managers_start_instances_request_resource = 497012118 [(.google.api.field_behavior) = REQUIRED]; */ - private $region_instance_group_managers_start_instances_request_resource = null; + protected $region_instance_group_managers_start_instances_request_resource = null; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/StartWithEncryptionKeyInstanceRequest.php b/Compute/src/V1/StartWithEncryptionKeyInstanceRequest.php index 2a43368e1557..6ae4e42d3ee2 100644 --- a/Compute/src/V1/StartWithEncryptionKeyInstanceRequest.php +++ b/Compute/src/V1/StartWithEncryptionKeyInstanceRequest.php @@ -20,31 +20,31 @@ class StartWithEncryptionKeyInstanceRequest extends \Google\Protobuf\Internal\Me * * Generated from protobuf field string instance = 18257045 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance = ''; + protected $instance = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.InstancesStartWithEncryptionKeyRequest instances_start_with_encryption_key_request_resource = 441712511 [(.google.api.field_behavior) = REQUIRED]; */ - private $instances_start_with_encryption_key_request_resource = null; + protected $instances_start_with_encryption_key_request_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/StatefulPolicy.php b/Compute/src/V1/StatefulPolicy.php index 8250f28d81f0..57e79835cd02 100644 --- a/Compute/src/V1/StatefulPolicy.php +++ b/Compute/src/V1/StatefulPolicy.php @@ -17,7 +17,7 @@ class StatefulPolicy extends \Google\Protobuf\Internal\Message /** * Generated from protobuf field optional .google.cloud.compute.v1.StatefulPolicyPreservedState preserved_state = 2634026; */ - private $preserved_state = null; + protected $preserved_state = null; /** * Constructor. diff --git a/Compute/src/V1/StatefulPolicyPreservedStateDiskDevice.php b/Compute/src/V1/StatefulPolicyPreservedStateDiskDevice.php index 799d99a95a24..7791c778e904 100644 --- a/Compute/src/V1/StatefulPolicyPreservedStateDiskDevice.php +++ b/Compute/src/V1/StatefulPolicyPreservedStateDiskDevice.php @@ -20,7 +20,7 @@ class StatefulPolicyPreservedStateDiskDevice extends \Google\Protobuf\Internal\M * * Generated from protobuf field optional string auto_delete = 464761403; */ - private $auto_delete = null; + protected $auto_delete = null; /** * Constructor. diff --git a/Compute/src/V1/StatefulPolicyPreservedStateNetworkIp.php b/Compute/src/V1/StatefulPolicyPreservedStateNetworkIp.php index 9ba16054ac2d..851fa3ec6372 100644 --- a/Compute/src/V1/StatefulPolicyPreservedStateNetworkIp.php +++ b/Compute/src/V1/StatefulPolicyPreservedStateNetworkIp.php @@ -20,7 +20,7 @@ class StatefulPolicyPreservedStateNetworkIp extends \Google\Protobuf\Internal\Me * * Generated from protobuf field optional string auto_delete = 464761403; */ - private $auto_delete = null; + protected $auto_delete = null; /** * Constructor. diff --git a/Compute/src/V1/Status.php b/Compute/src/V1/Status.php index e659235cedb0..4bc98f742e57 100644 --- a/Compute/src/V1/Status.php +++ b/Compute/src/V1/Status.php @@ -20,7 +20,7 @@ class Status extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int32 code = 3059181; */ - private $code = null; + protected $code = null; /** * A list of messages that carry the error details. There is a common set of message types for APIs to use. * @@ -32,7 +32,7 @@ class Status extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string message = 418054151; */ - private $message = null; + protected $message = null; /** * Constructor. diff --git a/Compute/src/V1/StopAsyncReplicationDiskRequest.php b/Compute/src/V1/StopAsyncReplicationDiskRequest.php index 35a86ca2f3f7..9de8dbd54780 100644 --- a/Compute/src/V1/StopAsyncReplicationDiskRequest.php +++ b/Compute/src/V1/StopAsyncReplicationDiskRequest.php @@ -20,25 +20,25 @@ class StopAsyncReplicationDiskRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string disk = 3083677 [(.google.api.field_behavior) = REQUIRED]; */ - private $disk = ''; + protected $disk = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/StopAsyncReplicationRegionDiskRequest.php b/Compute/src/V1/StopAsyncReplicationRegionDiskRequest.php index dbcb188fd685..885be041f4ba 100644 --- a/Compute/src/V1/StopAsyncReplicationRegionDiskRequest.php +++ b/Compute/src/V1/StopAsyncReplicationRegionDiskRequest.php @@ -20,25 +20,25 @@ class StopAsyncReplicationRegionDiskRequest extends \Google\Protobuf\Internal\Me * * Generated from protobuf field string disk = 3083677 [(.google.api.field_behavior) = REQUIRED]; */ - private $disk = ''; + protected $disk = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * The name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/StopGroupAsyncReplicationDiskRequest.php b/Compute/src/V1/StopGroupAsyncReplicationDiskRequest.php index a8aa8a7db389..a599dde07380 100644 --- a/Compute/src/V1/StopGroupAsyncReplicationDiskRequest.php +++ b/Compute/src/V1/StopGroupAsyncReplicationDiskRequest.php @@ -20,25 +20,25 @@ class StopGroupAsyncReplicationDiskRequest extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field .google.cloud.compute.v1.DisksStopGroupAsyncReplicationResource disks_stop_group_async_replication_resource_resource = 346815509 [(.google.api.field_behavior) = REQUIRED]; */ - private $disks_stop_group_async_replication_resource_resource = null; + protected $disks_stop_group_async_replication_resource_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone for this request. This must be the zone of the primary or secondary disks in the consistency group. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/StopGroupAsyncReplicationRegionDiskRequest.php b/Compute/src/V1/StopGroupAsyncReplicationRegionDiskRequest.php index cf76b9cb028c..e6d0a8a8eedc 100644 --- a/Compute/src/V1/StopGroupAsyncReplicationRegionDiskRequest.php +++ b/Compute/src/V1/StopGroupAsyncReplicationRegionDiskRequest.php @@ -20,25 +20,25 @@ class StopGroupAsyncReplicationRegionDiskRequest extends \Google\Protobuf\Intern * * Generated from protobuf field .google.cloud.compute.v1.DisksStopGroupAsyncReplicationResource disks_stop_group_async_replication_resource_resource = 346815509 [(.google.api.field_behavior) = REQUIRED]; */ - private $disks_stop_group_async_replication_resource_resource = null; + protected $disks_stop_group_async_replication_resource_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * The name of the region for this request. This must be the region of the primary or secondary disks in the consistency group. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/StopInstanceRequest.php b/Compute/src/V1/StopInstanceRequest.php index de4fd35aa90e..520999901762 100644 --- a/Compute/src/V1/StopInstanceRequest.php +++ b/Compute/src/V1/StopInstanceRequest.php @@ -20,31 +20,31 @@ class StopInstanceRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional bool discard_local_ssd = 319517903; */ - private $discard_local_ssd = null; + protected $discard_local_ssd = null; /** * Name of the instance resource to stop. * * Generated from protobuf field string instance = 18257045 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance = ''; + protected $instance = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/StopInstancesInstanceGroupManagerRequest.php b/Compute/src/V1/StopInstancesInstanceGroupManagerRequest.php index ae7cc6f0bf57..c9ab7c92dc65 100644 --- a/Compute/src/V1/StopInstancesInstanceGroupManagerRequest.php +++ b/Compute/src/V1/StopInstancesInstanceGroupManagerRequest.php @@ -20,31 +20,31 @@ class StopInstancesInstanceGroupManagerRequest extends \Google\Protobuf\Internal * * Generated from protobuf field string instance_group_manager = 249363395 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group_manager = ''; + protected $instance_group_manager = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.InstanceGroupManagersStopInstancesRequest instance_group_managers_stop_instances_request_resource = 37556877 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group_managers_stop_instances_request_resource = null; + protected $instance_group_managers_stop_instances_request_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone where the managed instance group is located. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/StopInstancesRegionInstanceGroupManagerRequest.php b/Compute/src/V1/StopInstancesRegionInstanceGroupManagerRequest.php index 0e7c92a49de9..00cfa7400886 100644 --- a/Compute/src/V1/StopInstancesRegionInstanceGroupManagerRequest.php +++ b/Compute/src/V1/StopInstancesRegionInstanceGroupManagerRequest.php @@ -20,31 +20,31 @@ class StopInstancesRegionInstanceGroupManagerRequest extends \Google\Protobuf\In * * Generated from protobuf field string instance_group_manager = 249363395 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group_manager = ''; + protected $instance_group_manager = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.RegionInstanceGroupManagersStopInstancesRequest region_instance_group_managers_stop_instances_request_resource = 270306882 [(.google.api.field_behavior) = REQUIRED]; */ - private $region_instance_group_managers_stop_instances_request_resource = null; + protected $region_instance_group_managers_stop_instances_request_resource = null; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/StoragePool.php b/Compute/src/V1/StoragePool.php index 4810bd64eed0..5a2160bd9d55 100644 --- a/Compute/src/V1/StoragePool.php +++ b/Compute/src/V1/StoragePool.php @@ -21,37 +21,37 @@ class StoragePool extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string capacity_provisioning_type = 251610375; */ - private $capacity_provisioning_type = null; + protected $capacity_provisioning_type = null; /** * [Output Only] Creation timestamp in RFC3339 text format. * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * An optional description of this resource. Provide this property when you create the resource. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * [Output Only] The unique identifier for the resource. This identifier is defined by the server. * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * [Output Only] Type of the resource. Always compute#storagePool for storage pools. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * A fingerprint for the labels being applied to this storage pool, which is essentially a hash of the labels set used for optimistic locking. The fingerprint is initially generated by Compute Engine and changes after every request to modify or update labels. You must always provide an up-to-date fingerprint hash in order to update or change labels, otherwise the request will fail with error 412 conditionNotMet. To see the latest fingerprint, make a get() request to retrieve a storage pool. * * Generated from protobuf field optional string label_fingerprint = 178124825; */ - private $label_fingerprint = null; + protected $label_fingerprint = null; /** * Labels to apply to this storage pool. These can be later modified by the setLabels method. * @@ -63,75 +63,75 @@ class StoragePool extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * Provisioning type of the performance-related parameters of the pool, such as throughput and IOPS. * Check the PerformanceProvisioningType enum for the list of possible values. * * Generated from protobuf field optional string performance_provisioning_type = 468553469; */ - private $performance_provisioning_type = null; + protected $performance_provisioning_type = null; /** * Size of the storage pool in GiB. For more information about the size limits, see https://cloud.google.com/compute/docs/disks/storage-pools. * * Generated from protobuf field optional int64 pool_provisioned_capacity_gb = 478537682; */ - private $pool_provisioned_capacity_gb = null; + protected $pool_provisioned_capacity_gb = null; /** * Provisioned IOPS of the storage pool. Only relevant if the storage pool type is hyperdisk-balanced. * * Generated from protobuf field optional int64 pool_provisioned_iops = 112092311; */ - private $pool_provisioned_iops = null; + protected $pool_provisioned_iops = null; /** * Provisioned throughput of the storage pool in MiB/s. Only relevant if the storage pool type is hyperdisk-balanced or hyperdisk-throughput. * * Generated from protobuf field optional int64 pool_provisioned_throughput = 169215640; */ - private $pool_provisioned_throughput = null; + protected $pool_provisioned_throughput = null; /** * [Output Only] Status information for the storage pool resource. * * Generated from protobuf field optional .google.cloud.compute.v1.StoragePoolResourceStatus resource_status = 249429315; */ - private $resource_status = null; + protected $resource_status = null; /** * [Output Only] Server-defined fully-qualified URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Server-defined URL for this resource's resource id. * * Generated from protobuf field optional string self_link_with_id = 44520962; */ - private $self_link_with_id = null; + protected $self_link_with_id = null; /** * [Output Only] The status of storage pool creation. - CREATING: Storage pool is provisioning. storagePool. - FAILED: Storage pool creation failed. - READY: Storage pool is ready for use. - DELETING: Storage pool is deleting. * Check the State enum for the list of possible values. * * Generated from protobuf field optional string state = 109757585; */ - private $state = null; + protected $state = null; /** * [Output Only] Status information for the storage pool resource. * * Generated from protobuf field optional .google.cloud.compute.v1.StoragePoolResourceStatus status = 181260274; */ - private $status = null; + protected $status = null; /** * Type of the storage pool. * * Generated from protobuf field optional string storage_pool_type = 285999289; */ - private $storage_pool_type = null; + protected $storage_pool_type = null; /** * [Output Only] URL of the zone where the storage pool resides. You must specify this field as part of the HTTP request URL. It is not settable as a field in the request body. * * Generated from protobuf field optional string zone = 3744684; */ - private $zone = null; + protected $zone = null; /** * Constructor. diff --git a/Compute/src/V1/StoragePoolAggregatedList.php b/Compute/src/V1/StoragePoolAggregatedList.php index af1ba9b1a8f8..809b1d444a26 100644 --- a/Compute/src/V1/StoragePoolAggregatedList.php +++ b/Compute/src/V1/StoragePoolAggregatedList.php @@ -17,13 +17,13 @@ class StoragePoolAggregatedList extends \Google\Protobuf\Internal\Message /** * Generated from protobuf field optional string etag = 3123477; */ - private $etag = null; + protected $etag = null; /** * [Output Only] Unique identifier for the resource; defined by the server. * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of StoragePoolsScopedList resources. * @@ -35,19 +35,19 @@ class StoragePoolAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Unreachable resources. * @@ -59,7 +59,7 @@ class StoragePoolAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/StoragePoolDisk.php b/Compute/src/V1/StoragePoolDisk.php index ca8ba0b83378..ec2ee31ed8d9 100644 --- a/Compute/src/V1/StoragePoolDisk.php +++ b/Compute/src/V1/StoragePoolDisk.php @@ -25,31 +25,31 @@ class StoragePoolDisk extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * [Output Only] The URL of the disk. * * Generated from protobuf field optional string disk = 3083677; */ - private $disk = null; + protected $disk = null; /** * [Output Only] The name of the disk. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * [Output Only] The number of IOPS provisioned for the disk. * * Generated from protobuf field optional int64 provisioned_iops = 186769108; */ - private $provisioned_iops = null; + protected $provisioned_iops = null; /** * [Output Only] The throughput provisioned for the disk. * * Generated from protobuf field optional int64 provisioned_throughput = 526524181; */ - private $provisioned_throughput = null; + protected $provisioned_throughput = null; /** * [Output Only] Resource policies applied to disk for automatic snapshot creations. * @@ -61,26 +61,26 @@ class StoragePoolDisk extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int64 size_gb = 494929369; */ - private $size_gb = null; + protected $size_gb = null; /** * [Output Only] The disk status. * Check the Status enum for the list of possible values. * * Generated from protobuf field optional string status = 181260274; */ - private $status = null; + protected $status = null; /** * [Output Only] The disk type. * * Generated from protobuf field optional string type = 3575610; */ - private $type = null; + protected $type = null; /** * [Output Only] Amount of disk space used. * * Generated from protobuf field optional int64 used_bytes = 231640425; */ - private $used_bytes = null; + protected $used_bytes = null; /** * Constructor. diff --git a/Compute/src/V1/StoragePoolList.php b/Compute/src/V1/StoragePoolList.php index 4f67b5f50a3e..3d5a8e7d88e6 100644 --- a/Compute/src/V1/StoragePoolList.php +++ b/Compute/src/V1/StoragePoolList.php @@ -18,13 +18,13 @@ class StoragePoolList extends \Google\Protobuf\Internal\Message /** * Generated from protobuf field optional string etag = 3123477; */ - private $etag = null; + protected $etag = null; /** * [Output Only] Unique identifier for the resource; defined by the server. * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of StoragePool resources. * @@ -36,19 +36,19 @@ class StoragePoolList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Unreachable resources. end_interface: MixerListResponseWithEtagBuilder * @@ -60,7 +60,7 @@ class StoragePoolList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/StoragePoolListDisks.php b/Compute/src/V1/StoragePoolListDisks.php index 7052767368a1..f27cea9e514e 100644 --- a/Compute/src/V1/StoragePoolListDisks.php +++ b/Compute/src/V1/StoragePoolListDisks.php @@ -17,13 +17,13 @@ class StoragePoolListDisks extends \Google\Protobuf\Internal\Message /** * Generated from protobuf field optional string etag = 3123477; */ - private $etag = null; + protected $etag = null; /** * [Output Only] Unique identifier for the resource; defined by the server. * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of StoragePoolDisk resources. * @@ -35,19 +35,19 @@ class StoragePoolListDisks extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Unreachable resources. end_interface: MixerListResponseWithEtagBuilder * @@ -59,7 +59,7 @@ class StoragePoolListDisks extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/StoragePoolResourceStatus.php b/Compute/src/V1/StoragePoolResourceStatus.php index cc0c58807ab8..5b6634a05165 100644 --- a/Compute/src/V1/StoragePoolResourceStatus.php +++ b/Compute/src/V1/StoragePoolResourceStatus.php @@ -20,61 +20,61 @@ class StoragePoolResourceStatus extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int64 disk_count = 182933485; */ - private $disk_count = null; + protected $disk_count = null; /** * [Output Only] Timestamp of the last successful resize in RFC3339 text format. * * Generated from protobuf field optional string last_resize_timestamp = 500825556; */ - private $last_resize_timestamp = null; + protected $last_resize_timestamp = null; /** * [Output Only] Maximum allowed aggregate disk size in GiB. * * Generated from protobuf field optional int64 max_total_provisioned_disk_capacity_gb = 165818207; */ - private $max_total_provisioned_disk_capacity_gb = null; + protected $max_total_provisioned_disk_capacity_gb = null; /** * [Output Only] Space used by data stored in disks within the storage pool (in bytes). This will reflect the total number of bytes written to the disks in the pool, in contrast to the capacity of those disks. * * Generated from protobuf field optional int64 pool_used_capacity_bytes = 510407877; */ - private $pool_used_capacity_bytes = null; + protected $pool_used_capacity_bytes = null; /** * [Output Only] Sum of all the disks' provisioned IOPS, minus some amount that is allowed per disk that is not counted towards pool's IOPS capacity. For more information, see https://cloud.google.com/compute/docs/disks/storage-pools. * * Generated from protobuf field optional int64 pool_used_iops = 99558536; */ - private $pool_used_iops = null; + protected $pool_used_iops = null; /** * [Output Only] Sum of all the disks' provisioned throughput in MiB/s. * * Generated from protobuf field optional int64 pool_used_throughput = 206130633; */ - private $pool_used_throughput = null; + protected $pool_used_throughput = null; /** * [Output Only] Amount of data written into the pool, before it is compacted. * * Generated from protobuf field optional int64 pool_user_written_bytes = 228964050; */ - private $pool_user_written_bytes = null; + protected $pool_user_written_bytes = null; /** * [Output Only] Sum of all the disks' provisioned capacity (in GiB) in this storage pool. A disk's provisioned capacity is the same as its total capacity. * * Generated from protobuf field optional int64 total_provisioned_disk_capacity_gb = 520930980; */ - private $total_provisioned_disk_capacity_gb = null; + protected $total_provisioned_disk_capacity_gb = null; /** * [Output Only] Sum of all the disks' provisioned IOPS. * * Generated from protobuf field optional int64 total_provisioned_disk_iops = 32812549; */ - private $total_provisioned_disk_iops = null; + protected $total_provisioned_disk_iops = null; /** * [Output Only] Sum of all the disks' provisioned throughput in MiB/s, minus some amount that is allowed per disk that is not counted towards pool's throughput capacity. * * Generated from protobuf field optional int64 total_provisioned_disk_throughput = 447677830; */ - private $total_provisioned_disk_throughput = null; + protected $total_provisioned_disk_throughput = null; /** * Constructor. diff --git a/Compute/src/V1/StoragePoolType.php b/Compute/src/V1/StoragePoolType.php index 08d103c5f6e7..c79987b4061d 100644 --- a/Compute/src/V1/StoragePoolType.php +++ b/Compute/src/V1/StoragePoolType.php @@ -19,91 +19,91 @@ class StoragePoolType extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * [Output Only] The deprecation status associated with this storage pool type. * * Generated from protobuf field optional .google.cloud.compute.v1.DeprecationStatus deprecated = 515138995; */ - private $deprecated = null; + protected $deprecated = null; /** * [Output Only] An optional description of this resource. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * [Output Only] The unique identifier for the resource. This identifier is defined by the server. * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * [Output Only] Type of the resource. Always compute#storagePoolType for storage pool types. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] Maximum storage pool size in GB. * * Generated from protobuf field optional int64 max_pool_provisioned_capacity_gb = 182139085; */ - private $max_pool_provisioned_capacity_gb = null; + protected $max_pool_provisioned_capacity_gb = null; /** * [Output Only] Maximum provisioned IOPS. * * Generated from protobuf field optional int64 max_pool_provisioned_iops = 515270652; */ - private $max_pool_provisioned_iops = null; + protected $max_pool_provisioned_iops = null; /** * [Output Only] Maximum provisioned throughput. * * Generated from protobuf field optional int64 max_pool_provisioned_throughput = 228928061; */ - private $max_pool_provisioned_throughput = null; + protected $max_pool_provisioned_throughput = null; /** * [Output Only] Minimum storage pool size in GB. * * Generated from protobuf field optional int64 min_pool_provisioned_capacity_gb = 191022751; */ - private $min_pool_provisioned_capacity_gb = null; + protected $min_pool_provisioned_capacity_gb = null; /** * [Output Only] Minimum provisioned IOPS. * * Generated from protobuf field optional int64 min_pool_provisioned_iops = 416473706; */ - private $min_pool_provisioned_iops = null; + protected $min_pool_provisioned_iops = null; /** * [Output Only] Minimum provisioned throughput. * * Generated from protobuf field optional int64 min_pool_provisioned_throughput = 367761963; */ - private $min_pool_provisioned_throughput = null; + protected $min_pool_provisioned_throughput = null; /** * [Deprecated] This field is deprecated. Use minPoolProvisionedCapacityGb instead. * * Generated from protobuf field optional int64 min_size_gb = 385278188; */ - private $min_size_gb = null; + protected $min_size_gb = null; /** * [Output Only] Name of the resource. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * [Output Only] Server-defined URL for the resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Server-defined URL for this resource with the resource id. * * Generated from protobuf field optional string self_link_with_id = 44520962; */ - private $self_link_with_id = null; + protected $self_link_with_id = null; /** * [Output Only] The list of disk types supported in this storage pool type. * @@ -115,7 +115,7 @@ class StoragePoolType extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string zone = 3744684; */ - private $zone = null; + protected $zone = null; /** * Constructor. diff --git a/Compute/src/V1/StoragePoolTypeAggregatedList.php b/Compute/src/V1/StoragePoolTypeAggregatedList.php index 0a67fc9f8b17..9fef345fae78 100644 --- a/Compute/src/V1/StoragePoolTypeAggregatedList.php +++ b/Compute/src/V1/StoragePoolTypeAggregatedList.php @@ -19,7 +19,7 @@ class StoragePoolTypeAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of StoragePoolTypesScopedList resources. * @@ -31,25 +31,25 @@ class StoragePoolTypeAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/StoragePoolTypeList.php b/Compute/src/V1/StoragePoolTypeList.php index 853ab50156d8..1cae80c73832 100644 --- a/Compute/src/V1/StoragePoolTypeList.php +++ b/Compute/src/V1/StoragePoolTypeList.php @@ -20,7 +20,7 @@ class StoragePoolTypeList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of StoragePoolType resources. * @@ -32,25 +32,25 @@ class StoragePoolTypeList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/StoragePoolTypesClient.php b/Compute/src/V1/StoragePoolTypesClient.php deleted file mode 100644 index 623ce8d81c8b..000000000000 --- a/Compute/src/V1/StoragePoolTypesClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/StoragePoolsClient.php b/Compute/src/V1/StoragePoolsClient.php deleted file mode 100644 index 5a86aed8e750..000000000000 --- a/Compute/src/V1/StoragePoolsClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/Subnetwork.php b/Compute/src/V1/Subnetwork.php index e5747b24caf4..cedf7dd35683 100644 --- a/Compute/src/V1/Subnetwork.php +++ b/Compute/src/V1/Subnetwork.php @@ -20,150 +20,150 @@ class Subnetwork extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * An optional description of this resource. Provide this property when you create the resource. This field can be set only at resource creation time. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * Whether to enable flow logging for this subnetwork. If this field is not explicitly set, it will not appear in get listings. If not set the default behavior is determined by the org policy, if there is no org policy specified, then it will default to disabled. This field isn't supported if the subnet purpose field is set to REGIONAL_MANAGED_PROXY. * * Generated from protobuf field optional bool enable_flow_logs = 151544420; */ - private $enable_flow_logs = null; + protected $enable_flow_logs = null; /** * The external IPv6 address range that is owned by this subnetwork. * * Generated from protobuf field optional string external_ipv6_prefix = 139299190; */ - private $external_ipv6_prefix = null; + protected $external_ipv6_prefix = null; /** * Fingerprint of this resource. A hash of the contents stored in this object. This field is used in optimistic locking. This field will be ignored when inserting a Subnetwork. An up-to-date fingerprint must be provided in order to update the Subnetwork, otherwise the request will fail with error 412 conditionNotMet. To see the latest fingerprint, make a get() request to retrieve a Subnetwork. * * Generated from protobuf field optional string fingerprint = 234678500; */ - private $fingerprint = null; + protected $fingerprint = null; /** * [Output Only] The gateway address for default routes to reach destination addresses outside this subnetwork. * * Generated from protobuf field optional string gateway_address = 459867385; */ - private $gateway_address = null; + protected $gateway_address = null; /** * [Output Only] The unique identifier for the resource. This identifier is defined by the server. * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * The internal IPv6 address range that is owned by this subnetwork. * * Generated from protobuf field optional string internal_ipv6_prefix = 506270056; */ - private $internal_ipv6_prefix = null; + protected $internal_ipv6_prefix = null; /** * The range of internal addresses that are owned by this subnetwork. Provide this property when you create the subnetwork. For example, 10.0.0.0/8 or 100.64.0.0/10. Ranges must be unique and non-overlapping within a network. Only IPv4 is supported. This field is set at resource creation time. The range can be any range listed in the Valid ranges list. The range can be expanded after creation using expandIpCidrRange. * * Generated from protobuf field optional string ip_cidr_range = 98117322; */ - private $ip_cidr_range = null; + protected $ip_cidr_range = null; /** * Reference to the source of IP, like a PublicDelegatedPrefix (PDP) for BYOIP. The PDP must be a sub-PDP in EXTERNAL_IPV6_SUBNETWORK_CREATION mode. Use one of the following formats to specify a sub-PDP when creating a dual stack subnetwork with external access using BYOIP: - Full resource URL, as in https://www.googleapis.com/compute/v1/projects/projectId/regions/region /publicDelegatedPrefixes/sub-pdp-name - Partial URL, as in - projects/projectId/regions/region/publicDelegatedPrefixes/ sub-pdp-name - regions/region/publicDelegatedPrefixes/sub-pdp-name * * Generated from protobuf field optional string ip_collection = 176818358; */ - private $ip_collection = null; + protected $ip_collection = null; /** * The access type of IPv6 address this subnet holds. It's immutable and can only be specified during creation or the first time the subnet is updated into IPV4_IPV6 dual stack. * Check the Ipv6AccessType enum for the list of possible values. * * Generated from protobuf field optional string ipv6_access_type = 504658653; */ - private $ipv6_access_type = null; + protected $ipv6_access_type = null; /** * [Output Only] This field is for internal use. * * Generated from protobuf field optional string ipv6_cidr_range = 273141258; */ - private $ipv6_cidr_range = null; + protected $ipv6_cidr_range = null; /** * [Output Only] Possible endpoints of this subnetwork. It can be one of the following: - VM_ONLY: The subnetwork can be used for creating instances and IPv6 addresses with VM endpoint type. Such a subnetwork gets external IPv6 ranges from a public delegated prefix and cannot be used to create NetLb. - VM_AND_FR: The subnetwork can be used for creating both VM instances and Forwarding Rules. It can also be used to reserve IPv6 addresses with both VM and FR endpoint types. Such a subnetwork gets its IPv6 range from Google IP Pool directly. * Check the Ipv6GceEndpoint enum for the list of possible values. * * Generated from protobuf field optional string ipv6_gce_endpoint = 320382307; */ - private $ipv6_gce_endpoint = null; + protected $ipv6_gce_endpoint = null; /** * [Output Only] Type of the resource. Always compute#subnetwork for Subnetwork resources. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * This field denotes the VPC flow logging options for this subnetwork. If logging is enabled, logs are exported to Cloud Logging. * * Generated from protobuf field optional .google.cloud.compute.v1.SubnetworkLogConfig log_config = 351299741; */ - private $log_config = null; + protected $log_config = null; /** * The name of the resource, provided by the client when initially creating the resource. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * The URL of the network to which this subnetwork belongs, provided by the client when initially creating the subnetwork. This field can be set only at resource creation time. * * Generated from protobuf field optional string network = 232872494; */ - private $network = null; + protected $network = null; /** * Input only. [Input Only] Additional params passed with the request, but not persisted as part of resource payload. * * Generated from protobuf field optional .google.cloud.compute.v1.SubnetworkParams params = 78313862; */ - private $params = null; + protected $params = null; /** * Whether the VMs in this subnet can access Google services without assigned external IP addresses. This field can be both set at resource creation time and updated using setPrivateIpGoogleAccess. * * Generated from protobuf field optional bool private_ip_google_access = 421491790; */ - private $private_ip_google_access = null; + protected $private_ip_google_access = null; /** * This field is for internal use. This field can be both set at resource creation time and updated using patch. * Check the PrivateIpv6GoogleAccess enum for the list of possible values. * * Generated from protobuf field optional string private_ipv6_google_access = 48277006; */ - private $private_ipv6_google_access = null; + protected $private_ipv6_google_access = null; /** * * Check the Purpose enum for the list of possible values. * * Generated from protobuf field optional string purpose = 316407070; */ - private $purpose = null; + protected $purpose = null; /** * URL of the region where the Subnetwork resides. This field can be set only at resource creation time. * * Generated from protobuf field optional string region = 138946292; */ - private $region = null; + protected $region = null; /** * The URL of the reserved internal range. * * Generated from protobuf field optional string reserved_internal_range = 286248754; */ - private $reserved_internal_range = null; + protected $reserved_internal_range = null; /** * The role of subnetwork. Currently, this field is only used when purpose is set to GLOBAL_MANAGED_PROXY or REGIONAL_MANAGED_PROXY. The value can be set to ACTIVE or BACKUP. An ACTIVE subnetwork is one that is currently being used for Envoy-based load balancers in a region. A BACKUP subnetwork is one that is ready to be promoted to ACTIVE or is currently draining. This field can be updated with a patch request. * Check the Role enum for the list of possible values. * * Generated from protobuf field optional string role = 3506294; */ - private $role = null; + protected $role = null; /** * An array of configurations for secondary IP ranges for VM instances contained in this subnetwork. The primary IP of such VM must belong to the primary ipCidrRange of the subnetwork. The alias IPs may belong to either primary or secondary ranges. This field can be updated with a patch request. * @@ -175,21 +175,21 @@ class Subnetwork extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * The stack type for the subnet. If set to IPV4_ONLY, new VMs in the subnet are assigned IPv4 addresses only. If set to IPV4_IPV6, new VMs in the subnet can be assigned both IPv4 and IPv6 addresses. If not specified, IPV4_ONLY is used. This field can be both set at resource creation time and updated using patch. * Check the StackType enum for the list of possible values. * * Generated from protobuf field optional string stack_type = 425908881; */ - private $stack_type = null; + protected $stack_type = null; /** * [Output Only] The state of the subnetwork, which can be one of the following values: READY: Subnetwork is created and ready to use DRAINING: only applicable to subnetworks that have the purpose set to INTERNAL_HTTPS_LOAD_BALANCER and indicates that connections to the load balancer are being drained. A subnetwork that is draining cannot be used or modified until it reaches a status of READY * Check the State enum for the list of possible values. * * Generated from protobuf field optional string state = 109757585; */ - private $state = null; + protected $state = null; /** * Output only. [Output Only] The array of external IPv6 network ranges reserved from the subnetwork's external IPv6 range for system use. * diff --git a/Compute/src/V1/SubnetworkAggregatedList.php b/Compute/src/V1/SubnetworkAggregatedList.php index 474592f7e8c9..34013b6cd07f 100644 --- a/Compute/src/V1/SubnetworkAggregatedList.php +++ b/Compute/src/V1/SubnetworkAggregatedList.php @@ -19,7 +19,7 @@ class SubnetworkAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of SubnetworksScopedList resources. * @@ -31,19 +31,19 @@ class SubnetworkAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Unreachable resources. * @@ -55,7 +55,7 @@ class SubnetworkAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/SubnetworkList.php b/Compute/src/V1/SubnetworkList.php index 7d056f8d2bb9..725eb88e66ff 100644 --- a/Compute/src/V1/SubnetworkList.php +++ b/Compute/src/V1/SubnetworkList.php @@ -20,7 +20,7 @@ class SubnetworkList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of Subnetwork resources. * @@ -32,25 +32,25 @@ class SubnetworkList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/SubnetworkLogConfig.php b/Compute/src/V1/SubnetworkLogConfig.php index 0c0f8e8e2b72..bcf1efaabc3b 100644 --- a/Compute/src/V1/SubnetworkLogConfig.php +++ b/Compute/src/V1/SubnetworkLogConfig.php @@ -21,32 +21,32 @@ class SubnetworkLogConfig extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string aggregation_interval = 174919042; */ - private $aggregation_interval = null; + protected $aggregation_interval = null; /** * Whether to enable flow logging for this subnetwork. If this field is not explicitly set, it will not appear in get listings. If not set the default behavior is determined by the org policy, if there is no org policy specified, then it will default to disabled. Flow logging isn't supported if the subnet purpose field is set to REGIONAL_MANAGED_PROXY. * * Generated from protobuf field optional bool enable = 311764355; */ - private $enable = null; + protected $enable = null; /** * Can only be specified if VPC flow logs for this subnetwork is enabled. The filter expression is used to define which VPC flow logs should be exported to Cloud Logging. * * Generated from protobuf field optional string filter_expr = 183374428; */ - private $filter_expr = null; + protected $filter_expr = null; /** * Can only be specified if VPC flow logging for this subnetwork is enabled. The value of the field must be in [0, 1]. Set the sampling rate of VPC flow logs within the subnetwork where 1.0 means all collected logs are reported and 0.0 means no logs are reported. Default is 0.5 unless otherwise specified by the org policy, which means half of all collected logs are reported. * * Generated from protobuf field optional float flow_sampling = 530150360; */ - private $flow_sampling = null; + protected $flow_sampling = null; /** * Can only be specified if VPC flow logs for this subnetwork is enabled. Configures whether all, none or a subset of metadata fields should be added to the reported VPC flow logs. Default is EXCLUDE_ALL_METADATA. * Check the Metadata enum for the list of possible values. * * Generated from protobuf field optional string metadata = 86866735; */ - private $metadata = null; + protected $metadata = null; /** * Can only be specified if VPC flow logs for this subnetwork is enabled and "metadata" was set to CUSTOM_METADATA. * diff --git a/Compute/src/V1/SubnetworkSecondaryRange.php b/Compute/src/V1/SubnetworkSecondaryRange.php index 50aee025c647..10393c73ffbb 100644 --- a/Compute/src/V1/SubnetworkSecondaryRange.php +++ b/Compute/src/V1/SubnetworkSecondaryRange.php @@ -20,19 +20,19 @@ class SubnetworkSecondaryRange extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string ip_cidr_range = 98117322; */ - private $ip_cidr_range = null; + protected $ip_cidr_range = null; /** * The name associated with this subnetwork secondary range, used when adding an alias IP range to a VM instance. The name must be 1-63 characters long, and comply with RFC1035. The name must be unique within the subnetwork. * * Generated from protobuf field optional string range_name = 332216397; */ - private $range_name = null; + protected $range_name = null; /** * The URL of the reserved internal range. * * Generated from protobuf field optional string reserved_internal_range = 286248754; */ - private $reserved_internal_range = null; + protected $reserved_internal_range = null; /** * Constructor. diff --git a/Compute/src/V1/SubnetworksClient.php b/Compute/src/V1/SubnetworksClient.php deleted file mode 100644 index 952077e901f7..000000000000 --- a/Compute/src/V1/SubnetworksClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional string ip_cidr_range = 98117322; */ - private $ip_cidr_range = null; + protected $ip_cidr_range = null; /** * Constructor. diff --git a/Compute/src/V1/SubnetworksScopedList.php b/Compute/src/V1/SubnetworksScopedList.php index 10cc5e591b0f..49a27c4befea 100644 --- a/Compute/src/V1/SubnetworksScopedList.php +++ b/Compute/src/V1/SubnetworksScopedList.php @@ -25,7 +25,7 @@ class SubnetworksScopedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/SubnetworksScopedWarning.php b/Compute/src/V1/SubnetworksScopedWarning.php index 320aa6782f61..a9e1004e7b2f 100644 --- a/Compute/src/V1/SubnetworksScopedWarning.php +++ b/Compute/src/V1/SubnetworksScopedWarning.php @@ -19,13 +19,13 @@ class SubnetworksScopedWarning extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string scope_name = 345557398; */ - private $scope_name = null; + protected $scope_name = null; /** * An informational warning about unreachable scope * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/SubnetworksSetPrivateIpGoogleAccessRequest.php b/Compute/src/V1/SubnetworksSetPrivateIpGoogleAccessRequest.php index dd926139dd5c..dd68498dc29b 100644 --- a/Compute/src/V1/SubnetworksSetPrivateIpGoogleAccessRequest.php +++ b/Compute/src/V1/SubnetworksSetPrivateIpGoogleAccessRequest.php @@ -17,7 +17,7 @@ class SubnetworksSetPrivateIpGoogleAccessRequest extends \Google\Protobuf\Intern /** * Generated from protobuf field optional bool private_ip_google_access = 421491790; */ - private $private_ip_google_access = null; + protected $private_ip_google_access = null; /** * Constructor. diff --git a/Compute/src/V1/Subsetting.php b/Compute/src/V1/Subsetting.php index 5393b412e958..17341e1e7281 100644 --- a/Compute/src/V1/Subsetting.php +++ b/Compute/src/V1/Subsetting.php @@ -21,7 +21,7 @@ class Subsetting extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string policy = 91071794; */ - private $policy = null; + protected $policy = null; /** * Constructor. diff --git a/Compute/src/V1/SuspendInstanceRequest.php b/Compute/src/V1/SuspendInstanceRequest.php index 0996f18aa767..6d761a393d3a 100644 --- a/Compute/src/V1/SuspendInstanceRequest.php +++ b/Compute/src/V1/SuspendInstanceRequest.php @@ -20,31 +20,31 @@ class SuspendInstanceRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional bool discard_local_ssd = 319517903; */ - private $discard_local_ssd = null; + protected $discard_local_ssd = null; /** * Name of the instance resource to suspend. * * Generated from protobuf field string instance = 18257045 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance = ''; + protected $instance = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SuspendInstancesInstanceGroupManagerRequest.php b/Compute/src/V1/SuspendInstancesInstanceGroupManagerRequest.php index 6c6a2c90f88b..8a40ecc82af6 100644 --- a/Compute/src/V1/SuspendInstancesInstanceGroupManagerRequest.php +++ b/Compute/src/V1/SuspendInstancesInstanceGroupManagerRequest.php @@ -20,31 +20,31 @@ class SuspendInstancesInstanceGroupManagerRequest extends \Google\Protobuf\Inter * * Generated from protobuf field string instance_group_manager = 249363395 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group_manager = ''; + protected $instance_group_manager = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.InstanceGroupManagersSuspendInstancesRequest instance_group_managers_suspend_instances_request_resource = 46679761 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group_managers_suspend_instances_request_resource = null; + protected $instance_group_managers_suspend_instances_request_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone where the managed instance group is located. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SuspendInstancesRegionInstanceGroupManagerRequest.php b/Compute/src/V1/SuspendInstancesRegionInstanceGroupManagerRequest.php index f776ebfdfa8f..aae80c4f8576 100644 --- a/Compute/src/V1/SuspendInstancesRegionInstanceGroupManagerRequest.php +++ b/Compute/src/V1/SuspendInstancesRegionInstanceGroupManagerRequest.php @@ -20,31 +20,31 @@ class SuspendInstancesRegionInstanceGroupManagerRequest extends \Google\Protobuf * * Generated from protobuf field string instance_group_manager = 249363395 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group_manager = ''; + protected $instance_group_manager = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.RegionInstanceGroupManagersSuspendInstancesRequest region_instance_group_managers_suspend_instances_request_resource = 214250236 [(.google.api.field_behavior) = REQUIRED]; */ - private $region_instance_group_managers_suspend_instances_request_resource = null; + protected $region_instance_group_managers_suspend_instances_request_resource = null; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/SwitchToCustomModeNetworkRequest.php b/Compute/src/V1/SwitchToCustomModeNetworkRequest.php index 1383c6aa25f6..4bcc09376f8c 100644 --- a/Compute/src/V1/SwitchToCustomModeNetworkRequest.php +++ b/Compute/src/V1/SwitchToCustomModeNetworkRequest.php @@ -20,19 +20,19 @@ class SwitchToCustomModeNetworkRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string network = 232872494 [(.google.api.field_behavior) = REQUIRED]; */ - private $network = ''; + protected $network = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/TCPHealthCheck.php b/Compute/src/V1/TCPHealthCheck.php index 2596b2b216d9..3324f5329561 100644 --- a/Compute/src/V1/TCPHealthCheck.php +++ b/Compute/src/V1/TCPHealthCheck.php @@ -19,39 +19,39 @@ class TCPHealthCheck extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional int32 port = 3446913; */ - private $port = null; + protected $port = null; /** * Not supported. * * Generated from protobuf field optional string port_name = 41534345; */ - private $port_name = null; + protected $port_name = null; /** * Specifies how a port is selected for health checking. Can be one of the following values: USE_FIXED_PORT: Specifies a port number explicitly using the port field in the health check. Supported by backend services for passthrough load balancers and backend services for proxy load balancers. Not supported by target pools. The health check supports all backends supported by the backend service provided the backend can be health checked. For example, GCE_VM_IP network endpoint groups, GCE_VM_IP_PORT network endpoint groups, and instance group backends. USE_NAMED_PORT: Not supported. USE_SERVING_PORT: Provides an indirect method of specifying the health check port by referring to the backend service. Only supported by backend services for proxy load balancers. Not supported by target pools. Not supported by backend services for passthrough load balancers. Supports all backends that can be health checked; for example, GCE_VM_IP_PORT network endpoint groups and instance group backends. For GCE_VM_IP_PORT network endpoint group backends, the health check uses the port number specified for each endpoint in the network endpoint group. For instance group backends, the health check uses the port number determined by looking up the backend service's named port in the instance group's list of named ports. * Check the PortSpecification enum for the list of possible values. * * Generated from protobuf field optional string port_specification = 51590597; */ - private $port_specification = null; + protected $port_specification = null; /** * Specifies the type of proxy header to append before sending data to the backend, either NONE or PROXY_V1. The default is NONE. * Check the ProxyHeader enum for the list of possible values. * * Generated from protobuf field optional string proxy_header = 160374142; */ - private $proxy_header = null; + protected $proxy_header = null; /** * Instructs the health check prober to send this exact ASCII string, up to 1024 bytes in length, after establishing the TCP connection. * * Generated from protobuf field optional string request = 21951119; */ - private $request = null; + protected $request = null; /** * Creates a content-based TCP health check. In addition to establishing a TCP connection, you can configure the health check to pass only when the backend sends this exact response ASCII string, up to 1024 bytes in length. For details, see: https://cloud.google.com/load-balancing/docs/health-check-concepts#criteria-protocol-ssl-tcp * * Generated from protobuf field optional string response = 196547649; */ - private $response = null; + protected $response = null; /** * Constructor. diff --git a/Compute/src/V1/Tags.php b/Compute/src/V1/Tags.php index 2a1bdabba017..533e90e3aae6 100644 --- a/Compute/src/V1/Tags.php +++ b/Compute/src/V1/Tags.php @@ -20,7 +20,7 @@ class Tags extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string fingerprint = 234678500; */ - private $fingerprint = null; + protected $fingerprint = null; /** * An array of tags. Each tag must be 1-63 characters long, and comply with RFC1035. * diff --git a/Compute/src/V1/TargetGrpcProxiesClient.php b/Compute/src/V1/TargetGrpcProxiesClient.php deleted file mode 100644 index 23fae7e3bb86..000000000000 --- a/Compute/src/V1/TargetGrpcProxiesClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * An optional description of this resource. Provide this property when you create the resource. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * Fingerprint of this resource. A hash of the contents stored in this object. This field is used in optimistic locking. This field will be ignored when inserting a TargetGrpcProxy. An up-to-date fingerprint must be provided in order to patch/update the TargetGrpcProxy; otherwise, the request will fail with error 412 conditionNotMet. To see the latest fingerprint, make a get() request to retrieve the TargetGrpcProxy. * * Generated from protobuf field optional string fingerprint = 234678500; */ - private $fingerprint = null; + protected $fingerprint = null; /** * [Output Only] The unique identifier for the resource type. The server generates this identifier. * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * [Output Only] Type of the resource. Always compute#targetGrpcProxy for target grpc proxies. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * [Output Only] Server-defined URL for the resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Server-defined URL with id for the resource. * * Generated from protobuf field optional string self_link_with_id = 44520962; */ - private $self_link_with_id = null; + protected $self_link_with_id = null; /** * URL to the UrlMap resource that defines the mapping from URL to the BackendService. The protocol field in the BackendService must be set to GRPC. * * Generated from protobuf field optional string url_map = 367020684; */ - private $url_map = null; + protected $url_map = null; /** * If true, indicates that the BackendServices referenced by the urlMap may be accessed by gRPC applications without using a sidecar proxy. This will enable configuration checks on urlMap and its referenced BackendServices to not allow unsupported features. A gRPC application must use "xds:///" scheme in the target URI of the service it is connecting to. If false, indicates that the BackendServices referenced by the urlMap will be accessed by gRPC applications via a sidecar proxy. In this case, a gRPC application must not use "xds:///" scheme in the target URI of the service it is connecting to * * Generated from protobuf field optional bool validate_for_proxyless = 101822888; */ - private $validate_for_proxyless = null; + protected $validate_for_proxyless = null; /** * Constructor. diff --git a/Compute/src/V1/TargetGrpcProxyList.php b/Compute/src/V1/TargetGrpcProxyList.php index 43ee54da8ae3..72dec7accfbd 100644 --- a/Compute/src/V1/TargetGrpcProxyList.php +++ b/Compute/src/V1/TargetGrpcProxyList.php @@ -19,7 +19,7 @@ class TargetGrpcProxyList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of TargetGrpcProxy resources. * @@ -31,25 +31,25 @@ class TargetGrpcProxyList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/TargetHttpProxiesClient.php b/Compute/src/V1/TargetHttpProxiesClient.php deleted file mode 100644 index faa39a7ba754..000000000000 --- a/Compute/src/V1/TargetHttpProxiesClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/TargetHttpProxy.php b/Compute/src/V1/TargetHttpProxy.php index 844bd6c90e7a..97ce514f07c6 100644 --- a/Compute/src/V1/TargetHttpProxy.php +++ b/Compute/src/V1/TargetHttpProxy.php @@ -9,7 +9,7 @@ use Google\Protobuf\Internal\GPBUtil; /** - * Represents a Target HTTP Proxy resource. Google Compute Engine has two Target HTTP Proxy resources: * [Global](/compute/docs/reference/rest/v1/targetHttpProxies) * [Regional](https://cloud.google.com/compute/docs/reference/rest/v1/regionTargetHttpProxies) A target HTTP proxy is a component of Google Cloud HTTP load balancers. * targetHttpProxies are used by global external Application Load Balancers, classic Application Load Balancers, cross-region internal Application Load Balancers, and Traffic Director. * regionTargetHttpProxies are used by regional internal Application Load Balancers and regional external Application Load Balancers. Forwarding rules reference a target HTTP proxy, and the target proxy then references a URL map. For more information, read Using Target Proxies and Forwarding rule concepts. + * Represents a Target HTTP Proxy resource. Google Compute Engine has two Target HTTP Proxy resources: * [Global](/compute/docs/reference/rest/v1/targetHttpProxies) * [Regional](/compute/docs/reference/rest/v1/regionTargetHttpProxies) A target HTTP proxy is a component of Google Cloud HTTP load balancers. * targetHttpProxies are used by global external Application Load Balancers, classic Application Load Balancers, cross-region internal Application Load Balancers, and Traffic Director. * regionTargetHttpProxies are used by regional internal Application Load Balancers and regional external Application Load Balancers. Forwarding rules reference a target HTTP proxy, and the target proxy then references a URL map. For more information, read Using Target Proxies and Forwarding rule concepts. * * Generated from protobuf message google.cloud.compute.v1.TargetHttpProxy */ @@ -20,67 +20,67 @@ class TargetHttpProxy extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * An optional description of this resource. Provide this property when you create the resource. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * Fingerprint of this resource. A hash of the contents stored in this object. This field is used in optimistic locking. This field will be ignored when inserting a TargetHttpProxy. An up-to-date fingerprint must be provided in order to patch/update the TargetHttpProxy; otherwise, the request will fail with error 412 conditionNotMet. To see the latest fingerprint, make a get() request to retrieve the TargetHttpProxy. * * Generated from protobuf field optional string fingerprint = 234678500; */ - private $fingerprint = null; + protected $fingerprint = null; /** * Specifies how long to keep a connection open, after completing a response, while there is no matching traffic (in seconds). If an HTTP keep-alive is not specified, a default value (610 seconds) will be used. For global external Application Load Balancers, the minimum allowed value is 5 seconds and the maximum allowed value is 1200 seconds. For classic Application Load Balancers, this option is not supported. * * Generated from protobuf field optional int32 http_keep_alive_timeout_sec = 447326046; */ - private $http_keep_alive_timeout_sec = null; + protected $http_keep_alive_timeout_sec = null; /** * [Output Only] The unique identifier for the resource. This identifier is defined by the server. * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * [Output Only] Type of resource. Always compute#targetHttpProxy for target HTTP proxies. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * This field only applies when the forwarding rule that references this target proxy has a loadBalancingScheme set to INTERNAL_SELF_MANAGED. When this field is set to true, Envoy proxies set up inbound traffic interception and bind to the IP address and port specified in the forwarding rule. This is generally useful when using Traffic Director to configure Envoy as a gateway or middle proxy (in other words, not a sidecar proxy). The Envoy proxy listens for inbound requests and handles requests when it receives them. The default is false. * * Generated from protobuf field optional bool proxy_bind = 286025582; */ - private $proxy_bind = null; + protected $proxy_bind = null; /** * [Output Only] URL of the region where the regional Target HTTP Proxy resides. This field is not applicable to global Target HTTP Proxies. * * Generated from protobuf field optional string region = 138946292; */ - private $region = null; + protected $region = null; /** * [Output Only] Server-defined URL for the resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * URL to the UrlMap resource that defines the mapping from URL to the BackendService. * * Generated from protobuf field optional string url_map = 367020684; */ - private $url_map = null; + protected $url_map = null; /** * Constructor. diff --git a/Compute/src/V1/TargetHttpProxyAggregatedList.php b/Compute/src/V1/TargetHttpProxyAggregatedList.php index d3622adbc6d9..01a3c4ec4b62 100644 --- a/Compute/src/V1/TargetHttpProxyAggregatedList.php +++ b/Compute/src/V1/TargetHttpProxyAggregatedList.php @@ -19,7 +19,7 @@ class TargetHttpProxyAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of TargetHttpProxiesScopedList resources. * @@ -31,19 +31,19 @@ class TargetHttpProxyAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Unreachable resources. * diff --git a/Compute/src/V1/TargetHttpProxyList.php b/Compute/src/V1/TargetHttpProxyList.php index 468773053dfc..03127da0125d 100644 --- a/Compute/src/V1/TargetHttpProxyList.php +++ b/Compute/src/V1/TargetHttpProxyList.php @@ -20,7 +20,7 @@ class TargetHttpProxyList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of TargetHttpProxy resources. * @@ -32,25 +32,25 @@ class TargetHttpProxyList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/TargetHttpsProxiesClient.php b/Compute/src/V1/TargetHttpsProxiesClient.php deleted file mode 100644 index 97bca7f1eb36..000000000000 --- a/Compute/src/V1/TargetHttpsProxiesClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/TargetHttpsProxiesSetCertificateMapRequest.php b/Compute/src/V1/TargetHttpsProxiesSetCertificateMapRequest.php index aa6e125324f2..0eef192e5ad2 100644 --- a/Compute/src/V1/TargetHttpsProxiesSetCertificateMapRequest.php +++ b/Compute/src/V1/TargetHttpsProxiesSetCertificateMapRequest.php @@ -19,7 +19,7 @@ class TargetHttpsProxiesSetCertificateMapRequest extends \Google\Protobuf\Intern * * Generated from protobuf field optional string certificate_map = 156463796; */ - private $certificate_map = null; + protected $certificate_map = null; /** * Constructor. diff --git a/Compute/src/V1/TargetHttpsProxiesSetQuicOverrideRequest.php b/Compute/src/V1/TargetHttpsProxiesSetQuicOverrideRequest.php index 7e6b26b9069c..f6f13e171b69 100644 --- a/Compute/src/V1/TargetHttpsProxiesSetQuicOverrideRequest.php +++ b/Compute/src/V1/TargetHttpsProxiesSetQuicOverrideRequest.php @@ -20,7 +20,7 @@ class TargetHttpsProxiesSetQuicOverrideRequest extends \Google\Protobuf\Internal * * Generated from protobuf field optional string quic_override = 456577197; */ - private $quic_override = null; + protected $quic_override = null; /** * Constructor. diff --git a/Compute/src/V1/TargetHttpsProxy.php b/Compute/src/V1/TargetHttpsProxy.php index 48a5be36f7d7..1a07aec41a8f 100644 --- a/Compute/src/V1/TargetHttpsProxy.php +++ b/Compute/src/V1/TargetHttpsProxy.php @@ -9,7 +9,7 @@ use Google\Protobuf\Internal\GPBUtil; /** - * Represents a Target HTTPS Proxy resource. Google Compute Engine has two Target HTTPS Proxy resources: * [Global](/compute/docs/reference/rest/v1/targetHttpsProxies) * [Regional](https://cloud.google.com/compute/docs/reference/rest/v1/regionTargetHttpsProxies) A target HTTPS proxy is a component of Google Cloud HTTPS load balancers. * targetHttpsProxies are used by global external Application Load Balancers, classic Application Load Balancers, cross-region internal Application Load Balancers, and Traffic Director. * regionTargetHttpsProxies are used by regional internal Application Load Balancers and regional external Application Load Balancers. Forwarding rules reference a target HTTPS proxy, and the target proxy then references a URL map. For more information, read Using Target Proxies and Forwarding rule concepts. + * Represents a Target HTTPS Proxy resource. Google Compute Engine has two Target HTTPS Proxy resources: * [Global](/compute/docs/reference/rest/v1/targetHttpsProxies) * [Regional](/compute/docs/reference/rest/v1/regionTargetHttpsProxies) A target HTTPS proxy is a component of Google Cloud HTTPS load balancers. * targetHttpsProxies are used by global external Application Load Balancers, classic Application Load Balancers, cross-region internal Application Load Balancers, and Traffic Director. * regionTargetHttpsProxies are used by regional internal Application Load Balancers and regional external Application Load Balancers. Forwarding rules reference a target HTTPS proxy, and the target proxy then references a URL map. For more information, read Using Target Proxies and Forwarding rule concepts. * * Generated from protobuf message google.cloud.compute.v1.TargetHttpsProxy */ @@ -20,86 +20,86 @@ class TargetHttpsProxy extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string authorization_policy = 33945528; */ - private $authorization_policy = null; + protected $authorization_policy = null; /** * URL of a certificate map that identifies a certificate map associated with the given target proxy. This field can only be set for Global external Application Load Balancer or Classic Application Load Balancer. For other products use Certificate Manager Certificates instead. If set, sslCertificates will be ignored. Accepted format is //certificatemanager.googleapis.com/projects/{project }/locations/{location}/certificateMaps/{resourceName}. * * Generated from protobuf field optional string certificate_map = 156463796; */ - private $certificate_map = null; + protected $certificate_map = null; /** * [Output Only] Creation timestamp in RFC3339 text format. * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * An optional description of this resource. Provide this property when you create the resource. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * Fingerprint of this resource. A hash of the contents stored in this object. This field is used in optimistic locking. This field will be ignored when inserting a TargetHttpsProxy. An up-to-date fingerprint must be provided in order to patch the TargetHttpsProxy; otherwise, the request will fail with error 412 conditionNotMet. To see the latest fingerprint, make a get() request to retrieve the TargetHttpsProxy. * * Generated from protobuf field optional string fingerprint = 234678500; */ - private $fingerprint = null; + protected $fingerprint = null; /** * Specifies how long to keep a connection open, after completing a response, while there is no matching traffic (in seconds). If an HTTP keep-alive is not specified, a default value (610 seconds) will be used. For global external Application Load Balancers, the minimum allowed value is 5 seconds and the maximum allowed value is 1200 seconds. For classic Application Load Balancers, this option is not supported. * * Generated from protobuf field optional int32 http_keep_alive_timeout_sec = 447326046; */ - private $http_keep_alive_timeout_sec = null; + protected $http_keep_alive_timeout_sec = null; /** * [Output Only] The unique identifier for the resource. This identifier is defined by the server. * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * [Output Only] Type of resource. Always compute#targetHttpsProxy for target HTTPS proxies. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * This field only applies when the forwarding rule that references this target proxy has a loadBalancingScheme set to INTERNAL_SELF_MANAGED. When this field is set to true, Envoy proxies set up inbound traffic interception and bind to the IP address and port specified in the forwarding rule. This is generally useful when using Traffic Director to configure Envoy as a gateway or middle proxy (in other words, not a sidecar proxy). The Envoy proxy listens for inbound requests and handles requests when it receives them. The default is false. * * Generated from protobuf field optional bool proxy_bind = 286025582; */ - private $proxy_bind = null; + protected $proxy_bind = null; /** * Specifies the QUIC override policy for this TargetHttpsProxy resource. This setting determines whether the load balancer attempts to negotiate QUIC with clients. You can specify NONE, ENABLE, or DISABLE. - When quic-override is set to NONE, Google manages whether QUIC is used. - When quic-override is set to ENABLE, the load balancer uses QUIC when possible. - When quic-override is set to DISABLE, the load balancer doesn't use QUIC. - If the quic-override flag is not specified, NONE is implied. * Check the QuicOverride enum for the list of possible values. * * Generated from protobuf field optional string quic_override = 456577197; */ - private $quic_override = null; + protected $quic_override = null; /** * [Output Only] URL of the region where the regional TargetHttpsProxy resides. This field is not applicable to global TargetHttpsProxies. * * Generated from protobuf field optional string region = 138946292; */ - private $region = null; + protected $region = null; /** * [Output Only] Server-defined URL for the resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * Optional. A URL referring to a networksecurity.ServerTlsPolicy resource that describes how the proxy should authenticate inbound traffic. serverTlsPolicy only applies to a global TargetHttpsProxy attached to globalForwardingRules with the loadBalancingScheme set to INTERNAL_SELF_MANAGED or EXTERNAL or EXTERNAL_MANAGED or INTERNAL_MANAGED. It also applies to a regional TargetHttpsProxy attached to regional forwardingRules with the loadBalancingScheme set to EXTERNAL_MANAGED or INTERNAL_MANAGED. For details which ServerTlsPolicy resources are accepted with INTERNAL_SELF_MANAGED and which with EXTERNAL, INTERNAL_MANAGED, EXTERNAL_MANAGED loadBalancingScheme consult ServerTlsPolicy documentation. If left blank, communications are not encrypted. * * Generated from protobuf field optional string server_tls_policy = 295825266; */ - private $server_tls_policy = null; + protected $server_tls_policy = null; /** * URLs to SslCertificate resources that are used to authenticate connections between users and the load balancer. At least one SSL certificate must be specified. SslCertificates do not apply when the load balancing scheme is set to INTERNAL_SELF_MANAGED. The URLs should refer to a SSL Certificate resource or Certificate Manager Certificate resource. Mixing Classic Certificates and Certificate Manager Certificates is not allowed. Certificate Manager Certificates must include the certificatemanager API namespace. Using Certificate Manager Certificates in this field is not supported by Global external Application Load Balancer or Classic Application Load Balancer, use certificate_map instead. Currently, you may specify up to 15 Classic SSL Certificates or up to 100 Certificate Manager Certificates. Certificate Manager Certificates accepted formats are: - //certificatemanager.googleapis.com/projects/{project}/locations/{ location}/certificates/{resourceName}. - https://certificatemanager.googleapis.com/v1alpha1/projects/{project }/locations/{location}/certificates/{resourceName}. * @@ -111,20 +111,20 @@ class TargetHttpsProxy extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string ssl_policy = 295190213; */ - private $ssl_policy = null; + protected $ssl_policy = null; /** * Specifies whether TLS 1.3 0-RTT Data ("Early Data") should be accepted for this service. Early Data allows a TLS resumption handshake to include the initial application payload (a HTTP request) alongside the handshake, reducing the effective round trips to "zero". This applies to TLS 1.3 connections over TCP (HTTP/2) as well as over UDP (QUIC/h3). This can improve application performance, especially on networks where interruptions may be common, such as on mobile. Requests with Early Data will have the "Early-Data" HTTP header set on the request, with a value of "1", to allow the backend to determine whether Early Data was included. Note: TLS Early Data may allow requests to be replayed, as the data is sent to the backend before the handshake has fully completed. Applications that allow idempotent HTTP methods to make non-idempotent changes, such as a GET request updating a database, should not accept Early Data on those requests, and reject requests with the "Early-Data: 1" HTTP header by returning a HTTP 425 (Too Early) status code, in order to remain RFC compliant. The default value is DISABLED. * Check the TlsEarlyData enum for the list of possible values. * * Generated from protobuf field optional string tls_early_data = 61108426; */ - private $tls_early_data = null; + protected $tls_early_data = null; /** * A fully-qualified or valid partial URL to the UrlMap resource that defines the mapping from URL to the BackendService. For example, the following are all valid URLs for specifying a URL map: - https://www.googleapis.compute/v1/projects/project/global/urlMaps/ url-map - projects/project/global/urlMaps/url-map - global/urlMaps/url-map * * Generated from protobuf field optional string url_map = 367020684; */ - private $url_map = null; + protected $url_map = null; /** * Constructor. diff --git a/Compute/src/V1/TargetHttpsProxyAggregatedList.php b/Compute/src/V1/TargetHttpsProxyAggregatedList.php index 1bb32d0cf691..36791d67cae1 100644 --- a/Compute/src/V1/TargetHttpsProxyAggregatedList.php +++ b/Compute/src/V1/TargetHttpsProxyAggregatedList.php @@ -19,7 +19,7 @@ class TargetHttpsProxyAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of TargetHttpsProxiesScopedList resources. * @@ -31,19 +31,19 @@ class TargetHttpsProxyAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Unreachable resources. * @@ -55,7 +55,7 @@ class TargetHttpsProxyAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/TargetHttpsProxyList.php b/Compute/src/V1/TargetHttpsProxyList.php index f04bdffec719..36719b3414bc 100644 --- a/Compute/src/V1/TargetHttpsProxyList.php +++ b/Compute/src/V1/TargetHttpsProxyList.php @@ -20,7 +20,7 @@ class TargetHttpsProxyList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of TargetHttpsProxy resources. * @@ -32,25 +32,25 @@ class TargetHttpsProxyList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/TargetInstance.php b/Compute/src/V1/TargetInstance.php index 2295a78b2ad0..6aa7321eed77 100644 --- a/Compute/src/V1/TargetInstance.php +++ b/Compute/src/V1/TargetInstance.php @@ -20,68 +20,68 @@ class TargetInstance extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * An optional description of this resource. Provide this property when you create the resource. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * [Output Only] The unique identifier for the resource. This identifier is defined by the server. * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * A URL to the virtual machine instance that handles traffic for this target instance. When creating a target instance, you can provide the fully-qualified URL or a valid partial URL to the desired virtual machine. For example, the following are all valid URLs: - https://www.googleapis.com/compute/v1/projects/project/zones/zone /instances/instance - projects/project/zones/zone/instances/instance - zones/zone/instances/instance * * Generated from protobuf field optional string instance = 18257045; */ - private $instance = null; + protected $instance = null; /** * [Output Only] The type of the resource. Always compute#targetInstance for target instances. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * Must have a value of NO_NAT. Protocol forwarding delivers packets while preserving the destination IP address of the forwarding rule referencing the target instance. * Check the NatPolicy enum for the list of possible values. * * Generated from protobuf field optional string nat_policy = 509780496; */ - private $nat_policy = null; + protected $nat_policy = null; /** * The URL of the network this target instance uses to forward traffic. If not specified, the traffic will be forwarded to the network that the default network interface belongs to. * * Generated from protobuf field optional string network = 232872494; */ - private $network = null; + protected $network = null; /** * [Output Only] The resource URL for the security policy associated with this target instance. * * Generated from protobuf field optional string security_policy = 171082513; */ - private $security_policy = null; + protected $security_policy = null; /** * [Output Only] Server-defined URL for the resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] URL of the zone where the target instance resides. You must specify this field as part of the HTTP request URL. It is not settable as a field in the request body. * * Generated from protobuf field optional string zone = 3744684; */ - private $zone = null; + protected $zone = null; /** * Constructor. diff --git a/Compute/src/V1/TargetInstanceAggregatedList.php b/Compute/src/V1/TargetInstanceAggregatedList.php index 9dee5a0a4f24..79aacd037cc8 100644 --- a/Compute/src/V1/TargetInstanceAggregatedList.php +++ b/Compute/src/V1/TargetInstanceAggregatedList.php @@ -19,7 +19,7 @@ class TargetInstanceAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of TargetInstance resources. * @@ -31,19 +31,19 @@ class TargetInstanceAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Unreachable resources. * @@ -55,7 +55,7 @@ class TargetInstanceAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/TargetInstanceList.php b/Compute/src/V1/TargetInstanceList.php index 4f51b73a9a6e..c546ea532fde 100644 --- a/Compute/src/V1/TargetInstanceList.php +++ b/Compute/src/V1/TargetInstanceList.php @@ -20,7 +20,7 @@ class TargetInstanceList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of TargetInstance resources. * @@ -32,25 +32,25 @@ class TargetInstanceList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/TargetInstancesClient.php b/Compute/src/V1/TargetInstancesClient.php deleted file mode 100644 index 5f847ca7ea81..000000000000 --- a/Compute/src/V1/TargetInstancesClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/TargetPool.php b/Compute/src/V1/TargetPool.php index 4a08a99d3b93..0bc9b6bde623 100644 --- a/Compute/src/V1/TargetPool.php +++ b/Compute/src/V1/TargetPool.php @@ -20,25 +20,25 @@ class TargetPool extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string backup_pool = 45884537; */ - private $backup_pool = null; + protected $backup_pool = null; /** * [Output Only] Creation timestamp in RFC3339 text format. * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * An optional description of this resource. Provide this property when you create the resource. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * This field is applicable only when the containing target pool is serving a forwarding rule as the primary pool (i.e., not as a backup pool to some other target pool). The value of the field must be in [0, 1]. If set, backupPool must also be set. They together define the fallback behavior of the primary target pool: if the ratio of the healthy instances in the primary pool is at or below this number, traffic arriving at the load-balanced IP will be directed to the backup pool. In case where failoverRatio is not set or all the instances in the backup pool are unhealthy, the traffic will be directed back to the primary pool in the "force" mode, where traffic will be spread to the healthy instances with the best effort, or to all instances when no instance is healthy. * * Generated from protobuf field optional float failover_ratio = 212667006; */ - private $failover_ratio = null; + protected $failover_ratio = null; /** * The URL of the HttpHealthCheck resource. A member instance in this pool is considered healthy if and only if the health checks pass. Only legacy HttpHealthChecks are supported. Only one health check may be specified. * @@ -50,7 +50,7 @@ class TargetPool extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * A list of resource URLs to the virtual machine instances serving this pool. They must live in zones contained in the same region as this pool. * @@ -62,38 +62,38 @@ class TargetPool extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * [Output Only] URL of the region where the target pool resides. * * Generated from protobuf field optional string region = 138946292; */ - private $region = null; + protected $region = null; /** * [Output Only] The resource URL for the security policy associated with this target pool. * * Generated from protobuf field optional string security_policy = 171082513; */ - private $security_policy = null; + protected $security_policy = null; /** * [Output Only] Server-defined URL for the resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * Session affinity option, must be one of the following values: NONE: Connections from the same client IP may go to any instance in the pool. CLIENT_IP: Connections from the same client IP will go to the same instance in the pool while that instance remains healthy. CLIENT_IP_PROTO: Connections from the same client IP with the same IP protocol will go to the same instance in the pool while that instance remains healthy. * Check the SessionAffinity enum for the list of possible values. * * Generated from protobuf field optional string session_affinity = 463888561; */ - private $session_affinity = null; + protected $session_affinity = null; /** * Constructor. diff --git a/Compute/src/V1/TargetPoolAggregatedList.php b/Compute/src/V1/TargetPoolAggregatedList.php index 38c5a2d6976e..95c29e9e33fc 100644 --- a/Compute/src/V1/TargetPoolAggregatedList.php +++ b/Compute/src/V1/TargetPoolAggregatedList.php @@ -19,7 +19,7 @@ class TargetPoolAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of TargetPool resources. * @@ -31,19 +31,19 @@ class TargetPoolAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Unreachable resources. * @@ -55,7 +55,7 @@ class TargetPoolAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/TargetPoolInstanceHealth.php b/Compute/src/V1/TargetPoolInstanceHealth.php index 9c02d242eb8b..e27ad1afe6ef 100644 --- a/Compute/src/V1/TargetPoolInstanceHealth.php +++ b/Compute/src/V1/TargetPoolInstanceHealth.php @@ -23,7 +23,7 @@ class TargetPoolInstanceHealth extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * Constructor. diff --git a/Compute/src/V1/TargetPoolList.php b/Compute/src/V1/TargetPoolList.php index a626995128cf..7e64e3948482 100644 --- a/Compute/src/V1/TargetPoolList.php +++ b/Compute/src/V1/TargetPoolList.php @@ -20,7 +20,7 @@ class TargetPoolList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of TargetPool resources. * @@ -32,25 +32,25 @@ class TargetPoolList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/TargetPoolsClient.php b/Compute/src/V1/TargetPoolsClient.php deleted file mode 100644 index 247687da8b7e..000000000000 --- a/Compute/src/V1/TargetPoolsClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/TargetReference.php b/Compute/src/V1/TargetReference.php index 3af4a33904ac..61d7f40e1e4a 100644 --- a/Compute/src/V1/TargetReference.php +++ b/Compute/src/V1/TargetReference.php @@ -17,7 +17,7 @@ class TargetReference extends \Google\Protobuf\Internal\Message /** * Generated from protobuf field optional string target = 192835985; */ - private $target = null; + protected $target = null; /** * Constructor. diff --git a/Compute/src/V1/TargetSslProxiesClient.php b/Compute/src/V1/TargetSslProxiesClient.php deleted file mode 100644 index c607f9e57a4e..000000000000 --- a/Compute/src/V1/TargetSslProxiesClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional string service = 373540533; */ - private $service = null; + protected $service = null; /** * Constructor. diff --git a/Compute/src/V1/TargetSslProxiesSetCertificateMapRequest.php b/Compute/src/V1/TargetSslProxiesSetCertificateMapRequest.php index 6235fb5a4937..20c8a97e34d6 100644 --- a/Compute/src/V1/TargetSslProxiesSetCertificateMapRequest.php +++ b/Compute/src/V1/TargetSslProxiesSetCertificateMapRequest.php @@ -19,7 +19,7 @@ class TargetSslProxiesSetCertificateMapRequest extends \Google\Protobuf\Internal * * Generated from protobuf field optional string certificate_map = 156463796; */ - private $certificate_map = null; + protected $certificate_map = null; /** * Constructor. diff --git a/Compute/src/V1/TargetSslProxiesSetProxyHeaderRequest.php b/Compute/src/V1/TargetSslProxiesSetProxyHeaderRequest.php index 2505a27bd248..f2bc6b788640 100644 --- a/Compute/src/V1/TargetSslProxiesSetProxyHeaderRequest.php +++ b/Compute/src/V1/TargetSslProxiesSetProxyHeaderRequest.php @@ -20,7 +20,7 @@ class TargetSslProxiesSetProxyHeaderRequest extends \Google\Protobuf\Internal\Me * * Generated from protobuf field optional string proxy_header = 160374142; */ - private $proxy_header = null; + protected $proxy_header = null; /** * Constructor. diff --git a/Compute/src/V1/TargetSslProxy.php b/Compute/src/V1/TargetSslProxy.php index 3c90db47846a..9c3743b078de 100644 --- a/Compute/src/V1/TargetSslProxy.php +++ b/Compute/src/V1/TargetSslProxy.php @@ -20,56 +20,56 @@ class TargetSslProxy extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string certificate_map = 156463796; */ - private $certificate_map = null; + protected $certificate_map = null; /** * [Output Only] Creation timestamp in RFC3339 text format. * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * An optional description of this resource. Provide this property when you create the resource. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * [Output Only] The unique identifier for the resource. This identifier is defined by the server. * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * [Output Only] Type of the resource. Always compute#targetSslProxy for target SSL proxies. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * Specifies the type of proxy header to append before sending data to the backend, either NONE or PROXY_V1. The default is NONE. * Check the ProxyHeader enum for the list of possible values. * * Generated from protobuf field optional string proxy_header = 160374142; */ - private $proxy_header = null; + protected $proxy_header = null; /** * [Output Only] Server-defined URL for the resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * URL to the BackendService resource. * * Generated from protobuf field optional string service = 373540533; */ - private $service = null; + protected $service = null; /** * URLs to SslCertificate resources that are used to authenticate connections to Backends. At least one SSL certificate must be specified. Currently, you may specify up to 15 SSL certificates. sslCertificates do not apply when the load balancing scheme is set to INTERNAL_SELF_MANAGED. * @@ -81,7 +81,7 @@ class TargetSslProxy extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string ssl_policy = 295190213; */ - private $ssl_policy = null; + protected $ssl_policy = null; /** * Constructor. diff --git a/Compute/src/V1/TargetSslProxyList.php b/Compute/src/V1/TargetSslProxyList.php index 415668fe0ea4..e4b0f43fc17d 100644 --- a/Compute/src/V1/TargetSslProxyList.php +++ b/Compute/src/V1/TargetSslProxyList.php @@ -20,7 +20,7 @@ class TargetSslProxyList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of TargetSslProxy resources. * @@ -32,25 +32,25 @@ class TargetSslProxyList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/TargetTcpProxiesClient.php b/Compute/src/V1/TargetTcpProxiesClient.php deleted file mode 100644 index b804e9bc5b82..000000000000 --- a/Compute/src/V1/TargetTcpProxiesClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/TargetTcpProxiesSetBackendServiceRequest.php b/Compute/src/V1/TargetTcpProxiesSetBackendServiceRequest.php index d2da8d1ce7ff..1a32be372ca7 100644 --- a/Compute/src/V1/TargetTcpProxiesSetBackendServiceRequest.php +++ b/Compute/src/V1/TargetTcpProxiesSetBackendServiceRequest.php @@ -19,7 +19,7 @@ class TargetTcpProxiesSetBackendServiceRequest extends \Google\Protobuf\Internal * * Generated from protobuf field optional string service = 373540533; */ - private $service = null; + protected $service = null; /** * Constructor. diff --git a/Compute/src/V1/TargetTcpProxiesSetProxyHeaderRequest.php b/Compute/src/V1/TargetTcpProxiesSetProxyHeaderRequest.php index e8f86c8939b3..93e269d8bea2 100644 --- a/Compute/src/V1/TargetTcpProxiesSetProxyHeaderRequest.php +++ b/Compute/src/V1/TargetTcpProxiesSetProxyHeaderRequest.php @@ -20,7 +20,7 @@ class TargetTcpProxiesSetProxyHeaderRequest extends \Google\Protobuf\Internal\Me * * Generated from protobuf field optional string proxy_header = 160374142; */ - private $proxy_header = null; + protected $proxy_header = null; /** * Constructor. diff --git a/Compute/src/V1/TargetTcpProxy.php b/Compute/src/V1/TargetTcpProxy.php index 9734c6cbf97f..67fdc2f449c5 100644 --- a/Compute/src/V1/TargetTcpProxy.php +++ b/Compute/src/V1/TargetTcpProxy.php @@ -20,62 +20,62 @@ class TargetTcpProxy extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * An optional description of this resource. Provide this property when you create the resource. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * [Output Only] The unique identifier for the resource. This identifier is defined by the server. * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * [Output Only] Type of the resource. Always compute#targetTcpProxy for target TCP proxies. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * This field only applies when the forwarding rule that references this target proxy has a loadBalancingScheme set to INTERNAL_SELF_MANAGED. When this field is set to true, Envoy proxies set up inbound traffic interception and bind to the IP address and port specified in the forwarding rule. This is generally useful when using Traffic Director to configure Envoy as a gateway or middle proxy (in other words, not a sidecar proxy). The Envoy proxy listens for inbound requests and handles requests when it receives them. The default is false. * * Generated from protobuf field optional bool proxy_bind = 286025582; */ - private $proxy_bind = null; + protected $proxy_bind = null; /** * Specifies the type of proxy header to append before sending data to the backend, either NONE or PROXY_V1. The default is NONE. * Check the ProxyHeader enum for the list of possible values. * * Generated from protobuf field optional string proxy_header = 160374142; */ - private $proxy_header = null; + protected $proxy_header = null; /** * [Output Only] URL of the region where the regional TCP proxy resides. This field is not applicable to global TCP proxy. * * Generated from protobuf field optional string region = 138946292; */ - private $region = null; + protected $region = null; /** * [Output Only] Server-defined URL for the resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * URL to the BackendService resource. * * Generated from protobuf field optional string service = 373540533; */ - private $service = null; + protected $service = null; /** * Constructor. diff --git a/Compute/src/V1/TargetTcpProxyAggregatedList.php b/Compute/src/V1/TargetTcpProxyAggregatedList.php index 9581547c8856..15caba7e64eb 100644 --- a/Compute/src/V1/TargetTcpProxyAggregatedList.php +++ b/Compute/src/V1/TargetTcpProxyAggregatedList.php @@ -19,7 +19,7 @@ class TargetTcpProxyAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of TargetTcpProxiesScopedList resources. * @@ -31,19 +31,19 @@ class TargetTcpProxyAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Unreachable resources. * @@ -55,7 +55,7 @@ class TargetTcpProxyAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/TargetTcpProxyList.php b/Compute/src/V1/TargetTcpProxyList.php index 1ea01e89d3c1..111265221f1f 100644 --- a/Compute/src/V1/TargetTcpProxyList.php +++ b/Compute/src/V1/TargetTcpProxyList.php @@ -20,7 +20,7 @@ class TargetTcpProxyList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of TargetTcpProxy resources. * @@ -32,25 +32,25 @@ class TargetTcpProxyList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/TargetVpnGateway.php b/Compute/src/V1/TargetVpnGateway.php index 9746d7b729de..2bfbd2cf71a0 100644 --- a/Compute/src/V1/TargetVpnGateway.php +++ b/Compute/src/V1/TargetVpnGateway.php @@ -20,13 +20,13 @@ class TargetVpnGateway extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * An optional description of this resource. Provide this property when you create the resource. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * [Output Only] A list of URLs to the ForwardingRule resources. ForwardingRules are created using compute.forwardingRules.insert and associated with a VPN gateway. * @@ -38,19 +38,19 @@ class TargetVpnGateway extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * [Output Only] Type of resource. Always compute#targetVpnGateway for target VPN gateways. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * A fingerprint for the labels being applied to this TargetVpnGateway, which is essentially a hash of the labels set used for optimistic locking. The fingerprint is initially generated by Compute Engine and changes after every request to modify or update labels. You must always provide an up-to-date fingerprint hash in order to update or change labels, otherwise the request will fail with error 412 conditionNotMet. To see the latest fingerprint, make a get() request to retrieve a TargetVpnGateway. * * Generated from protobuf field optional string label_fingerprint = 178124825; */ - private $label_fingerprint = null; + protected $label_fingerprint = null; /** * Labels for this resource. These can only be added or modified by the setLabels method. Each label key/value pair must comply with RFC1035. Label values may be empty. * @@ -62,32 +62,32 @@ class TargetVpnGateway extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * URL of the network to which this VPN gateway is attached. Provided by the client when the VPN gateway is created. * * Generated from protobuf field optional string network = 232872494; */ - private $network = null; + protected $network = null; /** * [Output Only] URL of the region where the target VPN gateway resides. You must specify this field as part of the HTTP request URL. It is not settable as a field in the request body. * * Generated from protobuf field optional string region = 138946292; */ - private $region = null; + protected $region = null; /** * [Output Only] Server-defined URL for the resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] The status of the VPN gateway, which can be one of the following: CREATING, READY, FAILED, or DELETING. * Check the Status enum for the list of possible values. * * Generated from protobuf field optional string status = 181260274; */ - private $status = null; + protected $status = null; /** * [Output Only] A list of URLs to VpnTunnel resources. VpnTunnels are created using the compute.vpntunnels.insert method and associated with a VPN gateway. * diff --git a/Compute/src/V1/TargetVpnGatewayAggregatedList.php b/Compute/src/V1/TargetVpnGatewayAggregatedList.php index 6ee8f2a61516..6a734fe10070 100644 --- a/Compute/src/V1/TargetVpnGatewayAggregatedList.php +++ b/Compute/src/V1/TargetVpnGatewayAggregatedList.php @@ -19,7 +19,7 @@ class TargetVpnGatewayAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of TargetVpnGateway resources. * @@ -31,19 +31,19 @@ class TargetVpnGatewayAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Unreachable resources. * @@ -55,7 +55,7 @@ class TargetVpnGatewayAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/TargetVpnGatewayList.php b/Compute/src/V1/TargetVpnGatewayList.php index da9d4d9c961a..dc4920849ca9 100644 --- a/Compute/src/V1/TargetVpnGatewayList.php +++ b/Compute/src/V1/TargetVpnGatewayList.php @@ -20,7 +20,7 @@ class TargetVpnGatewayList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of TargetVpnGateway resources. * @@ -32,25 +32,25 @@ class TargetVpnGatewayList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/TargetVpnGatewaysClient.php b/Compute/src/V1/TargetVpnGatewaysClient.php deleted file mode 100644 index c3ababe0441d..000000000000 --- a/Compute/src/V1/TargetVpnGatewaysClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/TestFailure.php b/Compute/src/V1/TestFailure.php index acda691f4aea..dd4da3f41f93 100644 --- a/Compute/src/V1/TestFailure.php +++ b/Compute/src/V1/TestFailure.php @@ -19,37 +19,37 @@ class TestFailure extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string actual_output_url = 287075458; */ - private $actual_output_url = null; + protected $actual_output_url = null; /** * Actual HTTP status code for rule with `urlRedirect` calculated by load balancer * * Generated from protobuf field optional int32 actual_redirect_response_code = 42926553; */ - private $actual_redirect_response_code = null; + protected $actual_redirect_response_code = null; /** * BackendService or BackendBucket returned by load balancer. * * Generated from protobuf field optional string actual_service = 440379652; */ - private $actual_service = null; + protected $actual_service = null; /** * The expected output URL evaluated by a load balancer containing the scheme, host, path and query parameters. * * Generated from protobuf field optional string expected_output_url = 433967384; */ - private $expected_output_url = null; + protected $expected_output_url = null; /** * Expected HTTP status code for rule with `urlRedirect` calculated by load balancer * * Generated from protobuf field optional int32 expected_redirect_response_code = 18888047; */ - private $expected_redirect_response_code = null; + protected $expected_redirect_response_code = null; /** * Expected BackendService or BackendBucket resource the given URL should be mapped to. * * Generated from protobuf field optional string expected_service = 133987374; */ - private $expected_service = null; + protected $expected_service = null; /** * HTTP headers of the request. * @@ -61,13 +61,13 @@ class TestFailure extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string host = 3208616; */ - private $host = null; + protected $host = null; /** * Path portion including query parameters in the URL. * * Generated from protobuf field optional string path = 3433509; */ - private $path = null; + protected $path = null; /** * Constructor. diff --git a/Compute/src/V1/TestIamPermissionsBackendBucketRequest.php b/Compute/src/V1/TestIamPermissionsBackendBucketRequest.php index a17bd412578e..abf4ee90ebbe 100644 --- a/Compute/src/V1/TestIamPermissionsBackendBucketRequest.php +++ b/Compute/src/V1/TestIamPermissionsBackendBucketRequest.php @@ -20,19 +20,19 @@ class TestIamPermissionsBackendBucketRequest extends \Google\Protobuf\Internal\M * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.TestPermissionsRequest test_permissions_request_resource = 439214758 [(.google.api.field_behavior) = REQUIRED]; */ - private $test_permissions_request_resource = null; + protected $test_permissions_request_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/TestIamPermissionsBackendServiceRequest.php b/Compute/src/V1/TestIamPermissionsBackendServiceRequest.php index 81847fb0ea2d..202238f8a2b9 100644 --- a/Compute/src/V1/TestIamPermissionsBackendServiceRequest.php +++ b/Compute/src/V1/TestIamPermissionsBackendServiceRequest.php @@ -20,19 +20,19 @@ class TestIamPermissionsBackendServiceRequest extends \Google\Protobuf\Internal\ * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.TestPermissionsRequest test_permissions_request_resource = 439214758 [(.google.api.field_behavior) = REQUIRED]; */ - private $test_permissions_request_resource = null; + protected $test_permissions_request_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/TestIamPermissionsDiskRequest.php b/Compute/src/V1/TestIamPermissionsDiskRequest.php index 2edf6fbdfbf2..365682f2ae41 100644 --- a/Compute/src/V1/TestIamPermissionsDiskRequest.php +++ b/Compute/src/V1/TestIamPermissionsDiskRequest.php @@ -20,25 +20,25 @@ class TestIamPermissionsDiskRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.TestPermissionsRequest test_permissions_request_resource = 439214758 [(.google.api.field_behavior) = REQUIRED]; */ - private $test_permissions_request_resource = null; + protected $test_permissions_request_resource = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/TestIamPermissionsExternalVpnGatewayRequest.php b/Compute/src/V1/TestIamPermissionsExternalVpnGatewayRequest.php index aec239ddb8ee..101781805ca7 100644 --- a/Compute/src/V1/TestIamPermissionsExternalVpnGatewayRequest.php +++ b/Compute/src/V1/TestIamPermissionsExternalVpnGatewayRequest.php @@ -20,19 +20,19 @@ class TestIamPermissionsExternalVpnGatewayRequest extends \Google\Protobuf\Inter * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.TestPermissionsRequest test_permissions_request_resource = 439214758 [(.google.api.field_behavior) = REQUIRED]; */ - private $test_permissions_request_resource = null; + protected $test_permissions_request_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/TestIamPermissionsFirewallPolicyRequest.php b/Compute/src/V1/TestIamPermissionsFirewallPolicyRequest.php index dabaada929ed..2e3833946f35 100644 --- a/Compute/src/V1/TestIamPermissionsFirewallPolicyRequest.php +++ b/Compute/src/V1/TestIamPermissionsFirewallPolicyRequest.php @@ -20,13 +20,13 @@ class TestIamPermissionsFirewallPolicyRequest extends \Google\Protobuf\Internal\ * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.TestPermissionsRequest test_permissions_request_resource = 439214758 [(.google.api.field_behavior) = REQUIRED]; */ - private $test_permissions_request_resource = null; + protected $test_permissions_request_resource = null; /** * @param string $resource Name or id of the resource for this request. diff --git a/Compute/src/V1/TestIamPermissionsImageRequest.php b/Compute/src/V1/TestIamPermissionsImageRequest.php index 808792c5bce2..ad25a0fcfda3 100644 --- a/Compute/src/V1/TestIamPermissionsImageRequest.php +++ b/Compute/src/V1/TestIamPermissionsImageRequest.php @@ -20,19 +20,19 @@ class TestIamPermissionsImageRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.TestPermissionsRequest test_permissions_request_resource = 439214758 [(.google.api.field_behavior) = REQUIRED]; */ - private $test_permissions_request_resource = null; + protected $test_permissions_request_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/TestIamPermissionsInstanceRequest.php b/Compute/src/V1/TestIamPermissionsInstanceRequest.php index aa0076e9806a..4f4b84205afe 100644 --- a/Compute/src/V1/TestIamPermissionsInstanceRequest.php +++ b/Compute/src/V1/TestIamPermissionsInstanceRequest.php @@ -20,25 +20,25 @@ class TestIamPermissionsInstanceRequest extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.TestPermissionsRequest test_permissions_request_resource = 439214758 [(.google.api.field_behavior) = REQUIRED]; */ - private $test_permissions_request_resource = null; + protected $test_permissions_request_resource = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/TestIamPermissionsInstanceTemplateRequest.php b/Compute/src/V1/TestIamPermissionsInstanceTemplateRequest.php index 9457987a0bfd..ab2b3e429d4b 100644 --- a/Compute/src/V1/TestIamPermissionsInstanceTemplateRequest.php +++ b/Compute/src/V1/TestIamPermissionsInstanceTemplateRequest.php @@ -20,19 +20,19 @@ class TestIamPermissionsInstanceTemplateRequest extends \Google\Protobuf\Interna * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.TestPermissionsRequest test_permissions_request_resource = 439214758 [(.google.api.field_behavior) = REQUIRED]; */ - private $test_permissions_request_resource = null; + protected $test_permissions_request_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/TestIamPermissionsInstantSnapshotRequest.php b/Compute/src/V1/TestIamPermissionsInstantSnapshotRequest.php index 7a66ab99f2b0..b11f5604f6b2 100644 --- a/Compute/src/V1/TestIamPermissionsInstantSnapshotRequest.php +++ b/Compute/src/V1/TestIamPermissionsInstantSnapshotRequest.php @@ -20,25 +20,25 @@ class TestIamPermissionsInstantSnapshotRequest extends \Google\Protobuf\Internal * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.TestPermissionsRequest test_permissions_request_resource = 439214758 [(.google.api.field_behavior) = REQUIRED]; */ - private $test_permissions_request_resource = null; + protected $test_permissions_request_resource = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/TestIamPermissionsInterconnectAttachmentGroupRequest.php b/Compute/src/V1/TestIamPermissionsInterconnectAttachmentGroupRequest.php index 6c7d03d2cc5d..317f92581145 100644 --- a/Compute/src/V1/TestIamPermissionsInterconnectAttachmentGroupRequest.php +++ b/Compute/src/V1/TestIamPermissionsInterconnectAttachmentGroupRequest.php @@ -20,19 +20,19 @@ class TestIamPermissionsInterconnectAttachmentGroupRequest extends \Google\Proto * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.TestPermissionsRequest test_permissions_request_resource = 439214758 [(.google.api.field_behavior) = REQUIRED]; */ - private $test_permissions_request_resource = null; + protected $test_permissions_request_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/TestIamPermissionsInterconnectGroupRequest.php b/Compute/src/V1/TestIamPermissionsInterconnectGroupRequest.php index ed1332a36160..fe7bc4a01ce2 100644 --- a/Compute/src/V1/TestIamPermissionsInterconnectGroupRequest.php +++ b/Compute/src/V1/TestIamPermissionsInterconnectGroupRequest.php @@ -20,19 +20,19 @@ class TestIamPermissionsInterconnectGroupRequest extends \Google\Protobuf\Intern * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.TestPermissionsRequest test_permissions_request_resource = 439214758 [(.google.api.field_behavior) = REQUIRED]; */ - private $test_permissions_request_resource = null; + protected $test_permissions_request_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/TestIamPermissionsLicenseCodeRequest.php b/Compute/src/V1/TestIamPermissionsLicenseCodeRequest.php index c5fd9ab33d8e..786ab0f182dd 100644 --- a/Compute/src/V1/TestIamPermissionsLicenseCodeRequest.php +++ b/Compute/src/V1/TestIamPermissionsLicenseCodeRequest.php @@ -20,19 +20,19 @@ class TestIamPermissionsLicenseCodeRequest extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.TestPermissionsRequest test_permissions_request_resource = 439214758 [(.google.api.field_behavior) = REQUIRED]; */ - private $test_permissions_request_resource = null; + protected $test_permissions_request_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/TestIamPermissionsLicenseRequest.php b/Compute/src/V1/TestIamPermissionsLicenseRequest.php index 33df411bc5e7..d6edef1e9bd7 100644 --- a/Compute/src/V1/TestIamPermissionsLicenseRequest.php +++ b/Compute/src/V1/TestIamPermissionsLicenseRequest.php @@ -20,19 +20,19 @@ class TestIamPermissionsLicenseRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.TestPermissionsRequest test_permissions_request_resource = 439214758 [(.google.api.field_behavior) = REQUIRED]; */ - private $test_permissions_request_resource = null; + protected $test_permissions_request_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/TestIamPermissionsMachineImageRequest.php b/Compute/src/V1/TestIamPermissionsMachineImageRequest.php index 73ab29cab21f..39a441f57a9d 100644 --- a/Compute/src/V1/TestIamPermissionsMachineImageRequest.php +++ b/Compute/src/V1/TestIamPermissionsMachineImageRequest.php @@ -20,19 +20,19 @@ class TestIamPermissionsMachineImageRequest extends \Google\Protobuf\Internal\Me * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.TestPermissionsRequest test_permissions_request_resource = 439214758 [(.google.api.field_behavior) = REQUIRED]; */ - private $test_permissions_request_resource = null; + protected $test_permissions_request_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/TestIamPermissionsNetworkAttachmentRequest.php b/Compute/src/V1/TestIamPermissionsNetworkAttachmentRequest.php index 0502f7848df9..2db7f09410bf 100644 --- a/Compute/src/V1/TestIamPermissionsNetworkAttachmentRequest.php +++ b/Compute/src/V1/TestIamPermissionsNetworkAttachmentRequest.php @@ -20,25 +20,25 @@ class TestIamPermissionsNetworkAttachmentRequest extends \Google\Protobuf\Intern * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * The name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.TestPermissionsRequest test_permissions_request_resource = 439214758 [(.google.api.field_behavior) = REQUIRED]; */ - private $test_permissions_request_resource = null; + protected $test_permissions_request_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/TestIamPermissionsNetworkEndpointGroupRequest.php b/Compute/src/V1/TestIamPermissionsNetworkEndpointGroupRequest.php index 55074f0b2f51..0cbf3bde605e 100644 --- a/Compute/src/V1/TestIamPermissionsNetworkEndpointGroupRequest.php +++ b/Compute/src/V1/TestIamPermissionsNetworkEndpointGroupRequest.php @@ -20,25 +20,25 @@ class TestIamPermissionsNetworkEndpointGroupRequest extends \Google\Protobuf\Int * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.TestPermissionsRequest test_permissions_request_resource = 439214758 [(.google.api.field_behavior) = REQUIRED]; */ - private $test_permissions_request_resource = null; + protected $test_permissions_request_resource = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/TestIamPermissionsNetworkFirewallPolicyRequest.php b/Compute/src/V1/TestIamPermissionsNetworkFirewallPolicyRequest.php index f55625fa9f41..901c10caadf0 100644 --- a/Compute/src/V1/TestIamPermissionsNetworkFirewallPolicyRequest.php +++ b/Compute/src/V1/TestIamPermissionsNetworkFirewallPolicyRequest.php @@ -20,19 +20,19 @@ class TestIamPermissionsNetworkFirewallPolicyRequest extends \Google\Protobuf\In * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.TestPermissionsRequest test_permissions_request_resource = 439214758 [(.google.api.field_behavior) = REQUIRED]; */ - private $test_permissions_request_resource = null; + protected $test_permissions_request_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/TestIamPermissionsNodeGroupRequest.php b/Compute/src/V1/TestIamPermissionsNodeGroupRequest.php index 238aa5940f68..f22e04ef9eb6 100644 --- a/Compute/src/V1/TestIamPermissionsNodeGroupRequest.php +++ b/Compute/src/V1/TestIamPermissionsNodeGroupRequest.php @@ -20,25 +20,25 @@ class TestIamPermissionsNodeGroupRequest extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.TestPermissionsRequest test_permissions_request_resource = 439214758 [(.google.api.field_behavior) = REQUIRED]; */ - private $test_permissions_request_resource = null; + protected $test_permissions_request_resource = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/TestIamPermissionsNodeTemplateRequest.php b/Compute/src/V1/TestIamPermissionsNodeTemplateRequest.php index 0b543c151330..b6bdd7de3940 100644 --- a/Compute/src/V1/TestIamPermissionsNodeTemplateRequest.php +++ b/Compute/src/V1/TestIamPermissionsNodeTemplateRequest.php @@ -20,25 +20,25 @@ class TestIamPermissionsNodeTemplateRequest extends \Google\Protobuf\Internal\Me * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * The name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.TestPermissionsRequest test_permissions_request_resource = 439214758 [(.google.api.field_behavior) = REQUIRED]; */ - private $test_permissions_request_resource = null; + protected $test_permissions_request_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/TestIamPermissionsPacketMirroringRequest.php b/Compute/src/V1/TestIamPermissionsPacketMirroringRequest.php index ef696939c833..e295fbae7d21 100644 --- a/Compute/src/V1/TestIamPermissionsPacketMirroringRequest.php +++ b/Compute/src/V1/TestIamPermissionsPacketMirroringRequest.php @@ -20,25 +20,25 @@ class TestIamPermissionsPacketMirroringRequest extends \Google\Protobuf\Internal * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * The name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.TestPermissionsRequest test_permissions_request_resource = 439214758 [(.google.api.field_behavior) = REQUIRED]; */ - private $test_permissions_request_resource = null; + protected $test_permissions_request_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/TestIamPermissionsRegionBackendServiceRequest.php b/Compute/src/V1/TestIamPermissionsRegionBackendServiceRequest.php index 29573219152b..548a040f5fb7 100644 --- a/Compute/src/V1/TestIamPermissionsRegionBackendServiceRequest.php +++ b/Compute/src/V1/TestIamPermissionsRegionBackendServiceRequest.php @@ -20,25 +20,25 @@ class TestIamPermissionsRegionBackendServiceRequest extends \Google\Protobuf\Int * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * The name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.TestPermissionsRequest test_permissions_request_resource = 439214758 [(.google.api.field_behavior) = REQUIRED]; */ - private $test_permissions_request_resource = null; + protected $test_permissions_request_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/TestIamPermissionsRegionDiskRequest.php b/Compute/src/V1/TestIamPermissionsRegionDiskRequest.php index 6bac55c7c07c..66638d14cfef 100644 --- a/Compute/src/V1/TestIamPermissionsRegionDiskRequest.php +++ b/Compute/src/V1/TestIamPermissionsRegionDiskRequest.php @@ -20,25 +20,25 @@ class TestIamPermissionsRegionDiskRequest extends \Google\Protobuf\Internal\Mess * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * The name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.TestPermissionsRequest test_permissions_request_resource = 439214758 [(.google.api.field_behavior) = REQUIRED]; */ - private $test_permissions_request_resource = null; + protected $test_permissions_request_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/TestIamPermissionsRegionInstantSnapshotRequest.php b/Compute/src/V1/TestIamPermissionsRegionInstantSnapshotRequest.php index 2ad77ee163ad..94884ab084c8 100644 --- a/Compute/src/V1/TestIamPermissionsRegionInstantSnapshotRequest.php +++ b/Compute/src/V1/TestIamPermissionsRegionInstantSnapshotRequest.php @@ -20,25 +20,25 @@ class TestIamPermissionsRegionInstantSnapshotRequest extends \Google\Protobuf\In * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * The name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.TestPermissionsRequest test_permissions_request_resource = 439214758 [(.google.api.field_behavior) = REQUIRED]; */ - private $test_permissions_request_resource = null; + protected $test_permissions_request_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/TestIamPermissionsRegionNetworkFirewallPolicyRequest.php b/Compute/src/V1/TestIamPermissionsRegionNetworkFirewallPolicyRequest.php index 68180f2f2368..747366819c58 100644 --- a/Compute/src/V1/TestIamPermissionsRegionNetworkFirewallPolicyRequest.php +++ b/Compute/src/V1/TestIamPermissionsRegionNetworkFirewallPolicyRequest.php @@ -20,25 +20,25 @@ class TestIamPermissionsRegionNetworkFirewallPolicyRequest extends \Google\Proto * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * The name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.TestPermissionsRequest test_permissions_request_resource = 439214758 [(.google.api.field_behavior) = REQUIRED]; */ - private $test_permissions_request_resource = null; + protected $test_permissions_request_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/TestIamPermissionsReservationRequest.php b/Compute/src/V1/TestIamPermissionsReservationRequest.php index acab72276d4d..870676244051 100644 --- a/Compute/src/V1/TestIamPermissionsReservationRequest.php +++ b/Compute/src/V1/TestIamPermissionsReservationRequest.php @@ -20,25 +20,25 @@ class TestIamPermissionsReservationRequest extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.TestPermissionsRequest test_permissions_request_resource = 439214758 [(.google.api.field_behavior) = REQUIRED]; */ - private $test_permissions_request_resource = null; + protected $test_permissions_request_resource = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/TestIamPermissionsResourcePolicyRequest.php b/Compute/src/V1/TestIamPermissionsResourcePolicyRequest.php index e38a4b0e6e72..2df43854f341 100644 --- a/Compute/src/V1/TestIamPermissionsResourcePolicyRequest.php +++ b/Compute/src/V1/TestIamPermissionsResourcePolicyRequest.php @@ -20,25 +20,25 @@ class TestIamPermissionsResourcePolicyRequest extends \Google\Protobuf\Internal\ * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * The name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.TestPermissionsRequest test_permissions_request_resource = 439214758 [(.google.api.field_behavior) = REQUIRED]; */ - private $test_permissions_request_resource = null; + protected $test_permissions_request_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/TestIamPermissionsServiceAttachmentRequest.php b/Compute/src/V1/TestIamPermissionsServiceAttachmentRequest.php index 206254211db5..35b9cbd9aa98 100644 --- a/Compute/src/V1/TestIamPermissionsServiceAttachmentRequest.php +++ b/Compute/src/V1/TestIamPermissionsServiceAttachmentRequest.php @@ -20,25 +20,25 @@ class TestIamPermissionsServiceAttachmentRequest extends \Google\Protobuf\Intern * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * The name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.TestPermissionsRequest test_permissions_request_resource = 439214758 [(.google.api.field_behavior) = REQUIRED]; */ - private $test_permissions_request_resource = null; + protected $test_permissions_request_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/TestIamPermissionsSnapshotRequest.php b/Compute/src/V1/TestIamPermissionsSnapshotRequest.php index 105c0f4335f3..990c06c6c2ab 100644 --- a/Compute/src/V1/TestIamPermissionsSnapshotRequest.php +++ b/Compute/src/V1/TestIamPermissionsSnapshotRequest.php @@ -20,19 +20,19 @@ class TestIamPermissionsSnapshotRequest extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.TestPermissionsRequest test_permissions_request_resource = 439214758 [(.google.api.field_behavior) = REQUIRED]; */ - private $test_permissions_request_resource = null; + protected $test_permissions_request_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/TestIamPermissionsStoragePoolRequest.php b/Compute/src/V1/TestIamPermissionsStoragePoolRequest.php index 79f84de1e0c7..6c491694ea69 100644 --- a/Compute/src/V1/TestIamPermissionsStoragePoolRequest.php +++ b/Compute/src/V1/TestIamPermissionsStoragePoolRequest.php @@ -20,25 +20,25 @@ class TestIamPermissionsStoragePoolRequest extends \Google\Protobuf\Internal\Mes * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.TestPermissionsRequest test_permissions_request_resource = 439214758 [(.google.api.field_behavior) = REQUIRED]; */ - private $test_permissions_request_resource = null; + protected $test_permissions_request_resource = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/TestIamPermissionsSubnetworkRequest.php b/Compute/src/V1/TestIamPermissionsSubnetworkRequest.php index caf600dcb200..7a9d1ea613a8 100644 --- a/Compute/src/V1/TestIamPermissionsSubnetworkRequest.php +++ b/Compute/src/V1/TestIamPermissionsSubnetworkRequest.php @@ -20,25 +20,25 @@ class TestIamPermissionsSubnetworkRequest extends \Google\Protobuf\Internal\Mess * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * The name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.TestPermissionsRequest test_permissions_request_resource = 439214758 [(.google.api.field_behavior) = REQUIRED]; */ - private $test_permissions_request_resource = null; + protected $test_permissions_request_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/TestIamPermissionsVpnGatewayRequest.php b/Compute/src/V1/TestIamPermissionsVpnGatewayRequest.php index de6b4cf1ecfa..5e3d18c43f14 100644 --- a/Compute/src/V1/TestIamPermissionsVpnGatewayRequest.php +++ b/Compute/src/V1/TestIamPermissionsVpnGatewayRequest.php @@ -20,25 +20,25 @@ class TestIamPermissionsVpnGatewayRequest extends \Google\Protobuf\Internal\Mess * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * The name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * Name or id of the resource for this request. * * Generated from protobuf field string resource = 195806222 [(.google.api.field_behavior) = REQUIRED]; */ - private $resource = ''; + protected $resource = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.TestPermissionsRequest test_permissions_request_resource = 439214758 [(.google.api.field_behavior) = REQUIRED]; */ - private $test_permissions_request_resource = null; + protected $test_permissions_request_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/Uint128.php b/Compute/src/V1/Uint128.php index d8ce3896057d..32ad57cbfe66 100644 --- a/Compute/src/V1/Uint128.php +++ b/Compute/src/V1/Uint128.php @@ -17,11 +17,11 @@ class Uint128 extends \Google\Protobuf\Internal\Message /** * Generated from protobuf field optional uint64 high = 3202466; */ - private $high = null; + protected $high = null; /** * Generated from protobuf field optional uint64 low = 107348; */ - private $low = null; + protected $low = null; /** * Constructor. diff --git a/Compute/src/V1/UpcomingMaintenance.php b/Compute/src/V1/UpcomingMaintenance.php index a0b97a14f02e..e36e9899bf34 100644 --- a/Compute/src/V1/UpcomingMaintenance.php +++ b/Compute/src/V1/UpcomingMaintenance.php @@ -20,19 +20,19 @@ class UpcomingMaintenance extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional bool can_reschedule = 95981977; */ - private $can_reschedule = null; + protected $can_reschedule = null; /** * The latest time for the planned maintenance window to start. This timestamp value is in RFC3339 text format. * * Generated from protobuf field optional string latest_window_start_time = 128032129; */ - private $latest_window_start_time = null; + protected $latest_window_start_time = null; /** * Indicates whether the UpcomingMaintenance will be triggered on VM shutdown. * * Generated from protobuf field optional bool maintenance_on_shutdown = 231055754; */ - private $maintenance_on_shutdown = null; + protected $maintenance_on_shutdown = null; /** * The reasons for the maintenance. Only valid for vms. * Check the MaintenanceReasons enum for the list of possible values. @@ -46,26 +46,26 @@ class UpcomingMaintenance extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string maintenance_status = 81645214; */ - private $maintenance_status = null; + protected $maintenance_status = null; /** * Defines the type of maintenance. * Check the Type enum for the list of possible values. * * Generated from protobuf field optional string type = 3575610; */ - private $type = null; + protected $type = null; /** * The time by which the maintenance disruption will be completed. This timestamp value is in RFC3339 text format. * * Generated from protobuf field optional string window_end_time = 271816480; */ - private $window_end_time = null; + protected $window_end_time = null; /** * The current start time of the maintenance window. This timestamp value is in RFC3339 text format. * * Generated from protobuf field optional string window_start_time = 473061433; */ - private $window_start_time = null; + protected $window_start_time = null; /** * Constructor. diff --git a/Compute/src/V1/UpdateAccessConfigInstanceRequest.php b/Compute/src/V1/UpdateAccessConfigInstanceRequest.php index 456113dfe477..bd939c973d6d 100644 --- a/Compute/src/V1/UpdateAccessConfigInstanceRequest.php +++ b/Compute/src/V1/UpdateAccessConfigInstanceRequest.php @@ -20,37 +20,37 @@ class UpdateAccessConfigInstanceRequest extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field .google.cloud.compute.v1.AccessConfig access_config_resource = 387825552 [(.google.api.field_behavior) = REQUIRED]; */ - private $access_config_resource = null; + protected $access_config_resource = null; /** * The instance name for this request. * * Generated from protobuf field string instance = 18257045 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance = ''; + protected $instance = ''; /** * The name of the network interface where the access config is attached. * * Generated from protobuf field string network_interface = 365387880 [(.google.api.field_behavior) = REQUIRED]; */ - private $network_interface = ''; + protected $network_interface = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/UpdateAutoscalerRequest.php b/Compute/src/V1/UpdateAutoscalerRequest.php index 069b894bd5df..210313c03dee 100644 --- a/Compute/src/V1/UpdateAutoscalerRequest.php +++ b/Compute/src/V1/UpdateAutoscalerRequest.php @@ -20,31 +20,31 @@ class UpdateAutoscalerRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string autoscaler = 517258967; */ - private $autoscaler = null; + protected $autoscaler = null; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.Autoscaler autoscaler_resource = 207616118 [(.google.api.field_behavior) = REQUIRED]; */ - private $autoscaler_resource = null; + protected $autoscaler_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/UpdateBackendBucketRequest.php b/Compute/src/V1/UpdateBackendBucketRequest.php index a80fb7f85690..43b3854f2055 100644 --- a/Compute/src/V1/UpdateBackendBucketRequest.php +++ b/Compute/src/V1/UpdateBackendBucketRequest.php @@ -20,25 +20,25 @@ class UpdateBackendBucketRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string backend_bucket = 91714037 [(.google.api.field_behavior) = REQUIRED]; */ - private $backend_bucket = ''; + protected $backend_bucket = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.BackendBucket backend_bucket_resource = 380757784 [(.google.api.field_behavior) = REQUIRED]; */ - private $backend_bucket_resource = null; + protected $backend_bucket_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/UpdateBackendServiceRequest.php b/Compute/src/V1/UpdateBackendServiceRequest.php index 45f9b4150afe..9da260ec5e39 100644 --- a/Compute/src/V1/UpdateBackendServiceRequest.php +++ b/Compute/src/V1/UpdateBackendServiceRequest.php @@ -20,25 +20,25 @@ class UpdateBackendServiceRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string backend_service = 306946058 [(.google.api.field_behavior) = REQUIRED]; */ - private $backend_service = ''; + protected $backend_service = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.BackendService backend_service_resource = 347586723 [(.google.api.field_behavior) = REQUIRED]; */ - private $backend_service_resource = null; + protected $backend_service_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/UpdateDiskRequest.php b/Compute/src/V1/UpdateDiskRequest.php index 7fb70793935a..559b1a1d9744 100644 --- a/Compute/src/V1/UpdateDiskRequest.php +++ b/Compute/src/V1/UpdateDiskRequest.php @@ -20,41 +20,41 @@ class UpdateDiskRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string disk = 3083677 [(.google.api.field_behavior) = REQUIRED]; */ - private $disk = ''; + protected $disk = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.Disk disk_resource = 25880688 [(.google.api.field_behavior) = REQUIRED]; */ - private $disk_resource = null; + protected $disk_resource = null; /** * Generated from protobuf field optional string paths = 106438894; */ - private $paths = null; + protected $paths = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * update_mask indicates fields to be updated as part of this request. * * Generated from protobuf field optional string update_mask = 500079778; */ - private $update_mask = null; + protected $update_mask = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/UpdateDisplayDeviceInstanceRequest.php b/Compute/src/V1/UpdateDisplayDeviceInstanceRequest.php index c931ed8dfb50..bdd447d9d017 100644 --- a/Compute/src/V1/UpdateDisplayDeviceInstanceRequest.php +++ b/Compute/src/V1/UpdateDisplayDeviceInstanceRequest.php @@ -20,31 +20,31 @@ class UpdateDisplayDeviceInstanceRequest extends \Google\Protobuf\Internal\Messa * * Generated from protobuf field .google.cloud.compute.v1.DisplayDevice display_device_resource = 289686106 [(.google.api.field_behavior) = REQUIRED]; */ - private $display_device_resource = null; + protected $display_device_resource = null; /** * Name of the instance scoping this request. * * Generated from protobuf field string instance = 18257045 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance = ''; + protected $instance = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/UpdateFirewallRequest.php b/Compute/src/V1/UpdateFirewallRequest.php index ef25066f7bc2..56ec1a01c119 100644 --- a/Compute/src/V1/UpdateFirewallRequest.php +++ b/Compute/src/V1/UpdateFirewallRequest.php @@ -20,25 +20,25 @@ class UpdateFirewallRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string firewall = 511016192 [(.google.api.field_behavior) = REQUIRED]; */ - private $firewall = ''; + protected $firewall = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.Firewall firewall_resource = 41425005 [(.google.api.field_behavior) = REQUIRED]; */ - private $firewall_resource = null; + protected $firewall_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/UpdateHealthCheckRequest.php b/Compute/src/V1/UpdateHealthCheckRequest.php index 1c9b0dd37dee..0df7d03caeaa 100644 --- a/Compute/src/V1/UpdateHealthCheckRequest.php +++ b/Compute/src/V1/UpdateHealthCheckRequest.php @@ -20,25 +20,25 @@ class UpdateHealthCheckRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string health_check = 308876645 [(.google.api.field_behavior) = REQUIRED]; */ - private $health_check = ''; + protected $health_check = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.HealthCheck health_check_resource = 201925032 [(.google.api.field_behavior) = REQUIRED]; */ - private $health_check_resource = null; + protected $health_check_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/UpdateInstanceRequest.php b/Compute/src/V1/UpdateInstanceRequest.php index 67aa81b65542..221abb38998e 100644 --- a/Compute/src/V1/UpdateInstanceRequest.php +++ b/Compute/src/V1/UpdateInstanceRequest.php @@ -20,45 +20,45 @@ class UpdateInstanceRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string instance = 18257045 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance = ''; + protected $instance = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.Instance instance_resource = 215988344 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_resource = null; + protected $instance_resource = null; /** * Specifies the action to take when updating an instance even if the updated properties do not require it. If not specified, then Compute Engine acts based on the minimum action that the updated properties require. * Check the MinimalAction enum for the list of possible values. * * Generated from protobuf field optional string minimal_action = 270567060; */ - private $minimal_action = null; + protected $minimal_action = null; /** * Specifies the most disruptive action that can be taken on the instance as part of the update. Compute Engine returns an error if the instance properties require a more disruptive action as part of the instance update. Valid options from lowest to highest are NO_EFFECT, REFRESH, and RESTART. * Check the MostDisruptiveAllowedAction enum for the list of possible values. * * Generated from protobuf field optional string most_disruptive_allowed_action = 66103053; */ - private $most_disruptive_allowed_action = null; + protected $most_disruptive_allowed_action = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/UpdateLicenseRequest.php b/Compute/src/V1/UpdateLicenseRequest.php index 1fe666e4a0e8..5b3a82b8dcba 100644 --- a/Compute/src/V1/UpdateLicenseRequest.php +++ b/Compute/src/V1/UpdateLicenseRequest.php @@ -20,31 +20,31 @@ class UpdateLicenseRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string license = 166757441 [(.google.api.field_behavior) = REQUIRED]; */ - private $license = ''; + protected $license = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.License license_resource = 437955148 [(.google.api.field_behavior) = REQUIRED]; */ - private $license_resource = null; + protected $license_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * update_mask indicates fields to be updated as part of this request. * * Generated from protobuf field optional string update_mask = 500079778; */ - private $update_mask = null; + protected $update_mask = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/UpdateNetworkInterfaceInstanceRequest.php b/Compute/src/V1/UpdateNetworkInterfaceInstanceRequest.php index c5cc729637c2..8273eb8168e7 100644 --- a/Compute/src/V1/UpdateNetworkInterfaceInstanceRequest.php +++ b/Compute/src/V1/UpdateNetworkInterfaceInstanceRequest.php @@ -20,37 +20,37 @@ class UpdateNetworkInterfaceInstanceRequest extends \Google\Protobuf\Internal\Me * * Generated from protobuf field string instance = 18257045 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance = ''; + protected $instance = ''; /** * The name of the network interface to update. * * Generated from protobuf field string network_interface = 365387880 [(.google.api.field_behavior) = REQUIRED]; */ - private $network_interface = ''; + protected $network_interface = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.NetworkInterface network_interface_resource = 325814789 [(.google.api.field_behavior) = REQUIRED]; */ - private $network_interface_resource = null; + protected $network_interface_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/UpdatePeeringNetworkRequest.php b/Compute/src/V1/UpdatePeeringNetworkRequest.php index a8e05125619b..9e620c392d0d 100644 --- a/Compute/src/V1/UpdatePeeringNetworkRequest.php +++ b/Compute/src/V1/UpdatePeeringNetworkRequest.php @@ -20,25 +20,25 @@ class UpdatePeeringNetworkRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string network = 232872494 [(.google.api.field_behavior) = REQUIRED]; */ - private $network = ''; + protected $network = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.NetworksUpdatePeeringRequest networks_update_peering_request_resource = 224433497 [(.google.api.field_behavior) = REQUIRED]; */ - private $networks_update_peering_request_resource = null; + protected $networks_update_peering_request_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/UpdatePerInstanceConfigsInstanceGroupManagerRequest.php b/Compute/src/V1/UpdatePerInstanceConfigsInstanceGroupManagerRequest.php index f9be98fe0fd4..4f7848426f2f 100644 --- a/Compute/src/V1/UpdatePerInstanceConfigsInstanceGroupManagerRequest.php +++ b/Compute/src/V1/UpdatePerInstanceConfigsInstanceGroupManagerRequest.php @@ -20,31 +20,31 @@ class UpdatePerInstanceConfigsInstanceGroupManagerRequest extends \Google\Protob * * Generated from protobuf field string instance_group_manager = 249363395 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group_manager = ''; + protected $instance_group_manager = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.InstanceGroupManagersUpdatePerInstanceConfigsReq instance_group_managers_update_per_instance_configs_req_resource = 141402302 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group_managers_update_per_instance_configs_req_resource = null; + protected $instance_group_managers_update_per_instance_configs_req_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The name of the zone where the managed instance group is located. It should conform to RFC1035. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/UpdatePerInstanceConfigsRegionInstanceGroupManagerRequest.php b/Compute/src/V1/UpdatePerInstanceConfigsRegionInstanceGroupManagerRequest.php index cd3b1c3038e4..eaf2d9607f06 100644 --- a/Compute/src/V1/UpdatePerInstanceConfigsRegionInstanceGroupManagerRequest.php +++ b/Compute/src/V1/UpdatePerInstanceConfigsRegionInstanceGroupManagerRequest.php @@ -20,31 +20,31 @@ class UpdatePerInstanceConfigsRegionInstanceGroupManagerRequest extends \Google\ * * Generated from protobuf field string instance_group_manager = 249363395 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance_group_manager = ''; + protected $instance_group_manager = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request, should conform to RFC1035. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.RegionInstanceGroupManagerUpdateInstanceConfigReq region_instance_group_manager_update_instance_config_req_resource = 89036583 [(.google.api.field_behavior) = REQUIRED]; */ - private $region_instance_group_manager_update_instance_config_req_resource = null; + protected $region_instance_group_manager_update_instance_config_req_resource = null; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/UpdateRegionAutoscalerRequest.php b/Compute/src/V1/UpdateRegionAutoscalerRequest.php index 7886c9d9cdf3..a63ada6268f7 100644 --- a/Compute/src/V1/UpdateRegionAutoscalerRequest.php +++ b/Compute/src/V1/UpdateRegionAutoscalerRequest.php @@ -20,31 +20,31 @@ class UpdateRegionAutoscalerRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string autoscaler = 517258967; */ - private $autoscaler = null; + protected $autoscaler = null; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.Autoscaler autoscaler_resource = 207616118 [(.google.api.field_behavior) = REQUIRED]; */ - private $autoscaler_resource = null; + protected $autoscaler_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/UpdateRegionBackendServiceRequest.php b/Compute/src/V1/UpdateRegionBackendServiceRequest.php index cd4f2e69e4d3..e413b486a975 100644 --- a/Compute/src/V1/UpdateRegionBackendServiceRequest.php +++ b/Compute/src/V1/UpdateRegionBackendServiceRequest.php @@ -20,31 +20,31 @@ class UpdateRegionBackendServiceRequest extends \Google\Protobuf\Internal\Messag * * Generated from protobuf field string backend_service = 306946058 [(.google.api.field_behavior) = REQUIRED]; */ - private $backend_service = ''; + protected $backend_service = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.BackendService backend_service_resource = 347586723 [(.google.api.field_behavior) = REQUIRED]; */ - private $backend_service_resource = null; + protected $backend_service_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/UpdateRegionCommitmentRequest.php b/Compute/src/V1/UpdateRegionCommitmentRequest.php index cd1ae0e7a3a6..9c7e6de62603 100644 --- a/Compute/src/V1/UpdateRegionCommitmentRequest.php +++ b/Compute/src/V1/UpdateRegionCommitmentRequest.php @@ -20,41 +20,41 @@ class UpdateRegionCommitmentRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string commitment = 482134805 [(.google.api.field_behavior) = REQUIRED]; */ - private $commitment = ''; + protected $commitment = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.Commitment commitment_resource = 244240888 [(.google.api.field_behavior) = REQUIRED]; */ - private $commitment_resource = null; + protected $commitment_resource = null; /** * Generated from protobuf field optional string paths = 106438894; */ - private $paths = null; + protected $paths = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * update_mask indicates fields to be updated as part of this request. * * Generated from protobuf field optional string update_mask = 500079778; */ - private $update_mask = null; + protected $update_mask = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/UpdateRegionDiskRequest.php b/Compute/src/V1/UpdateRegionDiskRequest.php index 6660cfd2ce81..4a4267737b3e 100644 --- a/Compute/src/V1/UpdateRegionDiskRequest.php +++ b/Compute/src/V1/UpdateRegionDiskRequest.php @@ -20,41 +20,41 @@ class UpdateRegionDiskRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string disk = 3083677 [(.google.api.field_behavior) = REQUIRED]; */ - private $disk = ''; + protected $disk = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.Disk disk_resource = 25880688 [(.google.api.field_behavior) = REQUIRED]; */ - private $disk_resource = null; + protected $disk_resource = null; /** * Generated from protobuf field optional string paths = 106438894; */ - private $paths = null; + protected $paths = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * The name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * update_mask indicates fields to be updated as part of this request. * * Generated from protobuf field optional string update_mask = 500079778; */ - private $update_mask = null; + protected $update_mask = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/UpdateRegionHealthCheckRequest.php b/Compute/src/V1/UpdateRegionHealthCheckRequest.php index 2a5ff51a005c..50ff5ffec812 100644 --- a/Compute/src/V1/UpdateRegionHealthCheckRequest.php +++ b/Compute/src/V1/UpdateRegionHealthCheckRequest.php @@ -20,31 +20,31 @@ class UpdateRegionHealthCheckRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string health_check = 308876645 [(.google.api.field_behavior) = REQUIRED]; */ - private $health_check = ''; + protected $health_check = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.HealthCheck health_check_resource = 201925032 [(.google.api.field_behavior) = REQUIRED]; */ - private $health_check_resource = null; + protected $health_check_resource = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/UpdateRegionUrlMapRequest.php b/Compute/src/V1/UpdateRegionUrlMapRequest.php index f04d6790c876..e367a4ce5d48 100644 --- a/Compute/src/V1/UpdateRegionUrlMapRequest.php +++ b/Compute/src/V1/UpdateRegionUrlMapRequest.php @@ -20,31 +20,31 @@ class UpdateRegionUrlMapRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * begin_interface: MixerMutationRequestBuilder Request ID to support idempotency. * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name of the UrlMap resource to update. * * Generated from protobuf field string url_map = 367020684 [(.google.api.field_behavior) = REQUIRED]; */ - private $url_map = ''; + protected $url_map = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.UrlMap url_map_resource = 168675425 [(.google.api.field_behavior) = REQUIRED]; */ - private $url_map_resource = null; + protected $url_map_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/UpdateReservationRequest.php b/Compute/src/V1/UpdateReservationRequest.php index d738ec3fb587..0d606047795f 100644 --- a/Compute/src/V1/UpdateReservationRequest.php +++ b/Compute/src/V1/UpdateReservationRequest.php @@ -18,43 +18,43 @@ class UpdateReservationRequest extends \Google\Protobuf\Internal\Message /** * Generated from protobuf field optional string paths = 106438894; */ - private $paths = null; + protected $paths = null; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name of the reservation to update. * * Generated from protobuf field string reservation = 47530956 [(.google.api.field_behavior) = REQUIRED]; */ - private $reservation = ''; + protected $reservation = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.Reservation reservation_resource = 285030177 [(.google.api.field_behavior) = REQUIRED]; */ - private $reservation_resource = null; + protected $reservation_resource = null; /** * Update_mask indicates fields to be updated as part of this request. * * Generated from protobuf field optional string update_mask = 500079778; */ - private $update_mask = null; + protected $update_mask = null; /** * Name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/UpdateRoutePolicyRouterRequest.php b/Compute/src/V1/UpdateRoutePolicyRouterRequest.php index 282e99083282..e880d85d35f9 100644 --- a/Compute/src/V1/UpdateRoutePolicyRouterRequest.php +++ b/Compute/src/V1/UpdateRoutePolicyRouterRequest.php @@ -20,31 +20,31 @@ class UpdateRoutePolicyRouterRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.RoutePolicy route_policy_resource = 116219525 [(.google.api.field_behavior) = REQUIRED]; */ - private $route_policy_resource = null; + protected $route_policy_resource = null; /** * Name of the Router resource where Route Policy is defined. * * Generated from protobuf field string router = 148608841 [(.google.api.field_behavior) = REQUIRED]; */ - private $router = ''; + protected $router = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/UpdateRouterRequest.php b/Compute/src/V1/UpdateRouterRequest.php index 4b623f66dfa2..2675e01fc44a 100644 --- a/Compute/src/V1/UpdateRouterRequest.php +++ b/Compute/src/V1/UpdateRouterRequest.php @@ -20,31 +20,31 @@ class UpdateRouterRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * Name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name of the Router resource to update. * * Generated from protobuf field string router = 148608841 [(.google.api.field_behavior) = REQUIRED]; */ - private $router = ''; + protected $router = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.Router router_resource = 155222084 [(.google.api.field_behavior) = REQUIRED]; */ - private $router_resource = null; + protected $router_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/UpdateShieldedInstanceConfigInstanceRequest.php b/Compute/src/V1/UpdateShieldedInstanceConfigInstanceRequest.php index b9e4f5ba2566..40b38a738d44 100644 --- a/Compute/src/V1/UpdateShieldedInstanceConfigInstanceRequest.php +++ b/Compute/src/V1/UpdateShieldedInstanceConfigInstanceRequest.php @@ -20,31 +20,31 @@ class UpdateShieldedInstanceConfigInstanceRequest extends \Google\Protobuf\Inter * * Generated from protobuf field string instance = 18257045 [(.google.api.field_behavior) = REQUIRED]; */ - private $instance = ''; + protected $instance = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.ShieldedInstanceConfig shielded_instance_config_resource = 272059224 [(.google.api.field_behavior) = REQUIRED]; */ - private $shielded_instance_config_resource = null; + protected $shielded_instance_config_resource = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/UpdateStoragePoolRequest.php b/Compute/src/V1/UpdateStoragePoolRequest.php index 4344b8699d73..344bfb7966f7 100644 --- a/Compute/src/V1/UpdateStoragePoolRequest.php +++ b/Compute/src/V1/UpdateStoragePoolRequest.php @@ -20,37 +20,37 @@ class UpdateStoragePoolRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * The storagePool name for this request. * * Generated from protobuf field string storage_pool = 360473440 [(.google.api.field_behavior) = REQUIRED]; */ - private $storage_pool = ''; + protected $storage_pool = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.StoragePool storage_pool_resource = 157179405 [(.google.api.field_behavior) = REQUIRED]; */ - private $storage_pool_resource = null; + protected $storage_pool_resource = null; /** * update_mask indicates fields to be updated as part of this request. * * Generated from protobuf field optional string update_mask = 500079778; */ - private $update_mask = null; + protected $update_mask = null; /** * The name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "zone"]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/UpdateUrlMapRequest.php b/Compute/src/V1/UpdateUrlMapRequest.php index 011d5ae93b38..3ad6e740758f 100644 --- a/Compute/src/V1/UpdateUrlMapRequest.php +++ b/Compute/src/V1/UpdateUrlMapRequest.php @@ -20,25 +20,25 @@ class UpdateUrlMapRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * Name of the UrlMap resource to update. * * Generated from protobuf field string url_map = 367020684 [(.google.api.field_behavior) = REQUIRED]; */ - private $url_map = ''; + protected $url_map = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.UrlMap url_map_resource = 168675425 [(.google.api.field_behavior) = REQUIRED]; */ - private $url_map_resource = null; + protected $url_map_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/UrlMap.php b/Compute/src/V1/UrlMap.php index e37585267efc..b2e808b07a12 100644 --- a/Compute/src/V1/UrlMap.php +++ b/Compute/src/V1/UrlMap.php @@ -9,7 +9,7 @@ use Google\Protobuf\Internal\GPBUtil; /** - * Represents a URL Map resource. Compute Engine has two URL Map resources: * [Global](/compute/docs/reference/rest/v1/urlMaps) * [Regional](https://cloud.google.com/compute/docs/reference/rest/v1/regionUrlMaps) A URL map resource is a component of certain types of cloud load balancers and Traffic Director: * urlMaps are used by global external Application Load Balancers, classic Application Load Balancers, and cross-region internal Application Load Balancers. * regionUrlMaps are used by internal Application Load Balancers, regional external Application Load Balancers and regional internal Application Load Balancers. For a list of supported URL map features by the load balancer type, see the Load balancing features: Routing and traffic management table. For a list of supported URL map features for Traffic Director, see the Traffic Director features: Routing and traffic management table. This resource defines mappings from hostnames and URL paths to either a backend service or a backend bucket. To use the global urlMaps resource, the backend service must have a loadBalancingScheme of either EXTERNAL, EXTERNAL_MANAGED, or INTERNAL_SELF_MANAGED. To use the regionUrlMaps resource, the backend service must have a loadBalancingScheme of INTERNAL_MANAGED. For more information, read URL Map Concepts. + * Represents a URL Map resource. Compute Engine has two URL Map resources: * [Global](/compute/docs/reference/rest/v1/urlMaps) * [Regional](/compute/docs/reference/rest/v1/regionUrlMaps) A URL map resource is a component of certain types of cloud load balancers and Traffic Director: * urlMaps are used by global external Application Load Balancers, classic Application Load Balancers, and cross-region internal Application Load Balancers. * regionUrlMaps are used by internal Application Load Balancers, regional external Application Load Balancers and regional internal Application Load Balancers. For a list of supported URL map features by the load balancer type, see the Load balancing features: Routing and traffic management table. For a list of supported URL map features for Traffic Director, see the Traffic Director features: Routing and traffic management table. This resource defines mappings from hostnames and URL paths to either a backend service or a backend bucket. To use the global urlMaps resource, the backend service must have a loadBalancingScheme of either EXTERNAL, EXTERNAL_MANAGED, or INTERNAL_SELF_MANAGED. To use the regionUrlMaps resource, the backend service must have a loadBalancingScheme of INTERNAL_MANAGED. For more information, read URL Map Concepts. * * Generated from protobuf message google.cloud.compute.v1.UrlMap */ @@ -20,49 +20,49 @@ class UrlMap extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * defaultCustomErrorResponsePolicy specifies how the Load Balancer returns error responses when BackendServiceor BackendBucket responds with an error. This policy takes effect at the load balancer level and applies only when no policy has been defined for the error code at lower levels like PathMatcher, RouteRule and PathRule within this UrlMap. For example, consider a UrlMap with the following configuration: - defaultCustomErrorResponsePolicy containing policies for responding to 5xx and 4xx errors - A PathMatcher configured for *.example.com has defaultCustomErrorResponsePolicy for 4xx. If a request for http://www.example.com/ encounters a 404, the policy in pathMatcher.defaultCustomErrorResponsePolicy will be enforced. When the request for http://www.example.com/ encounters a 502, the policy in UrlMap.defaultCustomErrorResponsePolicy will be enforced. When a request that does not match any host in *.example.com such as http://www.myotherexample.com/, encounters a 404, UrlMap.defaultCustomErrorResponsePolicy takes effect. When used in conjunction with defaultRouteAction.retryPolicy, retries take precedence. Only once all retries are exhausted, the defaultCustomErrorResponsePolicy is applied. While attempting a retry, if load balancer is successful in reaching the service, the defaultCustomErrorResponsePolicy is ignored and the response from the service is returned to the client. defaultCustomErrorResponsePolicy is supported only for global external Application Load Balancers. * * Generated from protobuf field optional .google.cloud.compute.v1.CustomErrorResponsePolicy default_custom_error_response_policy = 81266089; */ - private $default_custom_error_response_policy = null; + protected $default_custom_error_response_policy = null; /** * defaultRouteAction takes effect when none of the hostRules match. The load balancer performs advanced routing actions, such as URL rewrites and header transformations, before forwarding the request to the selected backend. Only one of defaultUrlRedirect, defaultService or defaultRouteAction.weightedBackendService can be set. URL maps for classic Application Load Balancers only support the urlRewrite action within defaultRouteAction. defaultRouteAction has no effect when the URL map is bound to a target gRPC proxy that has the validateForProxyless field set to true. * * Generated from protobuf field optional .google.cloud.compute.v1.HttpRouteAction default_route_action = 378919466; */ - private $default_route_action = null; + protected $default_route_action = null; /** * The full or partial URL of the defaultService resource to which traffic is directed if none of the hostRules match. If defaultRouteAction is also specified, advanced routing actions, such as URL rewrites, take effect before sending the request to the backend. Only one of defaultUrlRedirect, defaultService or defaultRouteAction.weightedBackendService can be set. defaultService has no effect when the URL map is bound to a target gRPC proxy that has the validateForProxyless field set to true. * * Generated from protobuf field optional string default_service = 370242231; */ - private $default_service = null; + protected $default_service = null; /** * When none of the specified hostRules match, the request is redirected to a URL specified by defaultUrlRedirect. Only one of defaultUrlRedirect, defaultService or defaultRouteAction.weightedBackendService can be set. Not supported when the URL map is bound to a target gRPC proxy. * * Generated from protobuf field optional .google.cloud.compute.v1.HttpRedirectAction default_url_redirect = 359503338; */ - private $default_url_redirect = null; + protected $default_url_redirect = null; /** * An optional description of this resource. Provide this property when you create the resource. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * Fingerprint of this resource. A hash of the contents stored in this object. This field is used in optimistic locking. This field is ignored when inserting a UrlMap. An up-to-date fingerprint must be provided in order to update the UrlMap, otherwise the request will fail with error 412 conditionNotMet. To see the latest fingerprint, make a get() request to retrieve a UrlMap. * * Generated from protobuf field optional string fingerprint = 234678500; */ - private $fingerprint = null; + protected $fingerprint = null; /** * Specifies changes to request and response headers that need to take effect for the selected backendService. The headerAction specified here take effect after headerAction specified under pathMatcher. headerAction is not supported for load balancers that have their loadBalancingScheme set to EXTERNAL. Not supported when the URL map is bound to a target gRPC proxy that has validateForProxyless field set to true. * * Generated from protobuf field optional .google.cloud.compute.v1.HttpHeaderAction header_action = 328077352; */ - private $header_action = null; + protected $header_action = null; /** * The list of host rules to use against the URL. * @@ -74,19 +74,19 @@ class UrlMap extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * [Output Only] Type of the resource. Always compute#urlMaps for url maps. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * The list of named PathMatchers to use against the URL. * @@ -98,13 +98,13 @@ class UrlMap extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string region = 138946292; */ - private $region = null; + protected $region = null; /** * [Output Only] Server-defined URL for the resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * The list of expected URL mapping tests. Request to update the UrlMap succeeds only if all test cases pass. You can specify a maximum of 100 tests per UrlMap. Not supported when the URL map is bound to a target gRPC proxy that has validateForProxyless field set to true. * diff --git a/Compute/src/V1/UrlMapList.php b/Compute/src/V1/UrlMapList.php index 53a8aa8adadc..d764594c42b1 100644 --- a/Compute/src/V1/UrlMapList.php +++ b/Compute/src/V1/UrlMapList.php @@ -20,7 +20,7 @@ class UrlMapList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of UrlMap resources. * @@ -32,25 +32,25 @@ class UrlMapList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/UrlMapReference.php b/Compute/src/V1/UrlMapReference.php index baee26707890..e0701c8d77d6 100644 --- a/Compute/src/V1/UrlMapReference.php +++ b/Compute/src/V1/UrlMapReference.php @@ -17,7 +17,7 @@ class UrlMapReference extends \Google\Protobuf\Internal\Message /** * Generated from protobuf field optional string url_map = 367020684; */ - private $url_map = null; + protected $url_map = null; /** * Constructor. diff --git a/Compute/src/V1/UrlMapTest.php b/Compute/src/V1/UrlMapTest.php index 07046a1e37e6..32ea3d397393 100644 --- a/Compute/src/V1/UrlMapTest.php +++ b/Compute/src/V1/UrlMapTest.php @@ -20,19 +20,19 @@ class UrlMapTest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * The expected output URL evaluated by the load balancer containing the scheme, host, path and query parameters. For rules that forward requests to backends, the test passes only when expectedOutputUrl matches the request forwarded by the load balancer to backends. For rules with urlRewrite, the test verifies that the forwarded request matches hostRewrite and pathPrefixRewrite in the urlRewrite action. When service is specified, expectedOutputUrl`s scheme is ignored. For rules with urlRedirect, the test passes only if expectedOutputUrl matches the URL in the load balancer's redirect response. If urlRedirect specifies https_redirect, the test passes only if the scheme in expectedOutputUrl is also set to HTTPS. If urlRedirect specifies strip_query, the test passes only if expectedOutputUrl does not contain any query parameters. expectedOutputUrl is optional when service is specified. * * Generated from protobuf field optional string expected_output_url = 433967384; */ - private $expected_output_url = null; + protected $expected_output_url = null; /** * For rules with urlRedirect, the test passes only if expectedRedirectResponseCode matches the HTTP status code in load balancer's redirect response. expectedRedirectResponseCode cannot be set when service is set. * * Generated from protobuf field optional int32 expected_redirect_response_code = 18888047; */ - private $expected_redirect_response_code = null; + protected $expected_redirect_response_code = null; /** * HTTP headers for this request. If headers contains a host header, then host must also match the header value. * @@ -44,19 +44,19 @@ class UrlMapTest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string host = 3208616; */ - private $host = null; + protected $host = null; /** * Path portion of the URL. * * Generated from protobuf field optional string path = 3433509; */ - private $path = null; + protected $path = null; /** * Expected BackendService or BackendBucket resource the given URL should be mapped to. The service field cannot be set if expectedRedirectResponseCode is set. * * Generated from protobuf field optional string service = 373540533; */ - private $service = null; + protected $service = null; /** * Constructor. diff --git a/Compute/src/V1/UrlMapTestHeader.php b/Compute/src/V1/UrlMapTestHeader.php index dcd50e821bfc..9d8cf2bc069f 100644 --- a/Compute/src/V1/UrlMapTestHeader.php +++ b/Compute/src/V1/UrlMapTestHeader.php @@ -20,13 +20,13 @@ class UrlMapTestHeader extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * Header value. * * Generated from protobuf field optional string value = 111972721; */ - private $value = null; + protected $value = null; /** * Constructor. diff --git a/Compute/src/V1/UrlMapValidationResult.php b/Compute/src/V1/UrlMapValidationResult.php index 066ca59d7796..4fda4934aaff 100644 --- a/Compute/src/V1/UrlMapValidationResult.php +++ b/Compute/src/V1/UrlMapValidationResult.php @@ -24,7 +24,7 @@ class UrlMapValidationResult extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional bool load_succeeded = 128326216; */ - private $load_succeeded = null; + protected $load_succeeded = null; /** * Generated from protobuf field repeated .google.cloud.compute.v1.TestFailure test_failures = 505934134; */ @@ -34,7 +34,7 @@ class UrlMapValidationResult extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional bool test_passed = 192708797; */ - private $test_passed = null; + protected $test_passed = null; /** * Constructor. diff --git a/Compute/src/V1/UrlMapsAggregatedList.php b/Compute/src/V1/UrlMapsAggregatedList.php index 120e8e4995df..f0e4a1880b16 100644 --- a/Compute/src/V1/UrlMapsAggregatedList.php +++ b/Compute/src/V1/UrlMapsAggregatedList.php @@ -19,7 +19,7 @@ class UrlMapsAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of UrlMapsScopedList resources. * @@ -31,19 +31,19 @@ class UrlMapsAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Unreachable resources. * @@ -55,7 +55,7 @@ class UrlMapsAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/UrlMapsClient.php b/Compute/src/V1/UrlMapsClient.php deleted file mode 100644 index 7a07935eb2ef..000000000000 --- a/Compute/src/V1/UrlMapsClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/UrlMapsValidateRequest.php b/Compute/src/V1/UrlMapsValidateRequest.php index 5dba527f3017..14a78719a69a 100644 --- a/Compute/src/V1/UrlMapsValidateRequest.php +++ b/Compute/src/V1/UrlMapsValidateRequest.php @@ -26,7 +26,7 @@ class UrlMapsValidateRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.UrlMap resource = 195806222; */ - private $resource = null; + protected $resource = null; /** * Constructor. diff --git a/Compute/src/V1/UrlMapsValidateResponse.php b/Compute/src/V1/UrlMapsValidateResponse.php index 2b416ae0d1b4..9c963924f032 100644 --- a/Compute/src/V1/UrlMapsValidateResponse.php +++ b/Compute/src/V1/UrlMapsValidateResponse.php @@ -17,7 +17,7 @@ class UrlMapsValidateResponse extends \Google\Protobuf\Internal\Message /** * Generated from protobuf field optional .google.cloud.compute.v1.UrlMapValidationResult result = 139315229; */ - private $result = null; + protected $result = null; /** * Constructor. diff --git a/Compute/src/V1/UrlRewrite.php b/Compute/src/V1/UrlRewrite.php index a8e7ae2055f0..cc6e0ee5f4c0 100644 --- a/Compute/src/V1/UrlRewrite.php +++ b/Compute/src/V1/UrlRewrite.php @@ -20,19 +20,19 @@ class UrlRewrite extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string host_rewrite = 159819253; */ - private $host_rewrite = null; + protected $host_rewrite = null; /** * Before forwarding the request to the selected backend service, the matching portion of the request's path is replaced by pathPrefixRewrite. The value must be from 1 to 1024 characters. * * Generated from protobuf field optional string path_prefix_rewrite = 41186361; */ - private $path_prefix_rewrite = null; + protected $path_prefix_rewrite = null; /** * If specified, the pattern rewrites the URL path (based on the :path header) using the HTTP template syntax. A corresponding path_template_match must be specified. Any template variables must exist in the path_template_match field. - -At least one variable must be specified in the path_template_match field - You can omit variables from the rewritten URL - The * and ** operators cannot be matched unless they have a corresponding variable name - e.g. {format=*} or {var=**}. For example, a path_template_match of /static/{format=**} could be rewritten as /static/content/{format} to prefix /content to the URL. Variables can also be re-ordered in a rewrite, so that /{country}/{format}/{suffix=**} can be rewritten as /content/{format}/{country}/{suffix}. At least one non-empty routeRules[].matchRules[].path_template_match is required. Only one of path_prefix_rewrite or path_template_rewrite may be specified. * * Generated from protobuf field optional string path_template_rewrite = 423409569; */ - private $path_template_rewrite = null; + protected $path_template_rewrite = null; /** * Constructor. diff --git a/Compute/src/V1/UsableSubnetwork.php b/Compute/src/V1/UsableSubnetwork.php index 6f309b445d7f..b391db81e31d 100644 --- a/Compute/src/V1/UsableSubnetwork.php +++ b/Compute/src/V1/UsableSubnetwork.php @@ -20,46 +20,46 @@ class UsableSubnetwork extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string external_ipv6_prefix = 139299190; */ - private $external_ipv6_prefix = null; + protected $external_ipv6_prefix = null; /** * [Output Only] The internal IPv6 address range that is assigned to this subnetwork. * * Generated from protobuf field optional string internal_ipv6_prefix = 506270056; */ - private $internal_ipv6_prefix = null; + protected $internal_ipv6_prefix = null; /** * The range of internal addresses that are owned by this subnetwork. * * Generated from protobuf field optional string ip_cidr_range = 98117322; */ - private $ip_cidr_range = null; + protected $ip_cidr_range = null; /** * The access type of IPv6 address this subnet holds. It's immutable and can only be specified during creation or the first time the subnet is updated into IPV4_IPV6 dual stack. * Check the Ipv6AccessType enum for the list of possible values. * * Generated from protobuf field optional string ipv6_access_type = 504658653; */ - private $ipv6_access_type = null; + protected $ipv6_access_type = null; /** * Network URL. * * Generated from protobuf field optional string network = 232872494; */ - private $network = null; + protected $network = null; /** * * Check the Purpose enum for the list of possible values. * * Generated from protobuf field optional string purpose = 316407070; */ - private $purpose = null; + protected $purpose = null; /** * The role of subnetwork. Currently, this field is only used when purpose is set to GLOBAL_MANAGED_PROXY or REGIONAL_MANAGED_PROXY. The value can be set to ACTIVE or BACKUP. An ACTIVE subnetwork is one that is currently being used for Envoy-based load balancers in a region. A BACKUP subnetwork is one that is ready to be promoted to ACTIVE or is currently draining. This field can be updated with a patch request. * Check the Role enum for the list of possible values. * * Generated from protobuf field optional string role = 3506294; */ - private $role = null; + protected $role = null; /** * Secondary IP ranges. * @@ -72,13 +72,13 @@ class UsableSubnetwork extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string stack_type = 425908881; */ - private $stack_type = null; + protected $stack_type = null; /** * Subnetwork URL. * * Generated from protobuf field optional string subnetwork = 307827694; */ - private $subnetwork = null; + protected $subnetwork = null; /** * Constructor. diff --git a/Compute/src/V1/UsableSubnetworkSecondaryRange.php b/Compute/src/V1/UsableSubnetworkSecondaryRange.php index 7d47ce4ba4d6..c39bbac9b2d5 100644 --- a/Compute/src/V1/UsableSubnetworkSecondaryRange.php +++ b/Compute/src/V1/UsableSubnetworkSecondaryRange.php @@ -20,13 +20,13 @@ class UsableSubnetworkSecondaryRange extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string ip_cidr_range = 98117322; */ - private $ip_cidr_range = null; + protected $ip_cidr_range = null; /** * The name associated with this subnetwork secondary range, used when adding an alias IP range to a VM instance. The name must be 1-63 characters long, and comply with RFC1035. The name must be unique within the subnetwork. * * Generated from protobuf field optional string range_name = 332216397; */ - private $range_name = null; + protected $range_name = null; /** * Constructor. diff --git a/Compute/src/V1/UsableSubnetworksAggregatedList.php b/Compute/src/V1/UsableSubnetworksAggregatedList.php index af05048c26a5..733ce4b703d1 100644 --- a/Compute/src/V1/UsableSubnetworksAggregatedList.php +++ b/Compute/src/V1/UsableSubnetworksAggregatedList.php @@ -19,7 +19,7 @@ class UsableSubnetworksAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * [Output] A list of usable subnetwork URLs. * @@ -31,13 +31,13 @@ class UsableSubnetworksAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. In special cases listUsable may return 0 subnetworks and nextPageToken which still should be used to get the next page of results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Informational warning messages for failures encountered from scopes. * @@ -49,7 +49,7 @@ class UsableSubnetworksAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Unreachable resources. * @@ -61,7 +61,7 @@ class UsableSubnetworksAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/UsageExportLocation.php b/Compute/src/V1/UsageExportLocation.php index aecd591235ea..063bc5e2dc0b 100644 --- a/Compute/src/V1/UsageExportLocation.php +++ b/Compute/src/V1/UsageExportLocation.php @@ -20,13 +20,13 @@ class UsageExportLocation extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string bucket_name = 283610048; */ - private $bucket_name = null; + protected $bucket_name = null; /** * An optional prefix for the name of the usage report object stored in bucketName. If not supplied, defaults to usage_gce. The report is stored as a CSV file named report_name_prefix_gce_YYYYMMDD.csv where YYYYMMDD is the day of the usage according to Pacific Time. If you supply a prefix, it should conform to Cloud Storage object naming conventions. * * Generated from protobuf field optional string report_name_prefix = 320198715; */ - private $report_name_prefix = null; + protected $report_name_prefix = null; /** * Constructor. diff --git a/Compute/src/V1/ValidateRegionUrlMapRequest.php b/Compute/src/V1/ValidateRegionUrlMapRequest.php index 150a52a9dd78..4d46b7b19db7 100644 --- a/Compute/src/V1/ValidateRegionUrlMapRequest.php +++ b/Compute/src/V1/ValidateRegionUrlMapRequest.php @@ -20,25 +20,25 @@ class ValidateRegionUrlMapRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region scoping this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.RegionUrlMapsValidateRequest region_url_maps_validate_request_resource = 56632858 [(.google.api.field_behavior) = REQUIRED]; */ - private $region_url_maps_validate_request_resource = null; + protected $region_url_maps_validate_request_resource = null; /** * Name of the UrlMap resource to be validated as. * * Generated from protobuf field string url_map = 367020684 [(.google.api.field_behavior) = REQUIRED]; */ - private $url_map = ''; + protected $url_map = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/ValidateUrlMapRequest.php b/Compute/src/V1/ValidateUrlMapRequest.php index 4dd32b753805..616049e90364 100644 --- a/Compute/src/V1/ValidateUrlMapRequest.php +++ b/Compute/src/V1/ValidateUrlMapRequest.php @@ -20,19 +20,19 @@ class ValidateUrlMapRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the UrlMap resource to be validated as. * * Generated from protobuf field string url_map = 367020684 [(.google.api.field_behavior) = REQUIRED]; */ - private $url_map = ''; + protected $url_map = ''; /** * The body resource for this request * * Generated from protobuf field .google.cloud.compute.v1.UrlMapsValidateRequest url_maps_validate_request_resource = 395913455 [(.google.api.field_behavior) = REQUIRED]; */ - private $url_maps_validate_request_resource = null; + protected $url_maps_validate_request_resource = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/VmEndpointNatMappings.php b/Compute/src/V1/VmEndpointNatMappings.php index c7f5db0b6d42..ffa533b3368f 100644 --- a/Compute/src/V1/VmEndpointNatMappings.php +++ b/Compute/src/V1/VmEndpointNatMappings.php @@ -20,7 +20,7 @@ class VmEndpointNatMappings extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string instance_name = 227947509; */ - private $instance_name = null; + protected $instance_name = null; /** * Generated from protobuf field repeated .google.cloud.compute.v1.VmEndpointNatMappingsInterfaceNatMappings interface_nat_mappings = 256196617; */ diff --git a/Compute/src/V1/VmEndpointNatMappingsInterfaceNatMappings.php b/Compute/src/V1/VmEndpointNatMappingsInterfaceNatMappings.php index 0d91383e1198..5f3539e10a13 100644 --- a/Compute/src/V1/VmEndpointNatMappingsInterfaceNatMappings.php +++ b/Compute/src/V1/VmEndpointNatMappingsInterfaceNatMappings.php @@ -32,13 +32,13 @@ class VmEndpointNatMappingsInterfaceNatMappings extends \Google\Protobuf\Interna * * Generated from protobuf field optional int32 num_total_drain_nat_ports = 335532793; */ - private $num_total_drain_nat_ports = null; + protected $num_total_drain_nat_ports = null; /** * Total number of ports across all NAT IPs allocated to this interface. It equals to the aggregated port number in the field nat_ip_port_ranges. * * Generated from protobuf field optional int32 num_total_nat_ports = 299904384; */ - private $num_total_nat_ports = null; + protected $num_total_nat_ports = null; /** * Information about mappings provided by rules in this NAT. * @@ -50,13 +50,13 @@ class VmEndpointNatMappingsInterfaceNatMappings extends \Google\Protobuf\Interna * * Generated from protobuf field optional string source_alias_ip_range = 440340952; */ - private $source_alias_ip_range = null; + protected $source_alias_ip_range = null; /** * Primary IP of the VM for this NIC. * * Generated from protobuf field optional string source_virtual_ip = 149836159; */ - private $source_virtual_ip = null; + protected $source_virtual_ip = null; /** * Constructor. diff --git a/Compute/src/V1/VmEndpointNatMappingsInterfaceNatMappingsNatRuleMappings.php b/Compute/src/V1/VmEndpointNatMappingsInterfaceNatMappingsNatRuleMappings.php index aa1d26da7772..a476d240816d 100644 --- a/Compute/src/V1/VmEndpointNatMappingsInterfaceNatMappingsNatRuleMappings.php +++ b/Compute/src/V1/VmEndpointNatMappingsInterfaceNatMappingsNatRuleMappings.php @@ -32,19 +32,19 @@ class VmEndpointNatMappingsInterfaceNatMappingsNatRuleMappings extends \Google\P * * Generated from protobuf field optional int32 num_total_drain_nat_ports = 335532793; */ - private $num_total_drain_nat_ports = null; + protected $num_total_drain_nat_ports = null; /** * Total number of ports across all NAT IPs allocated to this interface by this rule. It equals the aggregated port number in the field nat_ip_port_ranges. * * Generated from protobuf field optional int32 num_total_nat_ports = 299904384; */ - private $num_total_nat_ports = null; + protected $num_total_nat_ports = null; /** * Rule number of the NAT Rule. * * Generated from protobuf field optional int32 rule_number = 535211500; */ - private $rule_number = null; + protected $rule_number = null; /** * Constructor. diff --git a/Compute/src/V1/VmEndpointNatMappingsList.php b/Compute/src/V1/VmEndpointNatMappingsList.php index 5808c96206da..408901e98ba1 100644 --- a/Compute/src/V1/VmEndpointNatMappingsList.php +++ b/Compute/src/V1/VmEndpointNatMappingsList.php @@ -20,19 +20,19 @@ class VmEndpointNatMappingsList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * [Output Only] Type of resource. Always compute#vmEndpointNatMappingsList for lists of Nat mappings of VM endpoints. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] A list of Nat mapping information of VM endpoints. * @@ -44,13 +44,13 @@ class VmEndpointNatMappingsList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/VpnGateway.php b/Compute/src/V1/VpnGateway.php index a708dff9b772..293a5a2297df 100644 --- a/Compute/src/V1/VpnGateway.php +++ b/Compute/src/V1/VpnGateway.php @@ -20,38 +20,38 @@ class VpnGateway extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * An optional description of this resource. Provide this property when you create the resource. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * The IP family of the gateway IPs for the HA-VPN gateway interfaces. If not specified, IPV4 will be used. * Check the GatewayIpVersion enum for the list of possible values. * * Generated from protobuf field optional string gateway_ip_version = 65074843; */ - private $gateway_ip_version = null; + protected $gateway_ip_version = null; /** * [Output Only] The unique identifier for the resource. This identifier is defined by the server. * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * [Output Only] Type of resource. Always compute#vpnGateway for VPN gateways. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * A fingerprint for the labels being applied to this VpnGateway, which is essentially a hash of the labels set used for optimistic locking. The fingerprint is initially generated by Compute Engine and changes after every request to modify or update labels. You must always provide an up-to-date fingerprint hash in order to update or change labels, otherwise the request will fail with error 412 conditionNotMet. To see the latest fingerprint, make a get() request to retrieve a VpnGateway. * * Generated from protobuf field optional string label_fingerprint = 178124825; */ - private $label_fingerprint = null; + protected $label_fingerprint = null; /** * Labels for this resource. These can only be added or modified by the setLabels method. Each label key/value pair must comply with RFC1035. Label values may be empty. * @@ -63,32 +63,32 @@ class VpnGateway extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * URL of the network to which this VPN gateway is attached. Provided by the client when the VPN gateway is created. * * Generated from protobuf field optional string network = 232872494; */ - private $network = null; + protected $network = null; /** * [Output Only] URL of the region where the VPN gateway resides. * * Generated from protobuf field optional string region = 138946292; */ - private $region = null; + protected $region = null; /** * [Output Only] Server-defined URL for the resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * The stack type for this VPN gateway to identify the IP protocols that are enabled. Possible values are: IPV4_ONLY, IPV4_IPV6, IPV6_ONLY. If not specified, IPV4_ONLY is used if the gateway IP version is IPV4, or IPV4_IPV6 if the gateway IP version is IPV6. * Check the StackType enum for the list of possible values. * * Generated from protobuf field optional string stack_type = 425908881; */ - private $stack_type = null; + protected $stack_type = null; /** * The list of VPN interfaces associated with this VPN gateway. * diff --git a/Compute/src/V1/VpnGatewayAggregatedList.php b/Compute/src/V1/VpnGatewayAggregatedList.php index f8877e29e7d7..48ab61859ccd 100644 --- a/Compute/src/V1/VpnGatewayAggregatedList.php +++ b/Compute/src/V1/VpnGatewayAggregatedList.php @@ -19,7 +19,7 @@ class VpnGatewayAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of VpnGateway resources. * @@ -31,19 +31,19 @@ class VpnGatewayAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Unreachable resources. * @@ -55,7 +55,7 @@ class VpnGatewayAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/VpnGatewayList.php b/Compute/src/V1/VpnGatewayList.php index 83a230699565..e8f3c09a57f8 100644 --- a/Compute/src/V1/VpnGatewayList.php +++ b/Compute/src/V1/VpnGatewayList.php @@ -20,7 +20,7 @@ class VpnGatewayList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of VpnGateway resources. * @@ -32,25 +32,25 @@ class VpnGatewayList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/VpnGatewayStatusHighAvailabilityRequirementState.php b/Compute/src/V1/VpnGatewayStatusHighAvailabilityRequirementState.php index 22c7452e09cb..fd2c5c8dab40 100644 --- a/Compute/src/V1/VpnGatewayStatusHighAvailabilityRequirementState.php +++ b/Compute/src/V1/VpnGatewayStatusHighAvailabilityRequirementState.php @@ -21,14 +21,14 @@ class VpnGatewayStatusHighAvailabilityRequirementState extends \Google\Protobuf\ * * Generated from protobuf field optional string state = 109757585; */ - private $state = null; + protected $state = null; /** * Indicates the reason why the VPN connection does not meet the high availability redundancy criteria/requirement. Valid values is INCOMPLETE_TUNNELS_COVERAGE. * Check the UnsatisfiedReason enum for the list of possible values. * * Generated from protobuf field optional string unsatisfied_reason = 55016330; */ - private $unsatisfied_reason = null; + protected $unsatisfied_reason = null; /** * Constructor. diff --git a/Compute/src/V1/VpnGatewayStatusTunnel.php b/Compute/src/V1/VpnGatewayStatusTunnel.php index 3d6d745e31d6..e595e651818a 100644 --- a/Compute/src/V1/VpnGatewayStatusTunnel.php +++ b/Compute/src/V1/VpnGatewayStatusTunnel.php @@ -20,19 +20,19 @@ class VpnGatewayStatusTunnel extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional uint32 local_gateway_interface = 158764330; */ - private $local_gateway_interface = null; + protected $local_gateway_interface = null; /** * The peer gateway interface this VPN tunnel is connected to, the peer gateway could either be an external VPN gateway or a Google Cloud VPN gateway. * * Generated from protobuf field optional uint32 peer_gateway_interface = 214380385; */ - private $peer_gateway_interface = null; + protected $peer_gateway_interface = null; /** * URL reference to the VPN tunnel. * * Generated from protobuf field optional string tunnel_url = 78975256; */ - private $tunnel_url = null; + protected $tunnel_url = null; /** * Constructor. diff --git a/Compute/src/V1/VpnGatewayStatusVpnConnection.php b/Compute/src/V1/VpnGatewayStatusVpnConnection.php index 8c06c41d34b9..f44ae0e51774 100644 --- a/Compute/src/V1/VpnGatewayStatusVpnConnection.php +++ b/Compute/src/V1/VpnGatewayStatusVpnConnection.php @@ -20,19 +20,19 @@ class VpnGatewayStatusVpnConnection extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string peer_external_gateway = 384956173; */ - private $peer_external_gateway = null; + protected $peer_external_gateway = null; /** * URL reference to the peer side VPN gateways to which the VPN tunnels in this VPN connection are connected. This field is mutually exclusive with peer_gcp_gateway. * * Generated from protobuf field optional string peer_gcp_gateway = 281867452; */ - private $peer_gcp_gateway = null; + protected $peer_gcp_gateway = null; /** * HighAvailabilityRequirementState for the VPN connection. * * Generated from protobuf field optional .google.cloud.compute.v1.VpnGatewayStatusHighAvailabilityRequirementState state = 109757585; */ - private $state = null; + protected $state = null; /** * List of VPN tunnels that are in this VPN connection. * diff --git a/Compute/src/V1/VpnGatewayVpnGatewayInterface.php b/Compute/src/V1/VpnGatewayVpnGatewayInterface.php index 9995fb21582b..8e8c3d89a3e8 100644 --- a/Compute/src/V1/VpnGatewayVpnGatewayInterface.php +++ b/Compute/src/V1/VpnGatewayVpnGatewayInterface.php @@ -20,25 +20,25 @@ class VpnGatewayVpnGatewayInterface extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional uint32 id = 3355; */ - private $id = null; + protected $id = null; /** * URL of the VLAN attachment (interconnectAttachment) resource for this VPN gateway interface. When the value of this field is present, the VPN gateway is used for HA VPN over Cloud Interconnect; all egress or ingress traffic for this VPN gateway interface goes through the specified VLAN attachment resource. * * Generated from protobuf field optional string interconnect_attachment = 308135284; */ - private $interconnect_attachment = null; + protected $interconnect_attachment = null; /** * [Output Only] IP address for this VPN interface associated with the VPN gateway. The IP address could be either a regional external IP address or a regional internal IP address. The two IP addresses for a VPN gateway must be all regional external or regional internal IP addresses. There cannot be a mix of regional external IP addresses and regional internal IP addresses. For HA VPN over Cloud Interconnect, the IP addresses for both interfaces could either be regional internal IP addresses or regional external IP addresses. For regular (non HA VPN over Cloud Interconnect) HA VPN tunnels, the IP address must be a regional external IP address. * * Generated from protobuf field optional string ip_address = 406272220; */ - private $ip_address = null; + protected $ip_address = null; /** * [Output Only] IPv6 address for this VPN interface associated with the VPN gateway. The IPv6 address must be a regional external IPv6 address. The format is RFC 5952 format (e.g. 2001:db8::2d9:51:0:0). * * Generated from protobuf field optional string ipv6_address = 341563804; */ - private $ipv6_address = null; + protected $ipv6_address = null; /** * Constructor. diff --git a/Compute/src/V1/VpnGatewaysClient.php b/Compute/src/V1/VpnGatewaysClient.php deleted file mode 100644 index bc1cf3188962..000000000000 --- a/Compute/src/V1/VpnGatewaysClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional .google.cloud.compute.v1.VpnGatewayStatus result = 139315229; */ - private $result = null; + protected $result = null; /** * Constructor. diff --git a/Compute/src/V1/VpnGatewaysScopedList.php b/Compute/src/V1/VpnGatewaysScopedList.php index 85c3f05baf81..73f7dd6427c1 100644 --- a/Compute/src/V1/VpnGatewaysScopedList.php +++ b/Compute/src/V1/VpnGatewaysScopedList.php @@ -25,7 +25,7 @@ class VpnGatewaysScopedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/VpnTunnel.php b/Compute/src/V1/VpnTunnel.php index c22c7d03dd64..a0562b754ee7 100644 --- a/Compute/src/V1/VpnTunnel.php +++ b/Compute/src/V1/VpnTunnel.php @@ -20,43 +20,43 @@ class VpnTunnel extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * An optional description of this resource. Provide this property when you create the resource. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * [Output Only] Detailed status message for the VPN tunnel. * * Generated from protobuf field optional string detailed_status = 333501025; */ - private $detailed_status = null; + protected $detailed_status = null; /** * [Output Only] The unique identifier for the resource. This identifier is defined by the server. * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * IKE protocol version to use when establishing the VPN tunnel with the peer VPN gateway. Acceptable IKE versions are 1 or 2. The default version is 2. * * Generated from protobuf field optional int32 ike_version = 218376220; */ - private $ike_version = null; + protected $ike_version = null; /** * [Output Only] Type of resource. Always compute#vpnTunnel for VPN tunnels. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * A fingerprint for the labels being applied to this VpnTunnel, which is essentially a hash of the labels set used for optimistic locking. The fingerprint is initially generated by Compute Engine and changes after every request to modify or update labels. You must always provide an up-to-date fingerprint hash in order to update or change labels, otherwise the request will fail with error 412 conditionNotMet. To see the latest fingerprint, make a get() request to retrieve a VpnTunnel. * * Generated from protobuf field optional string label_fingerprint = 178124825; */ - private $label_fingerprint = null; + protected $label_fingerprint = null; /** * Labels for this resource. These can only be added or modified by the setLabels method. Each label key/value pair must comply with RFC1035. Label values may be empty. * @@ -74,37 +74,37 @@ class VpnTunnel extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * URL of the peer side external VPN gateway to which this VPN tunnel is connected. Provided by the client when the VPN tunnel is created. This field is exclusive with the field peerGcpGateway. * * Generated from protobuf field optional string peer_external_gateway = 384956173; */ - private $peer_external_gateway = null; + protected $peer_external_gateway = null; /** * The interface ID of the external VPN gateway to which this VPN tunnel is connected. Provided by the client when the VPN tunnel is created. Possible values are: `0`, `1`, `2`, `3`. The number of IDs in use depends on the external VPN gateway redundancy type. * * Generated from protobuf field optional int32 peer_external_gateway_interface = 452768391; */ - private $peer_external_gateway_interface = null; + protected $peer_external_gateway_interface = null; /** * URL of the peer side HA VPN gateway to which this VPN tunnel is connected. Provided by the client when the VPN tunnel is created. This field can be used when creating highly available VPN from VPC network to VPC network, the field is exclusive with the field peerExternalGateway. If provided, the VPN tunnel will automatically use the same vpnGatewayInterface ID in the peer Google Cloud VPN gateway. * * Generated from protobuf field optional string peer_gcp_gateway = 281867452; */ - private $peer_gcp_gateway = null; + protected $peer_gcp_gateway = null; /** * IP address of the peer VPN gateway. Only IPv4 is supported. This field can be set only for Classic VPN tunnels. * * Generated from protobuf field optional string peer_ip = 383249700; */ - private $peer_ip = null; + protected $peer_ip = null; /** * [Output Only] URL of the region where the VPN tunnel resides. You must specify this field as part of the HTTP request URL. It is not settable as a field in the request body. * * Generated from protobuf field optional string region = 138946292; */ - private $region = null; + protected $region = null; /** * Remote traffic selectors to use when establishing the VPN tunnel with the peer VPN gateway. The value should be a CIDR formatted string, for example: 192.168.0.0/16. The ranges should be disjoint. Only IPv4 is supported for Classic VPN tunnels. This field is output only for HA VPN tunnels. * @@ -116,50 +116,50 @@ class VpnTunnel extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string router = 148608841; */ - private $router = null; + protected $router = null; /** * [Output Only] Server-defined URL for the resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * Shared secret used to set the secure session between the Cloud VPN gateway and the peer VPN gateway. * * Generated from protobuf field optional string shared_secret = 381932490; */ - private $shared_secret = null; + protected $shared_secret = null; /** * Hash of the shared secret. * * Generated from protobuf field optional string shared_secret_hash = 398881891; */ - private $shared_secret_hash = null; + protected $shared_secret_hash = null; /** * [Output Only] The status of the VPN tunnel, which can be one of the following: - PROVISIONING: Resource is being allocated for the VPN tunnel. - WAITING_FOR_FULL_CONFIG: Waiting to receive all VPN-related configs from the user. Network, TargetVpnGateway, VpnTunnel, ForwardingRule, and Route resources are needed to setup the VPN tunnel. - FIRST_HANDSHAKE: Successful first handshake with the peer VPN. - ESTABLISHED: Secure session is successfully established with the peer VPN. - NETWORK_ERROR: Deprecated, replaced by NO_INCOMING_PACKETS - AUTHORIZATION_ERROR: Auth error (for example, bad shared secret). - NEGOTIATION_FAILURE: Handshake failed. - DEPROVISIONING: Resources are being deallocated for the VPN tunnel. - FAILED: Tunnel creation has failed and the tunnel is not ready to be used. - NO_INCOMING_PACKETS: No incoming packets from peer. - REJECTED: Tunnel configuration was rejected, can be result of being denied access. - ALLOCATING_RESOURCES: Cloud VPN is in the process of allocating all required resources. - STOPPED: Tunnel is stopped due to its Forwarding Rules being deleted for Classic VPN tunnels or the project is in frozen state. - PEER_IDENTITY_MISMATCH: Peer identity does not match peer IP, probably behind NAT. - TS_NARROWING_NOT_ALLOWED: Traffic selector narrowing not allowed for an HA-VPN tunnel. * Check the Status enum for the list of possible values. * * Generated from protobuf field optional string status = 181260274; */ - private $status = null; + protected $status = null; /** * URL of the Target VPN gateway with which this VPN tunnel is associated. Provided by the client when the VPN tunnel is created. This field can be set only for Classic VPN tunnels. * * Generated from protobuf field optional string target_vpn_gateway = 532512843; */ - private $target_vpn_gateway = null; + protected $target_vpn_gateway = null; /** * URL of the VPN gateway with which this VPN tunnel is associated. Provided by the client when the VPN tunnel is created. This must be used (instead of target_vpn_gateway) if a High Availability VPN gateway resource is created. * * Generated from protobuf field optional string vpn_gateway = 406684153; */ - private $vpn_gateway = null; + protected $vpn_gateway = null; /** * The interface ID of the VPN gateway with which this VPN tunnel is associated. Possible values are: `0`, `1`. * * Generated from protobuf field optional int32 vpn_gateway_interface = 95979123; */ - private $vpn_gateway_interface = null; + protected $vpn_gateway_interface = null; /** * Constructor. diff --git a/Compute/src/V1/VpnTunnelAggregatedList.php b/Compute/src/V1/VpnTunnelAggregatedList.php index cce913d353b2..d7621fbfabf3 100644 --- a/Compute/src/V1/VpnTunnelAggregatedList.php +++ b/Compute/src/V1/VpnTunnelAggregatedList.php @@ -19,7 +19,7 @@ class VpnTunnelAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of VpnTunnelsScopedList resources. * @@ -31,19 +31,19 @@ class VpnTunnelAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Unreachable resources. * @@ -55,7 +55,7 @@ class VpnTunnelAggregatedList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/VpnTunnelList.php b/Compute/src/V1/VpnTunnelList.php index bdefa3dca07b..1ed0b01deeb7 100644 --- a/Compute/src/V1/VpnTunnelList.php +++ b/Compute/src/V1/VpnTunnelList.php @@ -20,7 +20,7 @@ class VpnTunnelList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of VpnTunnel resources. * @@ -32,25 +32,25 @@ class VpnTunnelList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/VpnTunnelsClient.php b/Compute/src/V1/VpnTunnelsClient.php deleted file mode 100644 index 2df8b7eedac1..000000000000 --- a/Compute/src/V1/VpnTunnelsClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/WafExpressionSet.php b/Compute/src/V1/WafExpressionSet.php index 0aecd37a5f7f..877303386e84 100644 --- a/Compute/src/V1/WafExpressionSet.php +++ b/Compute/src/V1/WafExpressionSet.php @@ -31,7 +31,7 @@ class WafExpressionSet extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * Constructor. diff --git a/Compute/src/V1/WafExpressionSetExpression.php b/Compute/src/V1/WafExpressionSetExpression.php index 74b9240b29c2..d0fe342d00eb 100644 --- a/Compute/src/V1/WafExpressionSetExpression.php +++ b/Compute/src/V1/WafExpressionSetExpression.php @@ -19,13 +19,13 @@ class WafExpressionSetExpression extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * The sensitivity value associated with the WAF rule ID. This corresponds to the ModSecurity paranoia level, ranging from 1 to 4. 0 is reserved for opt-in only rules. * * Generated from protobuf field optional int32 sensitivity = 27532959; */ - private $sensitivity = null; + protected $sensitivity = null; /** * Constructor. diff --git a/Compute/src/V1/WaitGlobalOperationRequest.php b/Compute/src/V1/WaitGlobalOperationRequest.php index 95107919ebfa..37b5652b88e6 100644 --- a/Compute/src/V1/WaitGlobalOperationRequest.php +++ b/Compute/src/V1/WaitGlobalOperationRequest.php @@ -20,13 +20,13 @@ class WaitGlobalOperationRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string operation = 52090215 [(.google.api.field_behavior) = REQUIRED]; */ - private $operation = ''; + protected $operation = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/WaitRegionOperationRequest.php b/Compute/src/V1/WaitRegionOperationRequest.php index 86b96744ccba..65f6bda9e111 100644 --- a/Compute/src/V1/WaitRegionOperationRequest.php +++ b/Compute/src/V1/WaitRegionOperationRequest.php @@ -20,19 +20,19 @@ class WaitRegionOperationRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string operation = 52090215 [(.google.api.field_behavior) = REQUIRED]; */ - private $operation = ''; + protected $operation = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the region for this request. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED]; */ - private $region = ''; + protected $region = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/WaitZoneOperationRequest.php b/Compute/src/V1/WaitZoneOperationRequest.php index 6a2f59746466..338ec4c5312c 100644 --- a/Compute/src/V1/WaitZoneOperationRequest.php +++ b/Compute/src/V1/WaitZoneOperationRequest.php @@ -20,19 +20,19 @@ class WaitZoneOperationRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field string operation = 52090215 [(.google.api.field_behavior) = REQUIRED]; */ - private $operation = ''; + protected $operation = ''; /** * Project ID for this request. * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED]; */ - private $project = ''; + protected $project = ''; /** * Name of the zone for this request. * * Generated from protobuf field string zone = 3744684 [(.google.api.field_behavior) = REQUIRED]; */ - private $zone = ''; + protected $zone = ''; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/Warning.php b/Compute/src/V1/Warning.php index 4cef2c449e7f..b272184e022d 100644 --- a/Compute/src/V1/Warning.php +++ b/Compute/src/V1/Warning.php @@ -21,7 +21,7 @@ class Warning extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string code = 3059181; */ - private $code = null; + protected $code = null; /** * [Output Only] Metadata about this warning in key: value format. For example: "data": [ { "key": "scope", "value": "zones/us-east1-d" } * @@ -33,7 +33,7 @@ class Warning extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string message = 418054151; */ - private $message = null; + protected $message = null; /** * Constructor. diff --git a/Compute/src/V1/Warnings.php b/Compute/src/V1/Warnings.php index bdece26e8895..09c309f0e52f 100644 --- a/Compute/src/V1/Warnings.php +++ b/Compute/src/V1/Warnings.php @@ -20,7 +20,7 @@ class Warnings extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string code = 3059181; */ - private $code = null; + protected $code = null; /** * [Output Only] Metadata about this warning in key: value format. For example: "data": [ { "key": "scope", "value": "zones/us-east1-d" } * @@ -32,7 +32,7 @@ class Warnings extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string message = 418054151; */ - private $message = null; + protected $message = null; /** * Constructor. diff --git a/Compute/src/V1/WeightedBackendService.php b/Compute/src/V1/WeightedBackendService.php index 377b8102f991..94cb56256ff7 100644 --- a/Compute/src/V1/WeightedBackendService.php +++ b/Compute/src/V1/WeightedBackendService.php @@ -20,19 +20,19 @@ class WeightedBackendService extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string backend_service = 306946058; */ - private $backend_service = null; + protected $backend_service = null; /** * Specifies changes to request and response headers that need to take effect for the selected backendService. headerAction specified here take effect before headerAction in the enclosing HttpRouteRule, PathMatcher and UrlMap. headerAction is not supported for load balancers that have their loadBalancingScheme set to EXTERNAL. Not supported when the URL map is bound to a target gRPC proxy that has validateForProxyless field set to true. * * Generated from protobuf field optional .google.cloud.compute.v1.HttpHeaderAction header_action = 328077352; */ - private $header_action = null; + protected $header_action = null; /** * Specifies the fraction of traffic sent to a backend service, computed as weight / (sum of all weightedBackendService weights in routeAction) . The selection of a backend service is determined only for new traffic. Once a user's request has been directed to a backend service, subsequent requests are sent to the same backend service as determined by the backend service's session affinity policy. Don't configure session affinity if you're using weighted traffic splitting. If you do, the weighted traffic splitting configuration takes precedence. The value must be from 0 to 1000. * * Generated from protobuf field optional uint32 weight = 282149496; */ - private $weight = null; + protected $weight = null; /** * Constructor. diff --git a/Compute/src/V1/WithdrawPublicAdvertisedPrefixeRequest.php b/Compute/src/V1/WithdrawPublicAdvertisedPrefixeRequest.php index 5a3e7b66ed7c..dac4a8d5701b 100644 --- a/Compute/src/V1/WithdrawPublicAdvertisedPrefixeRequest.php +++ b/Compute/src/V1/WithdrawPublicAdvertisedPrefixeRequest.php @@ -20,19 +20,19 @@ class WithdrawPublicAdvertisedPrefixeRequest extends \Google\Protobuf\Internal\M * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * The name of the public advertised prefix. It should comply with RFC1035. * * Generated from protobuf field string public_advertised_prefix = 101874590 [(.google.api.field_behavior) = REQUIRED]; */ - private $public_advertised_prefix = ''; + protected $public_advertised_prefix = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/WithdrawPublicDelegatedPrefixeRequest.php b/Compute/src/V1/WithdrawPublicDelegatedPrefixeRequest.php index dec2abd0a609..5d0a726412fb 100644 --- a/Compute/src/V1/WithdrawPublicDelegatedPrefixeRequest.php +++ b/Compute/src/V1/WithdrawPublicDelegatedPrefixeRequest.php @@ -20,25 +20,25 @@ class WithdrawPublicDelegatedPrefixeRequest extends \Google\Protobuf\Internal\Me * * Generated from protobuf field string project = 227560217 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "project"]; */ - private $project = ''; + protected $project = ''; /** * The name of the public delegated prefix. It should comply with RFC1035. * * Generated from protobuf field string public_delegated_prefix = 204238440 [(.google.api.field_behavior) = REQUIRED]; */ - private $public_delegated_prefix = ''; + protected $public_delegated_prefix = ''; /** * The name of the region where the public delegated prefix is located. It should comply with RFC1035. * * Generated from protobuf field string region = 138946292 [(.google.api.field_behavior) = REQUIRED, (.google.cloud.operation_request_field) = "region"]; */ - private $region = ''; + protected $region = ''; /** * 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. 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). * * Generated from protobuf field optional string request_id = 37109963; */ - private $request_id = null; + protected $request_id = null; /** * @param string $project Project ID for this request. diff --git a/Compute/src/V1/XpnHostList.php b/Compute/src/V1/XpnHostList.php index 82492cca5565..816740c08dcb 100644 --- a/Compute/src/V1/XpnHostList.php +++ b/Compute/src/V1/XpnHostList.php @@ -19,7 +19,7 @@ class XpnHostList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * [Output Only] A list of shared VPC host project URLs. * @@ -31,25 +31,25 @@ class XpnHostList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/XpnResourceId.php b/Compute/src/V1/XpnResourceId.php index 61a8b66b58e9..638f0d858964 100644 --- a/Compute/src/V1/XpnResourceId.php +++ b/Compute/src/V1/XpnResourceId.php @@ -20,14 +20,14 @@ class XpnResourceId extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * The type of the service resource. * Check the Type enum for the list of possible values. * * Generated from protobuf field optional string type = 3575610; */ - private $type = null; + protected $type = null; /** * Constructor. diff --git a/Compute/src/V1/Zone.php b/Compute/src/V1/Zone.php index 50344d8f043f..21d3b92d004a 100644 --- a/Compute/src/V1/Zone.php +++ b/Compute/src/V1/Zone.php @@ -26,62 +26,62 @@ class Zone extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string creation_timestamp = 30525366; */ - private $creation_timestamp = null; + protected $creation_timestamp = null; /** * [Output Only] The deprecation status associated with this zone. * * Generated from protobuf field optional .google.cloud.compute.v1.DeprecationStatus deprecated = 515138995; */ - private $deprecated = null; + protected $deprecated = null; /** * [Output Only] Textual description of the resource. * * Generated from protobuf field optional string description = 422937596; */ - private $description = null; + protected $description = null; /** * [Output Only] The unique identifier for the resource. This identifier is defined by the server. * * Generated from protobuf field optional uint64 id = 3355; */ - private $id = null; + protected $id = null; /** * [Output Only] Type of the resource. Always compute#zone for zones. * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] Name of the resource. * * Generated from protobuf field optional string name = 3373707; */ - private $name = null; + protected $name = null; /** * [Output Only] Full URL reference to the region which hosts the zone. * * Generated from protobuf field optional string region = 138946292; */ - private $region = null; + protected $region = null; /** * [Output Only] Server-defined URL for the resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Status of the zone, either UP or DOWN. * Check the Status enum for the list of possible values. * * Generated from protobuf field optional string status = 181260274; */ - private $status = null; + protected $status = null; /** * [Output Only] Reserved for future use. * * Generated from protobuf field optional bool supports_pzs = 83983214; */ - private $supports_pzs = null; + protected $supports_pzs = null; /** * Constructor. diff --git a/Compute/src/V1/ZoneList.php b/Compute/src/V1/ZoneList.php index 6236e9c408e1..3e7eef263caa 100644 --- a/Compute/src/V1/ZoneList.php +++ b/Compute/src/V1/ZoneList.php @@ -20,7 +20,7 @@ class ZoneList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string id = 3355; */ - private $id = null; + protected $id = null; /** * A list of Zone resources. * @@ -32,25 +32,25 @@ class ZoneList extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string kind = 3292052; */ - private $kind = null; + protected $kind = null; /** * [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. * * Generated from protobuf field optional string next_page_token = 79797525; */ - private $next_page_token = null; + protected $next_page_token = null; /** * [Output Only] Server-defined URL for this resource. * * Generated from protobuf field optional string self_link = 456214797; */ - private $self_link = null; + protected $self_link = null; /** * [Output Only] Informational warning message. * * Generated from protobuf field optional .google.cloud.compute.v1.Warning warning = 50704284; */ - private $warning = null; + protected $warning = null; /** * Constructor. diff --git a/Compute/src/V1/ZoneOperationsClient.php b/Compute/src/V1/ZoneOperationsClient.php deleted file mode 100644 index 9837e5c98bfb..000000000000 --- a/Compute/src/V1/ZoneOperationsClient.php +++ /dev/null @@ -1,34 +0,0 @@ -optional string label_fingerprint = 178124825; */ - private $label_fingerprint = null; + protected $label_fingerprint = null; /** * The labels to set for this resource. * diff --git a/Compute/src/V1/ZoneSetPolicyRequest.php b/Compute/src/V1/ZoneSetPolicyRequest.php index b9ca89bd5eef..722230f9c1a4 100644 --- a/Compute/src/V1/ZoneSetPolicyRequest.php +++ b/Compute/src/V1/ZoneSetPolicyRequest.php @@ -25,13 +25,13 @@ class ZoneSetPolicyRequest extends \Google\Protobuf\Internal\Message * * Generated from protobuf field optional string etag = 3123477; */ - private $etag = null; + protected $etag = null; /** * 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 in general a valid policy but certain services (like Projects) might reject them. * * Generated from protobuf field optional .google.cloud.compute.v1.Policy policy = 91071794; */ - private $policy = null; + protected $policy = null; /** * Constructor. diff --git a/Compute/src/V1/ZonesClient.php b/Compute/src/V1/ZonesClient.php deleted file mode 100644 index 1fde021b70a5..000000000000 --- a/Compute/src/V1/ZonesClient.php +++ /dev/null @@ -1,34 +0,0 @@ -close(); - } - - public function testInsert(): void - { - $addressResource = new Address(); - $addressResource->setName(self::$name); - $op = self::$addressesClient->insert($addressResource, self::$projectId, self::REGION); - $op->pollUntilComplete(); - $this->assertTrue($op->operationSucceeded(), - sprintf("Operation %s failed. Error: %s", $op->getName(), $op->getError()->getMessage())); - $address = self::$addressesClient->get(self::$name, self::$projectId, self::REGION); - $this->assertEquals($address->getName(), self::$name); - } - - /** - * @depends testInsert - */ - public function testList(): void - { - $presented = false; - $addressList = self::$addressesClient->list(self::$projectId, self::REGION); - foreach ($addressList->iterateAllElements() as $element) { - $name = $element->getName(); - if ($name == self::$name){ - $presented = true; - } - } - $this->assertEquals(true, $presented); - } - - /** - * @depends testInsert - */ - public function testDelete(): void - { - $op = self::$addressesClient->delete(self::$name, self::$projectId, self::REGION); - $op->pollUntilComplete(); - $this->assertTrue($op->operationSucceeded(), - sprintf("Operation %s failed. Error: %s", $op->getName(), $op->getError()->getMessage())); - try { - self::$addressesClient->get(self::$name, self::$projectId, self::REGION); - $this->fail('The deleted instance still exists'); - } catch (ApiException $e) { - $this->assertEquals(404, $e->getCode()); - } - } -} diff --git a/Compute/tests/System/V1/FirewallsTest.php b/Compute/tests/System/V1/FirewallsTest.php deleted file mode 100644 index ed35cbf2a72f..000000000000 --- a/Compute/tests/System/V1/FirewallsTest.php +++ /dev/null @@ -1,75 +0,0 @@ -close(); - } - - public function testCapitalLetter() - { - // we test a field like "I_p_protocol" - $allowed = [new Allowed([ - 'I_p_protocol' => 'tcp', - 'ports' => ['80'] - ])]; - $resource = new Firewall([ - 'name' => self::$name, - 'source_ranges' => ['0.0.0.0/0'], - 'allowed' => $allowed - ]); - $operation = self::$client->insert($resource, self::$projectId); - $operation->pollUntilComplete(); - try { - $firewall = self::$client->get(self::$name, self::$projectId); - $this->assertEquals($allowed, iterator_to_array($firewall->getAllowed()->getIterator())); - } finally { - self::$client->delete(self::$name, self::$projectId); - } - } -} diff --git a/Compute/tests/System/V1/PaginationTest.php b/Compute/tests/System/V1/PaginationTest.php deleted file mode 100644 index cc4e753d2319..000000000000 --- a/Compute/tests/System/V1/PaginationTest.php +++ /dev/null @@ -1,224 +0,0 @@ -aggregatedList(self::$projectId); - $page = $response->getPage(); - $allResults = self::getInstancesFromAggregatedPage($page); - if (count($allResults) < 4) { - self::fail('Atleast 4 instances are required for test run'); - } - } - /** - * @afterClass - */ - public static function tearDownTestFixtures(): void - { - self::$instancesClient->close(); - self::$zonesClient->close(); - self::$acceleratorTypesClient->close(); - } - - public function testPageToken() - { - $response = self::$zonesClient->list( - self::$projectId, - ['maxResults' => 5] - ); - $page = $response->getPage(); - $pageToken = $page->getNextPageToken(); - $nextPage = self::$zonesClient->list( - self::$projectId, - ['pageToken'=>$pageToken, 'maxResults' => 5] - )->getPage(); - $arrToken = iterator_to_array($nextPage->getIterator()); - $arr = iterator_to_array($page->getNextPage(5)->getIterator()); - self::assertEquals($arr, $arrToken); - } - - public function testNextPage() - { - $response = self::$zonesClient->list( - self::$projectId, - ['maxResults' => 1] - ); - $page = $response->getPage(); - $nextPage = $page->getNextPage(1); - $content = iterator_to_array($page->getIterator()); - $nextContent = iterator_to_array($nextPage->getIterator()); - self::assertCount(1, $content); - self::assertCount(1, $nextContent); - self::assertNotEquals($content[0]->getId(), $nextContent[0]->getid()); - } - - public function testNextPageSize() - { - $response = self::$zonesClient->list( - self::$projectId, - ['maxResults' => 5] - ); - $page = $response->getPage(); - $nextPage = $page->getNextPage(1); - $nextContent = iterator_to_array($nextPage->getIterator()); - self::assertCount(1, $nextContent); - } - - public function testMaxResults() - { - $response = self::$zonesClient->list( - self::$projectId, - ['maxResults' => 10] - ); - $page = $response->getPage(); - $arr = iterator_to_array($page->getIterator()); - self::assertCount(10, $arr); - } - - public function testAutoPaginationList() - { - $response = self::$acceleratorTypesClient->list( - self::$projectId, - self::$zone, - ['maxResults' => 2] - ); - $presented = false; - foreach ($response->iterateAllElements() as $element){ - if ($element->getName() == 'nvidia-tesla-t4'){ - $presented = true; - } - } - self::assertTrue($presented); - } - - public function testAutoPaginationMapResponse() - { - $response = self::$acceleratorTypesClient->aggregatedList( - self::$projectId, - ['maxResults' => 2] - ); - $presented = false; - foreach ($response->iterateAllElements() as $zone => $element){ - $types = $element->getAcceleratorTypes(); - foreach ($types as $type){ - if ($type->getName() == 'nvidia-tesla-t4'){ - $presented = true; - } - } - } - self::assertTrue($presented); - } - - public function testAggregatedPageToken() - { - $response = self::$instancesClient->aggregatedList( - self::$projectId, - ['maxResults' => 2] - ); - $page = $response->getPage(); - $pageToken = $page->getNextPageToken(); - $nextPage = self::$instancesClient->aggregatedList( - self::$projectId, - ['pageToken'=>$pageToken, 'maxResults' => 2] - )->getPage(); - $arrToken = iterator_to_array($nextPage->getIterator()); - $arr = iterator_to_array($page->getNextPage(2)->getIterator()); - self::assertEquals($arr, $arrToken); - } - - public function testAggregatedNextPage() - { - $response = self::$instancesClient->aggregatedList( - self::$projectId, - ['maxResults' => 1] - ); - $page = $response->getPage(); - $nextPage = $page->getNextPage(1); - $content = self::getInstancesFromAggregatedPage($page); - $nextContent = self::getInstancesFromAggregatedPage($nextPage); - - self::assertNotEquals( - current($content)->getId(), - current($nextContent)->getid() - ); - } - - public function testAggregatedNextPageSize() - { - $response = self::$instancesClient->aggregatedList( - self::$projectId, - ['maxResults' => 2] - ); - $page = $response->getPage(); - $nextPage = $page->getNextPage(2); - $nextContent = self::getInstancesFromAggregatedPage($nextPage); - self::assertCount(2, $nextContent); - } - - public function testAggregatedMaxResults() - { - $response = self::$instancesClient->aggregatedList( - self::$projectId, - ['maxResults' => 3] - ); - $page = $response->getPage(); - $allResults = self::getInstancesFromAggregatedPage($page); - self::assertCount(3, $allResults); - } - - private static function getInstancesFromAggregatedPage($page) - { - $results = []; - foreach ($page->getIterator() as $zone => $instancesList) { - $pageResults = iterator_to_array($instancesList->getInstances()); - $results = array_merge($results, $pageResults); - } - return $results; - } -} diff --git a/Compute/tests/System/V1/SmokeTest.php b/Compute/tests/System/V1/SmokeTest.php deleted file mode 100644 index b0e8380f6493..000000000000 --- a/Compute/tests/System/V1/SmokeTest.php +++ /dev/null @@ -1,297 +0,0 @@ -close(); - } - - public function testInsertInstance(): void - { - $disk = new AttachedDisk([ - 'boot' => true, - 'auto_delete' => true, - 'type' => AttachedDisk\Type::name(AttachedDisk\Type::PERSISTENT), - 'initialize_params' => new AttachedDiskInitializeParams([ - 'source_image' => self::IMAGE - ]), - ]); - $networkConfig = new NetworkInterface([]); - $instanceResource = new Instance([ - 'name' => self::$name, - 'description' => 'test', - 'machine_type' => self::$machineType, - 'network_interfaces' => [$networkConfig], - 'disks' => [$disk], - ]); - $operation = self::$instancesClient->insert( - $instanceResource, - self::$projectId, - self::ZONE - ); - $operation->pollUntilComplete(); - $this->assertTrue($operation->operationSucceeded(), - sprintf("Operation %s failed. Error: %s", $operation->getName(), $operation->getError()->getMessage())); - - $instance = self::$instancesClient->get( - self::$name, - self::$projectId, - self::ZONE - ); - $this->assertEquals(self::$name, $instance->getName()); - $this->assertEquals(self::$machineType, $instance->getMachineType()); - } - - /** - * @depends testInsertInstance - */ - public function testUpdateDescInstanceToEmpty() - { - $instance = self::$instancesClient->get( - self::$name, - self::$projectId, - self::ZONE - ); - $this->assertEquals('test', $instance->getDescription()); - $this->assertEquals('0', $instance->getScheduling()->getMinNodeCpus()); - $instance->setDescription(''); - $operation = self::$instancesClient->update(self::$name, $instance, self::$projectId, self::ZONE); - $operation->pollUntilComplete(); - $this->assertTrue($operation->operationSucceeded(), - sprintf("Operation %s failed. Error: %s", $operation->getName(), $operation->getError()->getMessage())); - $instance = self::$instancesClient->get( - self::$name, - self::$projectId, - self::ZONE - ); - $this->assertEquals('', $instance->getDescription()); - $this->assertEquals('0', $instance->getScheduling()->getMinNodeCpus()); - } - - /** - * @depends testInsertInstance - */ - public function testUpdateDescInstanceNonAscii() - { - $instance = self::$instancesClient->get( - self::$name, - self::$projectId, - self::ZONE - ); - $instance->setDescription('тест'); - $operation = self::$instancesClient->update(self::$name, $instance, self::$projectId, self::ZONE); - $operation->pollUntilComplete(); - $this->assertTrue($operation->operationSucceeded(), - sprintf("Operation %s failed. Error: %s", $operation->getName(), $operation->getError()->getMessage())); - $instance = self::$instancesClient->get( - self::$name, - self::$projectId, - self::ZONE - ); - $this->assertEquals('тест', $instance->getDescription()); - } - - /** - * @depends testInsertInstance - */ - public function testInstanceGroupManagers() - // We test here: 1)set body field to zero - // 2)set query param to zero - { - $templateClient = new InstanceTemplatesClient(); - $managersClient = new InstanceGroupManagersClient(); - $templateName = 'gapicphp' . strval(rand(100000, 999999)); - $managerName = 'gapicphp' . strval(rand(100000, 999999)); - $instance = self::$instancesClient->get( - self::$name, - self::$projectId, - self::ZONE - ); - $templateResource = new InstanceTemplate([ - 'name' => $templateName, - 'source_instance' => $instance->getSelfLink() - ]); - - try { - $op = $templateClient->insert($templateResource, self::$projectId); - $op->pollUntilComplete(); - $this->assertTrue($op->operationSucceeded(), - sprintf("Operation %s failed. Error: %s", $op->getName(), $op->getError()->getMessage())); - $managerResource = new InstanceGroupManager([ - 'base_instance_name' => 'gapicphp', - 'instance_template' => $op->getLastProtoResponse()->getTargetLink(), - 'target_size' => 0, - 'name' => $managerName - ]); - try { - $insertOp = $managersClient->insert($managerResource, self::$projectId, self::ZONE); - $insertOp->pollUntilComplete(); - $this->assertTrue($insertOp->operationSucceeded(), - sprintf("Operation %s failed. Error: %s", $insertOp->getName(), $insertOp->getError()->getMessage())); - $manager = $managersClient->get($managerName, self::$projectId, self::ZONE); - $this->assertEquals(0, $manager->getTargetSize()); - - $resizeOp = $managersClient->resize($managerName, self::$projectId, 1, self::ZONE); - $resizeOp->pollUntilComplete(); - $this->assertTrue($resizeOp->operationSucceeded(), - sprintf("Operation %s failed. Error: %s", $resizeOp->getName(), $resizeOp->getError()->getMessage())); - $manager = $managersClient->get($managerName, self::$projectId, self::ZONE); - $this->assertEquals(1, $manager->getTargetSize()); - $resizeOp = $managersClient->resize($managerName, self::$projectId, 0, self::ZONE); - $resizeOp->pollUntilComplete(); - $this->assertTrue($resizeOp->operationSucceeded(), - sprintf("Operation %s failed. Error: %s", $resizeOp->getName(), $resizeOp->getError()->getMessage())); - $manager = $managersClient->get($managerName, self::$projectId, self::ZONE); - $this->assertEquals(0, $manager->getTargetSize()); - } finally { - $deleteOp = $managersClient ->delete($managerName, self::$projectId, self::ZONE); - $deleteOp->pollUntilComplete(); - $this->assertTrue($deleteOp->operationSucceeded(), - sprintf("Operation %s failed. Error: %s", $deleteOp->getName(), $deleteOp->getError()->getMessage())); - } - } finally { - $templateClient->delete($templateName, self::$projectId); - } - } - - - /** - * @depends testInsertInstance - */ - public function testPatchInstance() - { - $shieldedInstanceConfigResource = new ShieldedInstanceConfig(); - $shieldedInstanceConfigResource->setEnableSecureBoot(true); - - self::$instancesClient->stop(self::$name, self::$projectId, self::ZONE); - while (true){ - $instance = self::$instancesClient->get( - self::$name, - self::$projectId, - self::ZONE - ); - if ($instance->getStatus() == Instance\Status::name(Instance\Status::TERMINATED)) { - break; - } - sleep(10); - } - try { - $op = self::$instancesClient->updateShieldedInstanceConfig( - self::$name, self::$projectId, $shieldedInstanceConfigResource, self::ZONE); - } catch (ApiException $e) { - $this->fail('update method failed' . $e->getMessage()); - } - $op->pollUntilComplete(); - $this->assertTrue($op->operationSucceeded(), - sprintf("Operation %s failed. Error: %s", $op->getName(), $op->getError()->getMessage())); - - $instance = self::$instancesClient->get( - self::$name, - self::$projectId, - self::ZONE - ); - - $this->assertEquals(true, $instance->getShieldedInstanceConfig()->getEnableSecureBoot()); - } - - /** - * @depends testInsertInstance - */ - public function testDeleteInstance(): void - { - $op = self::$instancesClient->delete(self::$name, self::$projectId, self::ZONE); - $op->pollUntilComplete(); - $this->assertTrue($op->operationSucceeded(), - sprintf("Operation %s failed. Error: %s", $op->getName(), $op->getError()->getMessage())); - - try { - self::$instancesClient->get(self::$name, self::$projectId, self::ZONE); - $this->fail('The deleted instance still exists'); - } catch (ApiException $e) { - $this->assertEquals(404, $e->getCode()); - } - } - - public function testAPIError() - { - $this->expectException(ApiException::class); - $this->expectExceptionMessage('was not found'); - $operationClient = new ZoneOperationsClient(); - $operationClient->get('123', self::$projectId, self::ZONE); - } - - public function testValidationError() - { - $this->expectException(ValidationException::class); - $this->expectExceptionMessage('Could not map bindings'); - $operationClient = new ZoneOperationsClient(); - $operationClient->get('123', self::$projectId, ''); - } -} diff --git a/Compute/tests/Unit/V1/AcceleratorTypesClientTest.php b/Compute/tests/Unit/V1/AcceleratorTypesClientTest.php deleted file mode 100644 index 5c6d88c7fc06..000000000000 --- a/Compute/tests/Unit/V1/AcceleratorTypesClientTest.php +++ /dev/null @@ -1,299 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return AcceleratorTypesClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new AcceleratorTypesClient($options); - } - - /** @test */ - public function aggregatedListTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $items = [ - 'itemsKey' => new AcceleratorTypesScopedList(), - ]; - $expectedResponse = new AcceleratorTypeAggregatedList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->aggregatedList($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertArrayHasKey('itemsKey', $expectedResponse->getItems()); - $this->assertArrayHasKey('itemsKey', $resources); - $this->assertEquals($expectedResponse->getItems()['itemsKey'], $resources['itemsKey']); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.AcceleratorTypes/AggregatedList', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function aggregatedListExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->aggregatedList($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $id = 3355; - $kind = 'kind3292052'; - $maximumCardsPerInstance = 1883669166; - $name = 'name3373707'; - $selfLink = 'selfLink-1691268851'; - $zone2 = 'zone2-696322977'; - $expectedResponse = new AcceleratorType(); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setMaximumCardsPerInstance($maximumCardsPerInstance); - $expectedResponse->setName($name); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setZone($zone2); - $transport->addResponse($expectedResponse); - // Mock request - $acceleratorType = 'acceleratorType1748643982'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->get($acceleratorType, $project, $zone); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.AcceleratorTypes/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getAcceleratorType(); - $this->assertProtobufEquals($acceleratorType, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $acceleratorType = 'acceleratorType1748643982'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - try { - $gapicClient->get($acceleratorType, $project, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new AcceleratorType(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new AcceleratorTypeList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->list($project, $zone); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.AcceleratorTypes/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $zone = 'zone3744684'; - try { - $gapicClient->list($project, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->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/Compute/tests/Unit/V1/AddressesClientTest.php b/Compute/tests/Unit/V1/AddressesClientTest.php deleted file mode 100644 index 5bea9b8ea1d4..000000000000 --- a/Compute/tests/Unit/V1/AddressesClientTest.php +++ /dev/null @@ -1,809 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return AddressesClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new AddressesClient($options); - } - - /** @test */ - public function aggregatedListTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $items = [ - 'itemsKey' => new AddressesScopedList(), - ]; - $expectedResponse = new AddressAggregatedList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->aggregatedList($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertArrayHasKey('itemsKey', $expectedResponse->getItems()); - $this->assertArrayHasKey('itemsKey', $resources); - $this->assertEquals($expectedResponse->getItems()['itemsKey'], $resources['itemsKey']); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Addresses/AggregatedList', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function aggregatedListExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->aggregatedList($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $address = 'address-1147692044'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->delete($address, $project, $region); - $this->assertFalse($response->isDone()); - $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.compute.v1.Addresses/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getAddress(); - $this->assertProtobufEquals($address, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $address = 'address-1147692044'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->delete($address, $project, $region); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $address2 = 'address2874543783'; - $addressType = 'addressType264307877'; - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $id = 3355; - $ipVersion = 'ipVersion-1315653184'; - $ipv6EndpointType = 'ipv6EndpointType-2049982644'; - $kind = 'kind3292052'; - $labelFingerprint = 'labelFingerprint714995737'; - $name = 'name3373707'; - $network = 'network1843485230'; - $networkTier = 'networkTier-19473069'; - $prefixLength = 1157046989; - $purpose = 'purpose-220463842'; - $region2 = 'region2-690338393'; - $selfLink = 'selfLink-1691268851'; - $status = 'status-892481550'; - $subnetwork = 'subnetwork-1302785042'; - $expectedResponse = new Address(); - $expectedResponse->setAddress($address2); - $expectedResponse->setAddressType($addressType); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setId($id); - $expectedResponse->setIpVersion($ipVersion); - $expectedResponse->setIpv6EndpointType($ipv6EndpointType); - $expectedResponse->setKind($kind); - $expectedResponse->setLabelFingerprint($labelFingerprint); - $expectedResponse->setName($name); - $expectedResponse->setNetwork($network); - $expectedResponse->setNetworkTier($networkTier); - $expectedResponse->setPrefixLength($prefixLength); - $expectedResponse->setPurpose($purpose); - $expectedResponse->setRegion($region2); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setStatus($status); - $expectedResponse->setSubnetwork($subnetwork); - $transport->addResponse($expectedResponse); - // Mock request - $address = 'address-1147692044'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->get($address, $project, $region); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Addresses/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getAddress(); - $this->assertProtobufEquals($address, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $address = 'address-1147692044'; - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->get($address, $project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $addressResource = new Address(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->insert($addressResource, $project, $region); - $this->assertFalse($response->isDone()); - $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.compute.v1.Addresses/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getAddressResource(); - $this->assertProtobufEquals($addressResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $addressResource = new Address(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->insert($addressResource, $project, $region); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new Address(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new AddressList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->list($project, $region); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Addresses/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->list($project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function moveTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/moveTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/moveTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $address = 'address-1147692044'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionAddressesMoveRequestResource = new RegionAddressesMoveRequest(); - $response = $gapicClient->move($address, $project, $region, $regionAddressesMoveRequestResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.Addresses/Move', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getAddress(); - $this->assertProtobufEquals($address, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getRegionAddressesMoveRequestResource(); - $this->assertProtobufEquals($regionAddressesMoveRequestResource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function moveExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/moveExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $address = 'address-1147692044'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionAddressesMoveRequestResource = new RegionAddressesMoveRequest(); - $response = $gapicClient->move($address, $project, $region, $regionAddressesMoveRequestResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 setLabelsTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setLabelsTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/setLabelsTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionSetLabelsRequestResource = new RegionSetLabelsRequest(); - $resource = 'resource-341064690'; - $response = $gapicClient->setLabels($project, $region, $regionSetLabelsRequestResource, $resource); - $this->assertFalse($response->isDone()); - $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.compute.v1.Addresses/SetLabels', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getRegionSetLabelsRequestResource(); - $this->assertProtobufEquals($regionSetLabelsRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setLabelsExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setLabelsExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionSetLabelsRequestResource = new RegionSetLabelsRequest(); - $resource = 'resource-341064690'; - $response = $gapicClient->setLabels($project, $region, $regionSetLabelsRequestResource, $resource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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/Compute/tests/Unit/V1/AutoscalersClientTest.php b/Compute/tests/Unit/V1/AutoscalersClientTest.php deleted file mode 100644 index 5384eabd8a37..000000000000 --- a/Compute/tests/Unit/V1/AutoscalersClientTest.php +++ /dev/null @@ -1,785 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return AutoscalersClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new AutoscalersClient($options); - } - - /** @test */ - public function aggregatedListTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $items = [ - 'itemsKey' => new AutoscalersScopedList(), - ]; - $expectedResponse = new AutoscalerAggregatedList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->aggregatedList($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertArrayHasKey('itemsKey', $expectedResponse->getItems()); - $this->assertArrayHasKey('itemsKey', $resources); - $this->assertEquals($expectedResponse->getItems()['itemsKey'], $resources['itemsKey']); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Autoscalers/AggregatedList', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function aggregatedListExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->aggregatedList($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $autoscaler = 'autoscaler517258967'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->delete($autoscaler, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.Autoscalers/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getAutoscaler(); - $this->assertProtobufEquals($autoscaler, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $autoscaler = 'autoscaler517258967'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->delete($autoscaler, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $id = 3355; - $kind = 'kind3292052'; - $name = 'name3373707'; - $recommendedSize = 1889567899; - $region = 'region-934795532'; - $selfLink = 'selfLink-1691268851'; - $status = 'status-892481550'; - $target = 'target-880905839'; - $zone2 = 'zone2-696322977'; - $expectedResponse = new Autoscaler(); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setName($name); - $expectedResponse->setRecommendedSize($recommendedSize); - $expectedResponse->setRegion($region); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setStatus($status); - $expectedResponse->setTarget($target); - $expectedResponse->setZone($zone2); - $transport->addResponse($expectedResponse); - // Mock request - $autoscaler = 'autoscaler517258967'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->get($autoscaler, $project, $zone); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Autoscalers/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getAutoscaler(); - $this->assertProtobufEquals($autoscaler, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $autoscaler = 'autoscaler517258967'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - try { - $gapicClient->get($autoscaler, $project, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $autoscalerResource = new Autoscaler(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->insert($autoscalerResource, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.Autoscalers/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getAutoscalerResource(); - $this->assertProtobufEquals($autoscalerResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $autoscalerResource = new Autoscaler(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->insert($autoscalerResource, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new Autoscaler(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new AutoscalerList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->list($project, $zone); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Autoscalers/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $zone = 'zone3744684'; - try { - $gapicClient->list($project, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function patchTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/patchTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $autoscalerResource = new Autoscaler(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->patch($autoscalerResource, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.Autoscalers/Patch', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getAutoscalerResource(); - $this->assertProtobufEquals($autoscalerResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function patchExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $autoscalerResource = new Autoscaler(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->patch($autoscalerResource, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 updateTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/updateTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/updateTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $autoscalerResource = new Autoscaler(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->update($autoscalerResource, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.Autoscalers/Update', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getAutoscalerResource(); - $this->assertProtobufEquals($autoscalerResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function updateExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/updateExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $autoscalerResource = new Autoscaler(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->update($autoscalerResource, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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/Compute/tests/Unit/V1/BackendBucketsClientTest.php b/Compute/tests/Unit/V1/BackendBucketsClientTest.php deleted file mode 100644 index 7187e5635ec4..000000000000 --- a/Compute/tests/Unit/V1/BackendBucketsClientTest.php +++ /dev/null @@ -1,1254 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return BackendBucketsClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new BackendBucketsClient($options); - } - - /** @test */ - public function addSignedUrlKeyTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/addSignedUrlKeyTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/addSignedUrlKeyTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $backendBucket = 'backendBucket91714037'; - $project = 'project-309310695'; - $signedUrlKeyResource = new SignedUrlKey(); - $response = $gapicClient->addSignedUrlKey($backendBucket, $project, $signedUrlKeyResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.BackendBuckets/AddSignedUrlKey', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getBackendBucket(); - $this->assertProtobufEquals($backendBucket, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getSignedUrlKeyResource(); - $this->assertProtobufEquals($signedUrlKeyResource, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function addSignedUrlKeyExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/addSignedUrlKeyExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $backendBucket = 'backendBucket91714037'; - $project = 'project-309310695'; - $signedUrlKeyResource = new SignedUrlKey(); - $response = $gapicClient->addSignedUrlKey($backendBucket, $project, $signedUrlKeyResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $backendBucket = 'backendBucket91714037'; - $project = 'project-309310695'; - $response = $gapicClient->delete($backendBucket, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.BackendBuckets/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getBackendBucket(); - $this->assertProtobufEquals($backendBucket, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $backendBucket = 'backendBucket91714037'; - $project = 'project-309310695'; - $response = $gapicClient->delete($backendBucket, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 deleteSignedUrlKeyTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteSignedUrlKeyTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteSignedUrlKeyTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $backendBucket = 'backendBucket91714037'; - $keyName = 'keyName500938859'; - $project = 'project-309310695'; - $response = $gapicClient->deleteSignedUrlKey($backendBucket, $keyName, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.BackendBuckets/DeleteSignedUrlKey', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getBackendBucket(); - $this->assertProtobufEquals($backendBucket, $actualValue); - $actualValue = $actualApiRequestObject->getKeyName(); - $this->assertProtobufEquals($keyName, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteSignedUrlKeyExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteSignedUrlKeyExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $backendBucket = 'backendBucket91714037'; - $keyName = 'keyName500938859'; - $project = 'project-309310695'; - $response = $gapicClient->deleteSignedUrlKey($backendBucket, $keyName, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $bucketName = 'bucketName283610048'; - $compressionMode = 'compressionMode-2051962660'; - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $edgeSecurityPolicy = 'edgeSecurityPolicy-1032704881'; - $enableCdn = false; - $id = 3355; - $kind = 'kind3292052'; - $loadBalancingScheme = 'loadBalancingScheme1974502980'; - $name = 'name3373707'; - $selfLink = 'selfLink-1691268851'; - $expectedResponse = new BackendBucket(); - $expectedResponse->setBucketName($bucketName); - $expectedResponse->setCompressionMode($compressionMode); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setEdgeSecurityPolicy($edgeSecurityPolicy); - $expectedResponse->setEnableCdn($enableCdn); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setLoadBalancingScheme($loadBalancingScheme); - $expectedResponse->setName($name); - $expectedResponse->setSelfLink($selfLink); - $transport->addResponse($expectedResponse); - // Mock request - $backendBucket = 'backendBucket91714037'; - $project = 'project-309310695'; - $response = $gapicClient->get($backendBucket, $project); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.BackendBuckets/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getBackendBucket(); - $this->assertProtobufEquals($backendBucket, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $backendBucket = 'backendBucket91714037'; - $project = 'project-309310695'; - try { - $gapicClient->get($backendBucket, $project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $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 - $etag = 'etag3123477'; - $iamOwned = false; - $version = 351608024; - $expectedResponse = new Policy(); - $expectedResponse->setEtag($etag); - $expectedResponse->setIamOwned($iamOwned); - $expectedResponse->setVersion($version); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $response = $gapicClient->getIamPolicy($project, $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.compute.v1.BackendBuckets/GetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $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 - $project = 'project-309310695'; - $resource = 'resource-341064690'; - try { - $gapicClient->getIamPolicy($project, $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 insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $backendBucketResource = new BackendBucket(); - $project = 'project-309310695'; - $response = $gapicClient->insert($backendBucketResource, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.BackendBuckets/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getBackendBucketResource(); - $this->assertProtobufEquals($backendBucketResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $backendBucketResource = new BackendBucket(); - $project = 'project-309310695'; - $response = $gapicClient->insert($backendBucketResource, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new BackendBucket(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new BackendBucketList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->list($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.BackendBuckets/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->list($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function patchTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/patchTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $backendBucket = 'backendBucket91714037'; - $backendBucketResource = new BackendBucket(); - $project = 'project-309310695'; - $response = $gapicClient->patch($backendBucket, $backendBucketResource, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.BackendBuckets/Patch', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getBackendBucket(); - $this->assertProtobufEquals($backendBucket, $actualValue); - $actualValue = $actualApiRequestObject->getBackendBucketResource(); - $this->assertProtobufEquals($backendBucketResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function patchExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $backendBucket = 'backendBucket91714037'; - $backendBucketResource = new BackendBucket(); - $project = 'project-309310695'; - $response = $gapicClient->patch($backendBucket, $backendBucketResource, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 setEdgeSecurityPolicyTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setEdgeSecurityPolicyTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/setEdgeSecurityPolicyTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $backendBucket = 'backendBucket91714037'; - $project = 'project-309310695'; - $securityPolicyReferenceResource = new SecurityPolicyReference(); - $response = $gapicClient->setEdgeSecurityPolicy($backendBucket, $project, $securityPolicyReferenceResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.BackendBuckets/SetEdgeSecurityPolicy', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getBackendBucket(); - $this->assertProtobufEquals($backendBucket, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getSecurityPolicyReferenceResource(); - $this->assertProtobufEquals($securityPolicyReferenceResource, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setEdgeSecurityPolicyExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setEdgeSecurityPolicyExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $backendBucket = 'backendBucket91714037'; - $project = 'project-309310695'; - $securityPolicyReferenceResource = new SecurityPolicyReference(); - $response = $gapicClient->setEdgeSecurityPolicy($backendBucket, $project, $securityPolicyReferenceResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 - $etag = 'etag3123477'; - $iamOwned = false; - $version = 351608024; - $expectedResponse = new Policy(); - $expectedResponse->setEtag($etag); - $expectedResponse->setIamOwned($iamOwned); - $expectedResponse->setVersion($version); - $transport->addResponse($expectedResponse); - // Mock request - $globalSetPolicyRequestResource = new GlobalSetPolicyRequest(); - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $response = $gapicClient->setIamPolicy($globalSetPolicyRequestResource, $project, $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.compute.v1.BackendBuckets/SetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getGlobalSetPolicyRequestResource(); - $this->assertProtobufEquals($globalSetPolicyRequestResource, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $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 - $globalSetPolicyRequestResource = new GlobalSetPolicyRequest(); - $project = 'project-309310695'; - $resource = 'resource-341064690'; - try { - $gapicClient->setIamPolicy($globalSetPolicyRequestResource, $project, $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 testIamPermissionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new TestPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $testPermissionsRequestResource = new TestPermissionsRequest(); - $response = $gapicClient->testIamPermissions($project, $resource, $testPermissionsRequestResource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.BackendBuckets/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getTestPermissionsRequestResource(); - $this->assertProtobufEquals($testPermissionsRequestResource, $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 - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $testPermissionsRequestResource = new TestPermissionsRequest(); - try { - $gapicClient->testIamPermissions($project, $resource, $testPermissionsRequestResource); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/updateTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/updateTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $backendBucket = 'backendBucket91714037'; - $backendBucketResource = new BackendBucket(); - $project = 'project-309310695'; - $response = $gapicClient->update($backendBucket, $backendBucketResource, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.BackendBuckets/Update', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getBackendBucket(); - $this->assertProtobufEquals($backendBucket, $actualValue); - $actualValue = $actualApiRequestObject->getBackendBucketResource(); - $this->assertProtobufEquals($backendBucketResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function updateExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/updateExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $backendBucket = 'backendBucket91714037'; - $backendBucketResource = new BackendBucket(); - $project = 'project-309310695'; - $response = $gapicClient->update($backendBucket, $backendBucketResource, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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/Compute/tests/Unit/V1/BackendServicesClientTest.php b/Compute/tests/Unit/V1/BackendServicesClientTest.php deleted file mode 100644 index ab77d8d3aa1b..000000000000 --- a/Compute/tests/Unit/V1/BackendServicesClientTest.php +++ /dev/null @@ -1,1622 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return BackendServicesClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new BackendServicesClient($options); - } - - /** @test */ - public function addSignedUrlKeyTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/addSignedUrlKeyTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/addSignedUrlKeyTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $backendService = 'backendService306946058'; - $project = 'project-309310695'; - $signedUrlKeyResource = new SignedUrlKey(); - $response = $gapicClient->addSignedUrlKey($backendService, $project, $signedUrlKeyResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.BackendServices/AddSignedUrlKey', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getBackendService(); - $this->assertProtobufEquals($backendService, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getSignedUrlKeyResource(); - $this->assertProtobufEquals($signedUrlKeyResource, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function addSignedUrlKeyExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/addSignedUrlKeyExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $backendService = 'backendService306946058'; - $project = 'project-309310695'; - $signedUrlKeyResource = new SignedUrlKey(); - $response = $gapicClient->addSignedUrlKey($backendService, $project, $signedUrlKeyResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 aggregatedListTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $items = [ - 'itemsKey' => new BackendServicesScopedList(), - ]; - $expectedResponse = new BackendServiceAggregatedList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->aggregatedList($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertArrayHasKey('itemsKey', $expectedResponse->getItems()); - $this->assertArrayHasKey('itemsKey', $resources); - $this->assertEquals($expectedResponse->getItems()['itemsKey'], $resources['itemsKey']); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.BackendServices/AggregatedList', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function aggregatedListExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->aggregatedList($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $backendService = 'backendService306946058'; - $project = 'project-309310695'; - $response = $gapicClient->delete($backendService, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.BackendServices/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getBackendService(); - $this->assertProtobufEquals($backendService, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $backendService = 'backendService306946058'; - $project = 'project-309310695'; - $response = $gapicClient->delete($backendService, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 deleteSignedUrlKeyTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteSignedUrlKeyTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteSignedUrlKeyTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $backendService = 'backendService306946058'; - $keyName = 'keyName500938859'; - $project = 'project-309310695'; - $response = $gapicClient->deleteSignedUrlKey($backendService, $keyName, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.BackendServices/DeleteSignedUrlKey', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getBackendService(); - $this->assertProtobufEquals($backendService, $actualValue); - $actualValue = $actualApiRequestObject->getKeyName(); - $this->assertProtobufEquals($keyName, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteSignedUrlKeyExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteSignedUrlKeyExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $backendService = 'backendService306946058'; - $keyName = 'keyName500938859'; - $project = 'project-309310695'; - $response = $gapicClient->deleteSignedUrlKey($backendService, $keyName, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $affinityCookieTtlSec = 1777486694; - $compressionMode = 'compressionMode-2051962660'; - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $edgeSecurityPolicy = 'edgeSecurityPolicy-1032704881'; - $enableCDN = false; - $externalManagedMigrationState = 'externalManagedMigrationState-469923892'; - $externalManagedMigrationTestingPercentage = 3747041; - $fingerprint = 'fingerprint-1375934236'; - $id = 3355; - $ipAddressSelectionPolicy = 'ipAddressSelectionPolicy614471752'; - $kind = 'kind3292052'; - $loadBalancingScheme = 'loadBalancingScheme1974502980'; - $localityLbPolicy = 'localityLbPolicy-2016052161'; - $name = 'name3373707'; - $network = 'network1843485230'; - $port = 3446913; - $portName = 'portName1115276169'; - $protocol = 'protocol-989163880'; - $region = 'region-934795532'; - $securityPolicy = 'securityPolicy1781695249'; - $selfLink = 'selfLink-1691268851'; - $serviceLbPolicy = 'serviceLbPolicy1168590609'; - $sessionAffinity = 'sessionAffinity1000759473'; - $timeoutSec = 2067488653; - $expectedResponse = new BackendService(); - $expectedResponse->setAffinityCookieTtlSec($affinityCookieTtlSec); - $expectedResponse->setCompressionMode($compressionMode); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setEdgeSecurityPolicy($edgeSecurityPolicy); - $expectedResponse->setEnableCDN($enableCDN); - $expectedResponse->setExternalManagedMigrationState($externalManagedMigrationState); - $expectedResponse->setExternalManagedMigrationTestingPercentage($externalManagedMigrationTestingPercentage); - $expectedResponse->setFingerprint($fingerprint); - $expectedResponse->setId($id); - $expectedResponse->setIpAddressSelectionPolicy($ipAddressSelectionPolicy); - $expectedResponse->setKind($kind); - $expectedResponse->setLoadBalancingScheme($loadBalancingScheme); - $expectedResponse->setLocalityLbPolicy($localityLbPolicy); - $expectedResponse->setName($name); - $expectedResponse->setNetwork($network); - $expectedResponse->setPort($port); - $expectedResponse->setPortName($portName); - $expectedResponse->setProtocol($protocol); - $expectedResponse->setRegion($region); - $expectedResponse->setSecurityPolicy($securityPolicy); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setServiceLbPolicy($serviceLbPolicy); - $expectedResponse->setSessionAffinity($sessionAffinity); - $expectedResponse->setTimeoutSec($timeoutSec); - $transport->addResponse($expectedResponse); - // Mock request - $backendService = 'backendService306946058'; - $project = 'project-309310695'; - $response = $gapicClient->get($backendService, $project); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.BackendServices/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getBackendService(); - $this->assertProtobufEquals($backendService, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $backendService = 'backendService306946058'; - $project = 'project-309310695'; - try { - $gapicClient->get($backendService, $project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getHealthTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $kind = 'kind3292052'; - $expectedResponse = new BackendServiceGroupHealth(); - $expectedResponse->setKind($kind); - $transport->addResponse($expectedResponse); - // Mock request - $backendService = 'backendService306946058'; - $project = 'project-309310695'; - $resourceGroupReferenceResource = new ResourceGroupReference(); - $response = $gapicClient->getHealth($backendService, $project, $resourceGroupReferenceResource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.BackendServices/GetHealth', $actualFuncCall); - $actualValue = $actualRequestObject->getBackendService(); - $this->assertProtobufEquals($backendService, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getResourceGroupReferenceResource(); - $this->assertProtobufEquals($resourceGroupReferenceResource, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getHealthExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $backendService = 'backendService306946058'; - $project = 'project-309310695'; - $resourceGroupReferenceResource = new ResourceGroupReference(); - try { - $gapicClient->getHealth($backendService, $project, $resourceGroupReferenceResource); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $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 - $etag = 'etag3123477'; - $iamOwned = false; - $version = 351608024; - $expectedResponse = new Policy(); - $expectedResponse->setEtag($etag); - $expectedResponse->setIamOwned($iamOwned); - $expectedResponse->setVersion($version); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $response = $gapicClient->getIamPolicy($project, $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.compute.v1.BackendServices/GetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $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 - $project = 'project-309310695'; - $resource = 'resource-341064690'; - try { - $gapicClient->getIamPolicy($project, $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 insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $backendServiceResource = new BackendService(); - $project = 'project-309310695'; - $response = $gapicClient->insert($backendServiceResource, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.BackendServices/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getBackendServiceResource(); - $this->assertProtobufEquals($backendServiceResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $backendServiceResource = new BackendService(); - $project = 'project-309310695'; - $response = $gapicClient->insert($backendServiceResource, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new BackendService(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new BackendServiceList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->list($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.BackendServices/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->list($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listUsableTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new BackendService(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new BackendServiceListUsable(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->listUsable($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.BackendServices/ListUsable', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listUsableExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->listUsable($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function patchTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/patchTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $backendService = 'backendService306946058'; - $backendServiceResource = new BackendService(); - $project = 'project-309310695'; - $response = $gapicClient->patch($backendService, $backendServiceResource, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.BackendServices/Patch', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getBackendService(); - $this->assertProtobufEquals($backendService, $actualValue); - $actualValue = $actualApiRequestObject->getBackendServiceResource(); - $this->assertProtobufEquals($backendServiceResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function patchExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $backendService = 'backendService306946058'; - $backendServiceResource = new BackendService(); - $project = 'project-309310695'; - $response = $gapicClient->patch($backendService, $backendServiceResource, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 setEdgeSecurityPolicyTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setEdgeSecurityPolicyTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/setEdgeSecurityPolicyTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $backendService = 'backendService306946058'; - $project = 'project-309310695'; - $securityPolicyReferenceResource = new SecurityPolicyReference(); - $response = $gapicClient->setEdgeSecurityPolicy($backendService, $project, $securityPolicyReferenceResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.BackendServices/SetEdgeSecurityPolicy', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getBackendService(); - $this->assertProtobufEquals($backendService, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getSecurityPolicyReferenceResource(); - $this->assertProtobufEquals($securityPolicyReferenceResource, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setEdgeSecurityPolicyExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setEdgeSecurityPolicyExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $backendService = 'backendService306946058'; - $project = 'project-309310695'; - $securityPolicyReferenceResource = new SecurityPolicyReference(); - $response = $gapicClient->setEdgeSecurityPolicy($backendService, $project, $securityPolicyReferenceResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 - $etag = 'etag3123477'; - $iamOwned = false; - $version = 351608024; - $expectedResponse = new Policy(); - $expectedResponse->setEtag($etag); - $expectedResponse->setIamOwned($iamOwned); - $expectedResponse->setVersion($version); - $transport->addResponse($expectedResponse); - // Mock request - $globalSetPolicyRequestResource = new GlobalSetPolicyRequest(); - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $response = $gapicClient->setIamPolicy($globalSetPolicyRequestResource, $project, $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.compute.v1.BackendServices/SetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getGlobalSetPolicyRequestResource(); - $this->assertProtobufEquals($globalSetPolicyRequestResource, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $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 - $globalSetPolicyRequestResource = new GlobalSetPolicyRequest(); - $project = 'project-309310695'; - $resource = 'resource-341064690'; - try { - $gapicClient->setIamPolicy($globalSetPolicyRequestResource, $project, $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 setSecurityPolicyTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setSecurityPolicyTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/setSecurityPolicyTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $backendService = 'backendService306946058'; - $project = 'project-309310695'; - $securityPolicyReferenceResource = new SecurityPolicyReference(); - $response = $gapicClient->setSecurityPolicy($backendService, $project, $securityPolicyReferenceResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.BackendServices/SetSecurityPolicy', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getBackendService(); - $this->assertProtobufEquals($backendService, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getSecurityPolicyReferenceResource(); - $this->assertProtobufEquals($securityPolicyReferenceResource, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setSecurityPolicyExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setSecurityPolicyExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $backendService = 'backendService306946058'; - $project = 'project-309310695'; - $securityPolicyReferenceResource = new SecurityPolicyReference(); - $response = $gapicClient->setSecurityPolicy($backendService, $project, $securityPolicyReferenceResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 testIamPermissionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new TestPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $testPermissionsRequestResource = new TestPermissionsRequest(); - $response = $gapicClient->testIamPermissions($project, $resource, $testPermissionsRequestResource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.BackendServices/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getTestPermissionsRequestResource(); - $this->assertProtobufEquals($testPermissionsRequestResource, $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 - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $testPermissionsRequestResource = new TestPermissionsRequest(); - try { - $gapicClient->testIamPermissions($project, $resource, $testPermissionsRequestResource); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/updateTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/updateTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $backendService = 'backendService306946058'; - $backendServiceResource = new BackendService(); - $project = 'project-309310695'; - $response = $gapicClient->update($backendService, $backendServiceResource, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.BackendServices/Update', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getBackendService(); - $this->assertProtobufEquals($backendService, $actualValue); - $actualValue = $actualApiRequestObject->getBackendServiceResource(); - $this->assertProtobufEquals($backendServiceResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function updateExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/updateExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $backendService = 'backendService306946058'; - $backendServiceResource = new BackendService(); - $project = 'project-309310695'; - $response = $gapicClient->update($backendService, $backendServiceResource, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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/Compute/tests/Unit/V1/Client/AcceleratorTypesClientTest.php b/Compute/tests/Unit/V1/Client/AcceleratorTypesClientTest.php index 6e16a3241e39..ed198d72cc60 100644 --- a/Compute/tests/Unit/V1/Client/AcceleratorTypesClientTest.php +++ b/Compute/tests/Unit/V1/Client/AcceleratorTypesClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return AcceleratorTypesClient */ @@ -90,8 +92,7 @@ public function aggregatedListTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListAcceleratorTypesRequest()) - ->setProject($project); + $request = (new AggregatedListAcceleratorTypesRequest())->setProject($project); $response = $gapicClient->aggregatedList($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -120,17 +121,19 @@ public function aggregatedListExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListAcceleratorTypesRequest()) - ->setProject($project); + $request = (new AggregatedListAcceleratorTypesRequest())->setProject($project); try { $gapicClient->aggregatedList($request); // If the $gapicClient method call did not throw, fail the test @@ -206,12 +209,15 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $acceleratorType = 'acceleratorType1748643982'; @@ -248,9 +254,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new AcceleratorType(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new AcceleratorTypeList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -261,9 +265,7 @@ public function listTest() // Mock request $project = 'project-309310695'; $zone = 'zone3744684'; - $request = (new ListAcceleratorTypesRequest()) - ->setProject($project) - ->setZone($zone); + $request = (new ListAcceleratorTypesRequest())->setProject($project)->setZone($zone); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -292,19 +294,20 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $zone = 'zone3744684'; - $request = (new ListAcceleratorTypesRequest()) - ->setProject($project) - ->setZone($zone); + $request = (new ListAcceleratorTypesRequest())->setProject($project)->setZone($zone); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -343,8 +346,7 @@ public function aggregatedListAsyncTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListAcceleratorTypesRequest()) - ->setProject($project); + $request = (new AggregatedListAcceleratorTypesRequest())->setProject($project); $response = $gapicClient->aggregatedListAsync($request)->wait(); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); diff --git a/Compute/tests/Unit/V1/Client/AddressesClientTest.php b/Compute/tests/Unit/V1/Client/AddressesClientTest.php index b268e33de2cd..068d2aea67ed 100644 --- a/Compute/tests/Unit/V1/Client/AddressesClientTest.php +++ b/Compute/tests/Unit/V1/Client/AddressesClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return AddressesClient */ @@ -100,8 +102,7 @@ public function aggregatedListTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListAddressesRequest()) - ->setProject($project); + $request = (new AggregatedListAddressesRequest())->setProject($project); $response = $gapicClient->aggregatedList($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -130,17 +131,19 @@ public function aggregatedListExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListAddressesRequest()) - ->setProject($project); + $request = (new AggregatedListAddressesRequest())->setProject($project); try { $gapicClient->aggregatedList($request); // If the $gapicClient method call did not throw, fail the test @@ -246,12 +249,15 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $address = 'address-1147692044'; @@ -363,12 +369,15 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $address = 'address-1147692044'; @@ -483,12 +492,15 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $addressResource = new Address(); @@ -532,9 +544,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new Address(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new AddressList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -545,9 +555,7 @@ public function listTest() // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListAddressesRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListAddressesRequest())->setProject($project)->setRegion($region); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -576,19 +584,20 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListAddressesRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListAddressesRequest())->setProject($project)->setRegion($region); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -698,12 +707,15 @@ public function moveExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $address = 'address-1147692044'; @@ -831,12 +843,15 @@ public function setLabelsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -893,8 +908,7 @@ public function aggregatedListAsyncTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListAddressesRequest()) - ->setProject($project); + $request = (new AggregatedListAddressesRequest())->setProject($project); $response = $gapicClient->aggregatedListAsync($request)->wait(); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); diff --git a/Compute/tests/Unit/V1/Client/AutoscalersClientTest.php b/Compute/tests/Unit/V1/Client/AutoscalersClientTest.php index 80dfa6c11594..fc8ec853e968 100644 --- a/Compute/tests/Unit/V1/Client/AutoscalersClientTest.php +++ b/Compute/tests/Unit/V1/Client/AutoscalersClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return AutoscalersClient */ @@ -98,8 +100,7 @@ public function aggregatedListTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListAutoscalersRequest()) - ->setProject($project); + $request = (new AggregatedListAutoscalersRequest())->setProject($project); $response = $gapicClient->aggregatedList($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -128,17 +129,19 @@ public function aggregatedListExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListAutoscalersRequest()) - ->setProject($project); + $request = (new AggregatedListAutoscalersRequest())->setProject($project); try { $gapicClient->aggregatedList($request); // If the $gapicClient method call did not throw, fail the test @@ -244,12 +247,15 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $autoscaler = 'autoscaler517258967'; @@ -347,12 +353,15 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $autoscaler = 'autoscaler517258967'; @@ -467,12 +476,15 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $autoscalerResource = new Autoscaler(); @@ -516,9 +528,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new Autoscaler(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new AutoscalerList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -529,9 +539,7 @@ public function listTest() // Mock request $project = 'project-309310695'; $zone = 'zone3744684'; - $request = (new ListAutoscalersRequest()) - ->setProject($project) - ->setZone($zone); + $request = (new ListAutoscalersRequest())->setProject($project)->setZone($zone); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -560,19 +568,20 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $zone = 'zone3744684'; - $request = (new ListAutoscalersRequest()) - ->setProject($project) - ->setZone($zone); + $request = (new ListAutoscalersRequest())->setProject($project)->setZone($zone); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -678,12 +687,15 @@ public function patchExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $autoscalerResource = new Autoscaler(); @@ -805,12 +817,15 @@ public function updateExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $autoscalerResource = new Autoscaler(); @@ -865,8 +880,7 @@ public function aggregatedListAsyncTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListAutoscalersRequest()) - ->setProject($project); + $request = (new AggregatedListAutoscalersRequest())->setProject($project); $response = $gapicClient->aggregatedListAsync($request)->wait(); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); diff --git a/Compute/tests/Unit/V1/Client/BackendBucketsClientTest.php b/Compute/tests/Unit/V1/Client/BackendBucketsClientTest.php index 3d2dc23296af..7be06201a0a8 100644 --- a/Compute/tests/Unit/V1/Client/BackendBucketsClientTest.php +++ b/Compute/tests/Unit/V1/Client/BackendBucketsClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return BackendBucketsClient */ @@ -173,12 +175,15 @@ public function addSignedUrlKeyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $backendBucket = 'backendBucket91714037'; @@ -236,9 +241,7 @@ public function deleteTest() // Mock request $backendBucket = 'backendBucket91714037'; $project = 'project-309310695'; - $request = (new DeleteBackendBucketRequest()) - ->setBackendBucket($backendBucket) - ->setProject($project); + $request = (new DeleteBackendBucketRequest())->setBackendBucket($backendBucket)->setProject($project); $response = $gapicClient->delete($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); @@ -295,19 +298,20 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $backendBucket = 'backendBucket91714037'; $project = 'project-309310695'; - $request = (new DeleteBackendBucketRequest()) - ->setBackendBucket($backendBucket) - ->setProject($project); + $request = (new DeleteBackendBucketRequest())->setBackendBucket($backendBucket)->setProject($project); $response = $gapicClient->delete($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -419,12 +423,15 @@ public function deleteSignedUrlKeyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $backendBucket = 'backendBucket91714037'; @@ -490,9 +497,7 @@ public function getTest() // Mock request $backendBucket = 'backendBucket91714037'; $project = 'project-309310695'; - $request = (new GetBackendBucketRequest()) - ->setBackendBucket($backendBucket) - ->setProject($project); + $request = (new GetBackendBucketRequest())->setBackendBucket($backendBucket)->setProject($project); $response = $gapicClient->get($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -518,19 +523,20 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $backendBucket = 'backendBucket91714037'; $project = 'project-309310695'; - $request = (new GetBackendBucketRequest()) - ->setBackendBucket($backendBucket) - ->setProject($project); + $request = (new GetBackendBucketRequest())->setBackendBucket($backendBucket)->setProject($project); try { $gapicClient->get($request); // If the $gapicClient method call did not throw, fail the test @@ -564,9 +570,7 @@ public function getIamPolicyTest() // Mock request $project = 'project-309310695'; $resource = 'resource-341064690'; - $request = (new GetIamPolicyBackendBucketRequest()) - ->setProject($project) - ->setResource($resource); + $request = (new GetIamPolicyBackendBucketRequest())->setProject($project)->setResource($resource); $response = $gapicClient->getIamPolicy($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -592,19 +596,20 @@ 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 $project = 'project-309310695'; $resource = 'resource-341064690'; - $request = (new GetIamPolicyBackendBucketRequest()) - ->setProject($project) - ->setResource($resource); + $request = (new GetIamPolicyBackendBucketRequest())->setProject($project)->setResource($resource); try { $gapicClient->getIamPolicy($request); // If the $gapicClient method call did not throw, fail the test @@ -705,12 +710,15 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $backendBucketResource = new BackendBucket(); @@ -752,9 +760,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new BackendBucket(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new BackendBucketList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -764,8 +770,7 @@ public function listTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new ListBackendBucketsRequest()) - ->setProject($project); + $request = (new ListBackendBucketsRequest())->setProject($project); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -792,17 +797,19 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new ListBackendBucketsRequest()) - ->setProject($project); + $request = (new ListBackendBucketsRequest())->setProject($project); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -907,12 +914,15 @@ public function patchExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $backendBucket = 'backendBucket91714037'; @@ -1033,12 +1043,15 @@ public function setEdgeSecurityPolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $backendBucket = 'backendBucket91714037'; @@ -1120,12 +1133,15 @@ 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 $globalSetPolicyRequestResource = new GlobalSetPolicyRequest(); @@ -1194,12 +1210,15 @@ 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 $project = 'project-309310695'; @@ -1313,12 +1332,15 @@ public function updateExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $backendBucket = 'backendBucket91714037'; diff --git a/Compute/tests/Unit/V1/Client/BackendServicesClientTest.php b/Compute/tests/Unit/V1/Client/BackendServicesClientTest.php index 61123b3f81a6..1e55034e7c57 100644 --- a/Compute/tests/Unit/V1/Client/BackendServicesClientTest.php +++ b/Compute/tests/Unit/V1/Client/BackendServicesClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return BackendServicesClient */ @@ -182,12 +184,15 @@ public function addSignedUrlKeyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $backendService = 'backendService306946058'; @@ -242,8 +247,7 @@ public function aggregatedListTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListBackendServicesRequest()) - ->setProject($project); + $request = (new AggregatedListBackendServicesRequest())->setProject($project); $response = $gapicClient->aggregatedList($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -272,17 +276,19 @@ public function aggregatedListExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListBackendServicesRequest()) - ->setProject($project); + $request = (new AggregatedListBackendServicesRequest())->setProject($project); try { $gapicClient->aggregatedList($request); // If the $gapicClient method call did not throw, fail the test @@ -324,9 +330,7 @@ public function deleteTest() // Mock request $backendService = 'backendService306946058'; $project = 'project-309310695'; - $request = (new DeleteBackendServiceRequest()) - ->setBackendService($backendService) - ->setProject($project); + $request = (new DeleteBackendServiceRequest())->setBackendService($backendService)->setProject($project); $response = $gapicClient->delete($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); @@ -383,19 +387,20 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $backendService = 'backendService306946058'; $project = 'project-309310695'; - $request = (new DeleteBackendServiceRequest()) - ->setBackendService($backendService) - ->setProject($project); + $request = (new DeleteBackendServiceRequest())->setBackendService($backendService)->setProject($project); $response = $gapicClient->delete($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -507,12 +512,15 @@ public function deleteSignedUrlKeyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $backendService = 'backendService306946058'; @@ -606,9 +614,7 @@ public function getTest() // Mock request $backendService = 'backendService306946058'; $project = 'project-309310695'; - $request = (new GetBackendServiceRequest()) - ->setBackendService($backendService) - ->setProject($project); + $request = (new GetBackendServiceRequest())->setBackendService($backendService)->setProject($project); $response = $gapicClient->get($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -634,19 +640,20 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $backendService = 'backendService306946058'; $project = 'project-309310695'; - $request = (new GetBackendServiceRequest()) - ->setBackendService($backendService) - ->setProject($project); + $request = (new GetBackendServiceRequest())->setBackendService($backendService)->setProject($project); try { $gapicClient->get($request); // If the $gapicClient method call did not throw, fail the test @@ -708,12 +715,15 @@ public function getHealthExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $backendService = 'backendService306946058'; @@ -756,9 +766,7 @@ public function getIamPolicyTest() // Mock request $project = 'project-309310695'; $resource = 'resource-341064690'; - $request = (new GetIamPolicyBackendServiceRequest()) - ->setProject($project) - ->setResource($resource); + $request = (new GetIamPolicyBackendServiceRequest())->setProject($project)->setResource($resource); $response = $gapicClient->getIamPolicy($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -784,19 +792,20 @@ 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 $project = 'project-309310695'; $resource = 'resource-341064690'; - $request = (new GetIamPolicyBackendServiceRequest()) - ->setProject($project) - ->setResource($resource); + $request = (new GetIamPolicyBackendServiceRequest())->setProject($project)->setResource($resource); try { $gapicClient->getIamPolicy($request); // If the $gapicClient method call did not throw, fail the test @@ -897,12 +906,15 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $backendServiceResource = new BackendService(); @@ -944,9 +956,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new BackendService(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new BackendServiceList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -956,8 +966,7 @@ public function listTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new ListBackendServicesRequest()) - ->setProject($project); + $request = (new ListBackendServicesRequest())->setProject($project); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -984,17 +993,19 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new ListBackendServicesRequest()) - ->setProject($project); + $request = (new ListBackendServicesRequest())->setProject($project); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -1022,9 +1033,7 @@ public function listUsableTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new BackendService(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new BackendServiceListUsable(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -1034,8 +1043,7 @@ public function listUsableTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new ListUsableBackendServicesRequest()) - ->setProject($project); + $request = (new ListUsableBackendServicesRequest())->setProject($project); $response = $gapicClient->listUsable($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -1062,17 +1070,19 @@ public function listUsableExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new ListUsableBackendServicesRequest()) - ->setProject($project); + $request = (new ListUsableBackendServicesRequest())->setProject($project); try { $gapicClient->listUsable($request); // If the $gapicClient method call did not throw, fail the test @@ -1177,12 +1187,15 @@ public function patchExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $backendService = 'backendService306946058'; @@ -1303,12 +1316,15 @@ public function setEdgeSecurityPolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $backendService = 'backendService306946058'; @@ -1390,12 +1406,15 @@ 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 $globalSetPolicyRequestResource = new GlobalSetPolicyRequest(); @@ -1509,12 +1528,15 @@ public function setSecurityPolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $backendService = 'backendService306946058'; @@ -1590,12 +1612,15 @@ 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 $project = 'project-309310695'; @@ -1709,12 +1734,15 @@ public function updateExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $backendService = 'backendService306946058'; diff --git a/Compute/tests/Unit/V1/Client/DiskTypesClientTest.php b/Compute/tests/Unit/V1/Client/DiskTypesClientTest.php index 63ebc81f57c4..784a9a0b27f8 100644 --- a/Compute/tests/Unit/V1/Client/DiskTypesClientTest.php +++ b/Compute/tests/Unit/V1/Client/DiskTypesClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return DiskTypesClient */ @@ -90,8 +92,7 @@ public function aggregatedListTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListDiskTypesRequest()) - ->setProject($project); + $request = (new AggregatedListDiskTypesRequest())->setProject($project); $response = $gapicClient->aggregatedList($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -120,17 +121,19 @@ public function aggregatedListExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListDiskTypesRequest()) - ->setProject($project); + $request = (new AggregatedListDiskTypesRequest())->setProject($project); try { $gapicClient->aggregatedList($request); // If the $gapicClient method call did not throw, fail the test @@ -210,12 +213,15 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $diskType = 'diskType93009052'; @@ -252,9 +258,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new DiskType(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new DiskTypeList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -265,9 +269,7 @@ public function listTest() // Mock request $project = 'project-309310695'; $zone = 'zone3744684'; - $request = (new ListDiskTypesRequest()) - ->setProject($project) - ->setZone($zone); + $request = (new ListDiskTypesRequest())->setProject($project)->setZone($zone); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -296,19 +298,20 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $zone = 'zone3744684'; - $request = (new ListDiskTypesRequest()) - ->setProject($project) - ->setZone($zone); + $request = (new ListDiskTypesRequest())->setProject($project)->setZone($zone); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -347,8 +350,7 @@ public function aggregatedListAsyncTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListDiskTypesRequest()) - ->setProject($project); + $request = (new AggregatedListDiskTypesRequest())->setProject($project); $response = $gapicClient->aggregatedListAsync($request)->wait(); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); diff --git a/Compute/tests/Unit/V1/Client/DisksClientTest.php b/Compute/tests/Unit/V1/Client/DisksClientTest.php index 3f2b22097a89..87e715b54789 100644 --- a/Compute/tests/Unit/V1/Client/DisksClientTest.php +++ b/Compute/tests/Unit/V1/Client/DisksClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return DisksClient */ @@ -194,12 +196,15 @@ public function addResourcePoliciesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $disk = 'disk3083677'; @@ -256,8 +261,7 @@ public function aggregatedListTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListDisksRequest()) - ->setProject($project); + $request = (new AggregatedListDisksRequest())->setProject($project); $response = $gapicClient->aggregatedList($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -286,17 +290,19 @@ public function aggregatedListExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListDisksRequest()) - ->setProject($project); + $request = (new AggregatedListDisksRequest())->setProject($project); try { $gapicClient->aggregatedList($request); // If the $gapicClient method call did not throw, fail the test @@ -402,12 +408,15 @@ public function bulkInsertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $bulkInsertDiskResourceResource = new BulkInsertDiskResource(); @@ -529,12 +538,15 @@ public function bulkSetLabelsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $bulkZoneSetLabelsRequestResource = new BulkZoneSetLabelsRequest(); @@ -660,12 +672,15 @@ public function createSnapshotExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $disk = 'disk3083677'; @@ -789,12 +804,15 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $disk = 'disk3083677'; @@ -942,12 +960,15 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $disk = 'disk3083677'; @@ -1022,12 +1043,15 @@ 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 $project = 'project-309310695'; @@ -1142,12 +1166,15 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $diskResource = new Disk(); @@ -1191,9 +1218,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new Disk(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new DiskList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -1204,9 +1229,7 @@ public function listTest() // Mock request $project = 'project-309310695'; $zone = 'zone3744684'; - $request = (new ListDisksRequest()) - ->setProject($project) - ->setZone($zone); + $request = (new ListDisksRequest())->setProject($project)->setZone($zone); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -1235,19 +1258,20 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $zone = 'zone3744684'; - $request = (new ListDisksRequest()) - ->setProject($project) - ->setZone($zone); + $request = (new ListDisksRequest())->setProject($project)->setZone($zone); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -1357,12 +1381,15 @@ public function removeResourcePoliciesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $disk = 'disk3083677'; @@ -1490,12 +1517,15 @@ public function resizeExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $disk = 'disk3083677'; @@ -1583,12 +1613,15 @@ 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 $project = 'project-309310695'; @@ -1709,12 +1742,15 @@ public function setLabelsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -1842,12 +1878,15 @@ public function startAsyncReplicationExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $disk = 'disk3083677'; @@ -1971,12 +2010,15 @@ public function stopAsyncReplicationExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $disk = 'disk3083677'; @@ -2098,12 +2140,15 @@ public function stopGroupAsyncReplicationExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $disksStopGroupAsyncReplicationResourceResource = new DisksStopGroupAsyncReplicationResource(); @@ -2183,12 +2228,15 @@ 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 $project = 'project-309310695'; @@ -2309,12 +2357,15 @@ public function updateExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $disk = 'disk3083677'; diff --git a/Compute/tests/Unit/V1/Client/ExternalVpnGatewaysClientTest.php b/Compute/tests/Unit/V1/Client/ExternalVpnGatewaysClientTest.php index c780d833d525..6555ae9e2b78 100644 --- a/Compute/tests/Unit/V1/Client/ExternalVpnGatewaysClientTest.php +++ b/Compute/tests/Unit/V1/Client/ExternalVpnGatewaysClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return ExternalVpnGatewaysClient */ @@ -160,12 +162,15 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $externalVpnGateway = 'externalVpnGateway-2037585019'; @@ -251,12 +256,15 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $externalVpnGateway = 'externalVpnGateway-2037585019'; @@ -364,12 +372,15 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $externalVpnGatewayResource = new ExternalVpnGateway(); @@ -412,9 +423,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new ExternalVpnGateway(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new ExternalVpnGatewayList(); $expectedResponse->setEtag($etag); $expectedResponse->setId($id); @@ -425,8 +434,7 @@ public function listTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new ListExternalVpnGatewaysRequest()) - ->setProject($project); + $request = (new ListExternalVpnGatewaysRequest())->setProject($project); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -453,17 +461,19 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new ListExternalVpnGatewaysRequest()) - ->setProject($project); + $request = (new ListExternalVpnGatewaysRequest())->setProject($project); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -568,12 +578,15 @@ public function setLabelsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $globalSetLabelsRequestResource = new GlobalSetLabelsRequest(); @@ -649,12 +662,15 @@ 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 $project = 'project-309310695'; diff --git a/Compute/tests/Unit/V1/Client/FirewallPoliciesClientTest.php b/Compute/tests/Unit/V1/Client/FirewallPoliciesClientTest.php index fc7637cc61a9..6750a3ab8a13 100644 --- a/Compute/tests/Unit/V1/Client/FirewallPoliciesClientTest.php +++ b/Compute/tests/Unit/V1/Client/FirewallPoliciesClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return FirewallPoliciesClient */ @@ -175,12 +177,15 @@ public function addAssociationExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $firewallPolicy = 'firewallPolicy1035044177'; @@ -294,12 +299,15 @@ public function addRuleExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $firewallPolicy = 'firewallPolicy1035044177'; @@ -354,8 +362,7 @@ public function cloneRulesTest() $operationsTransport->addResponse($completeOperation); // Mock request $firewallPolicy = 'firewallPolicy1035044177'; - $request = (new CloneRulesFirewallPolicyRequest()) - ->setFirewallPolicy($firewallPolicy); + $request = (new CloneRulesFirewallPolicyRequest())->setFirewallPolicy($firewallPolicy); $response = $gapicClient->cloneRules($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); @@ -409,17 +416,19 @@ public function cloneRulesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $firewallPolicy = 'firewallPolicy1035044177'; - $request = (new CloneRulesFirewallPolicyRequest()) - ->setFirewallPolicy($firewallPolicy); + $request = (new CloneRulesFirewallPolicyRequest())->setFirewallPolicy($firewallPolicy); $response = $gapicClient->cloneRules($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -467,8 +476,7 @@ public function deleteTest() $operationsTransport->addResponse($completeOperation); // Mock request $firewallPolicy = 'firewallPolicy1035044177'; - $request = (new DeleteFirewallPolicyRequest()) - ->setFirewallPolicy($firewallPolicy); + $request = (new DeleteFirewallPolicyRequest())->setFirewallPolicy($firewallPolicy); $response = $gapicClient->delete($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); @@ -522,17 +530,19 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $firewallPolicy = 'firewallPolicy1035044177'; - $request = (new DeleteFirewallPolicyRequest()) - ->setFirewallPolicy($firewallPolicy); + $request = (new DeleteFirewallPolicyRequest())->setFirewallPolicy($firewallPolicy); $response = $gapicClient->delete($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -592,8 +602,7 @@ public function getTest() $transport->addResponse($expectedResponse); // Mock request $firewallPolicy = 'firewallPolicy1035044177'; - $request = (new GetFirewallPolicyRequest()) - ->setFirewallPolicy($firewallPolicy); + $request = (new GetFirewallPolicyRequest())->setFirewallPolicy($firewallPolicy); $response = $gapicClient->get($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -617,17 +626,19 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $firewallPolicy = 'firewallPolicy1035044177'; - $request = (new GetFirewallPolicyRequest()) - ->setFirewallPolicy($firewallPolicy); + $request = (new GetFirewallPolicyRequest())->setFirewallPolicy($firewallPolicy); try { $gapicClient->get($request); // If the $gapicClient method call did not throw, fail the test @@ -664,8 +675,7 @@ public function getAssociationTest() $transport->addResponse($expectedResponse); // Mock request $firewallPolicy = 'firewallPolicy1035044177'; - $request = (new GetAssociationFirewallPolicyRequest()) - ->setFirewallPolicy($firewallPolicy); + $request = (new GetAssociationFirewallPolicyRequest())->setFirewallPolicy($firewallPolicy); $response = $gapicClient->getAssociation($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -689,17 +699,19 @@ public function getAssociationExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $firewallPolicy = 'firewallPolicy1035044177'; - $request = (new GetAssociationFirewallPolicyRequest()) - ->setFirewallPolicy($firewallPolicy); + $request = (new GetAssociationFirewallPolicyRequest())->setFirewallPolicy($firewallPolicy); try { $gapicClient->getAssociation($request); // If the $gapicClient method call did not throw, fail the test @@ -732,8 +744,7 @@ public function getIamPolicyTest() $transport->addResponse($expectedResponse); // Mock request $resource = 'resource-341064690'; - $request = (new GetIamPolicyFirewallPolicyRequest()) - ->setResource($resource); + $request = (new GetIamPolicyFirewallPolicyRequest())->setResource($resource); $response = $gapicClient->getIamPolicy($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -757,17 +768,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 GetIamPolicyFirewallPolicyRequest()) - ->setResource($resource); + $request = (new GetIamPolicyFirewallPolicyRequest())->setResource($resource); try { $gapicClient->getIamPolicy($request); // If the $gapicClient method call did not throw, fail the test @@ -816,8 +829,7 @@ public function getRuleTest() $transport->addResponse($expectedResponse); // Mock request $firewallPolicy = 'firewallPolicy1035044177'; - $request = (new GetRuleFirewallPolicyRequest()) - ->setFirewallPolicy($firewallPolicy); + $request = (new GetRuleFirewallPolicyRequest())->setFirewallPolicy($firewallPolicy); $response = $gapicClient->getRule($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -841,17 +853,19 @@ public function getRuleExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $firewallPolicy = 'firewallPolicy1035044177'; - $request = (new GetRuleFirewallPolicyRequest()) - ->setFirewallPolicy($firewallPolicy); + $request = (new GetRuleFirewallPolicyRequest())->setFirewallPolicy($firewallPolicy); try { $gapicClient->getRule($request); // If the $gapicClient method call did not throw, fail the test @@ -951,12 +965,15 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $firewallPolicyResource = new FirewallPolicy(); @@ -997,9 +1014,7 @@ public function listTest() $kind = 'kind3292052'; $nextPageToken = ''; $itemsElement = new FirewallPolicy(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new FirewallPolicyList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -1031,12 +1046,15 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], 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 ListFirewallPoliciesRequest(); try { @@ -1087,12 +1105,15 @@ public function listAssociationsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], 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 ListAssociationsFirewallPolicyRequest(); try { @@ -1136,9 +1157,7 @@ public function moveTest() // Mock request $firewallPolicy = 'firewallPolicy1035044177'; $parentId = 'parentId2070327504'; - $request = (new MoveFirewallPolicyRequest()) - ->setFirewallPolicy($firewallPolicy) - ->setParentId($parentId); + $request = (new MoveFirewallPolicyRequest())->setFirewallPolicy($firewallPolicy)->setParentId($parentId); $response = $gapicClient->move($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); @@ -1194,19 +1213,20 @@ public function moveExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $firewallPolicy = 'firewallPolicy1035044177'; $parentId = 'parentId2070327504'; - $request = (new MoveFirewallPolicyRequest()) - ->setFirewallPolicy($firewallPolicy) - ->setParentId($parentId); + $request = (new MoveFirewallPolicyRequest())->setFirewallPolicy($firewallPolicy)->setParentId($parentId); $response = $gapicClient->move($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1313,12 +1333,15 @@ public function patchExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $firewallPolicy = 'firewallPolicy1035044177'; @@ -1432,12 +1455,15 @@ public function patchRuleExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $firewallPolicy = 'firewallPolicy1035044177'; @@ -1492,8 +1518,7 @@ public function removeAssociationTest() $operationsTransport->addResponse($completeOperation); // Mock request $firewallPolicy = 'firewallPolicy1035044177'; - $request = (new RemoveAssociationFirewallPolicyRequest()) - ->setFirewallPolicy($firewallPolicy); + $request = (new RemoveAssociationFirewallPolicyRequest())->setFirewallPolicy($firewallPolicy); $response = $gapicClient->removeAssociation($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); @@ -1547,17 +1572,19 @@ public function removeAssociationExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $firewallPolicy = 'firewallPolicy1035044177'; - $request = (new RemoveAssociationFirewallPolicyRequest()) - ->setFirewallPolicy($firewallPolicy); + $request = (new RemoveAssociationFirewallPolicyRequest())->setFirewallPolicy($firewallPolicy); $response = $gapicClient->removeAssociation($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1605,8 +1632,7 @@ public function removeRuleTest() $operationsTransport->addResponse($completeOperation); // Mock request $firewallPolicy = 'firewallPolicy1035044177'; - $request = (new RemoveRuleFirewallPolicyRequest()) - ->setFirewallPolicy($firewallPolicy); + $request = (new RemoveRuleFirewallPolicyRequest())->setFirewallPolicy($firewallPolicy); $response = $gapicClient->removeRule($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); @@ -1660,17 +1686,19 @@ public function removeRuleExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $firewallPolicy = 'firewallPolicy1035044177'; - $request = (new RemoveRuleFirewallPolicyRequest()) - ->setFirewallPolicy($firewallPolicy); + $request = (new RemoveRuleFirewallPolicyRequest())->setFirewallPolicy($firewallPolicy); $response = $gapicClient->removeRule($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1739,12 +1767,15 @@ 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 $globalOrganizationSetPolicyRequestResource = new GlobalOrganizationSetPolicyRequest(); @@ -1807,12 +1838,15 @@ 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'; diff --git a/Compute/tests/Unit/V1/Client/FirewallsClientTest.php b/Compute/tests/Unit/V1/Client/FirewallsClientTest.php index 6f0c48f9432f..93cbaf191fbf 100644 --- a/Compute/tests/Unit/V1/Client/FirewallsClientTest.php +++ b/Compute/tests/Unit/V1/Client/FirewallsClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return FirewallsClient */ @@ -98,9 +100,7 @@ public function deleteTest() // Mock request $firewall = 'firewall-562725632'; $project = 'project-309310695'; - $request = (new DeleteFirewallRequest()) - ->setFirewall($firewall) - ->setProject($project); + $request = (new DeleteFirewallRequest())->setFirewall($firewall)->setProject($project); $response = $gapicClient->delete($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); @@ -157,19 +157,20 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $firewall = 'firewall-562725632'; $project = 'project-309310695'; - $request = (new DeleteFirewallRequest()) - ->setFirewall($firewall) - ->setProject($project); + $request = (new DeleteFirewallRequest())->setFirewall($firewall)->setProject($project); $response = $gapicClient->delete($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -224,9 +225,7 @@ public function getTest() // Mock request $firewall = 'firewall-562725632'; $project = 'project-309310695'; - $request = (new GetFirewallRequest()) - ->setFirewall($firewall) - ->setProject($project); + $request = (new GetFirewallRequest())->setFirewall($firewall)->setProject($project); $response = $gapicClient->get($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -252,19 +251,20 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $firewall = 'firewall-562725632'; $project = 'project-309310695'; - $request = (new GetFirewallRequest()) - ->setFirewall($firewall) - ->setProject($project); + $request = (new GetFirewallRequest())->setFirewall($firewall)->setProject($project); try { $gapicClient->get($request); // If the $gapicClient method call did not throw, fail the test @@ -306,9 +306,7 @@ public function insertTest() // Mock request $firewallResource = new Firewall(); $project = 'project-309310695'; - $request = (new InsertFirewallRequest()) - ->setFirewallResource($firewallResource) - ->setProject($project); + $request = (new InsertFirewallRequest())->setFirewallResource($firewallResource)->setProject($project); $response = $gapicClient->insert($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); @@ -365,19 +363,20 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $firewallResource = new Firewall(); $project = 'project-309310695'; - $request = (new InsertFirewallRequest()) - ->setFirewallResource($firewallResource) - ->setProject($project); + $request = (new InsertFirewallRequest())->setFirewallResource($firewallResource)->setProject($project); $response = $gapicClient->insert($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -412,9 +411,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new Firewall(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new FirewallList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -424,8 +421,7 @@ public function listTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new ListFirewallsRequest()) - ->setProject($project); + $request = (new ListFirewallsRequest())->setProject($project); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -452,17 +448,19 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new ListFirewallsRequest()) - ->setProject($project); + $request = (new ListFirewallsRequest())->setProject($project); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -567,12 +565,15 @@ public function patchExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $firewall = 'firewall-562725632'; @@ -693,12 +694,15 @@ public function updateExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $firewall = 'firewall-562725632'; @@ -756,9 +760,7 @@ public function deleteAsyncTest() // Mock request $firewall = 'firewall-562725632'; $project = 'project-309310695'; - $request = (new DeleteFirewallRequest()) - ->setFirewall($firewall) - ->setProject($project); + $request = (new DeleteFirewallRequest())->setFirewall($firewall)->setProject($project); $response = $gapicClient->delete($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); diff --git a/Compute/tests/Unit/V1/Client/ForwardingRulesClientTest.php b/Compute/tests/Unit/V1/Client/ForwardingRulesClientTest.php index 788c8306f181..19f280a78947 100644 --- a/Compute/tests/Unit/V1/Client/ForwardingRulesClientTest.php +++ b/Compute/tests/Unit/V1/Client/ForwardingRulesClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return ForwardingRulesClient */ @@ -101,8 +103,7 @@ public function aggregatedListTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListForwardingRulesRequest()) - ->setProject($project); + $request = (new AggregatedListForwardingRulesRequest())->setProject($project); $response = $gapicClient->aggregatedList($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -131,17 +132,19 @@ public function aggregatedListExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListForwardingRulesRequest()) - ->setProject($project); + $request = (new AggregatedListForwardingRulesRequest())->setProject($project); try { $gapicClient->aggregatedList($request); // If the $gapicClient method call did not throw, fail the test @@ -247,12 +250,15 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $forwardingRule = 'forwardingRule-1340648706'; @@ -335,7 +341,9 @@ public function getTest() $expectedResponse->setCreationTimestamp($creationTimestamp); $expectedResponse->setDescription($description); $expectedResponse->setExternalManagedBackendBucketMigrationState($externalManagedBackendBucketMigrationState); - $expectedResponse->setExternalManagedBackendBucketMigrationTestingPercentage($externalManagedBackendBucketMigrationTestingPercentage); + $expectedResponse->setExternalManagedBackendBucketMigrationTestingPercentage( + $externalManagedBackendBucketMigrationTestingPercentage + ); $expectedResponse->setFingerprint($fingerprint); $expectedResponse->setId($id); $expectedResponse->setIpCollection($ipCollection); @@ -394,12 +402,15 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $forwardingRule = 'forwardingRule-1340648706'; @@ -514,12 +525,15 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $forwardingRuleResource = new ForwardingRule(); @@ -563,9 +577,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new ForwardingRule(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new ForwardingRuleList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -576,9 +588,7 @@ public function listTest() // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListForwardingRulesRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListForwardingRulesRequest())->setProject($project)->setRegion($region); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -607,19 +617,20 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListForwardingRulesRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListForwardingRulesRequest())->setProject($project)->setRegion($region); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -729,12 +740,15 @@ public function patchExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $forwardingRule = 'forwardingRule-1340648706'; @@ -862,12 +876,15 @@ public function setLabelsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -995,12 +1012,15 @@ public function setTargetExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $forwardingRule = 'forwardingRule-1340648706'; @@ -1057,8 +1077,7 @@ public function aggregatedListAsyncTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListForwardingRulesRequest()) - ->setProject($project); + $request = (new AggregatedListForwardingRulesRequest())->setProject($project); $response = $gapicClient->aggregatedListAsync($request)->wait(); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); diff --git a/Compute/tests/Unit/V1/Client/GlobalAddressesClientTest.php b/Compute/tests/Unit/V1/Client/GlobalAddressesClientTest.php index eb50c411e197..7a585f6ee37b 100644 --- a/Compute/tests/Unit/V1/Client/GlobalAddressesClientTest.php +++ b/Compute/tests/Unit/V1/Client/GlobalAddressesClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return GlobalAddressesClient */ @@ -100,9 +102,7 @@ public function deleteTest() // Mock request $address = 'address-1147692044'; $project = 'project-309310695'; - $request = (new DeleteGlobalAddressRequest()) - ->setAddress($address) - ->setProject($project); + $request = (new DeleteGlobalAddressRequest())->setAddress($address)->setProject($project); $response = $gapicClient->delete($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); @@ -159,19 +159,20 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $address = 'address-1147692044'; $project = 'project-309310695'; - $request = (new DeleteGlobalAddressRequest()) - ->setAddress($address) - ->setProject($project); + $request = (new DeleteGlobalAddressRequest())->setAddress($address)->setProject($project); $response = $gapicClient->delete($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -242,9 +243,7 @@ public function getTest() // Mock request $address = 'address-1147692044'; $project = 'project-309310695'; - $request = (new GetGlobalAddressRequest()) - ->setAddress($address) - ->setProject($project); + $request = (new GetGlobalAddressRequest())->setAddress($address)->setProject($project); $response = $gapicClient->get($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -270,19 +269,20 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $address = 'address-1147692044'; $project = 'project-309310695'; - $request = (new GetGlobalAddressRequest()) - ->setAddress($address) - ->setProject($project); + $request = (new GetGlobalAddressRequest())->setAddress($address)->setProject($project); try { $gapicClient->get($request); // If the $gapicClient method call did not throw, fail the test @@ -324,9 +324,7 @@ public function insertTest() // Mock request $addressResource = new Address(); $project = 'project-309310695'; - $request = (new InsertGlobalAddressRequest()) - ->setAddressResource($addressResource) - ->setProject($project); + $request = (new InsertGlobalAddressRequest())->setAddressResource($addressResource)->setProject($project); $response = $gapicClient->insert($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); @@ -383,19 +381,20 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $addressResource = new Address(); $project = 'project-309310695'; - $request = (new InsertGlobalAddressRequest()) - ->setAddressResource($addressResource) - ->setProject($project); + $request = (new InsertGlobalAddressRequest())->setAddressResource($addressResource)->setProject($project); $response = $gapicClient->insert($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -430,9 +429,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new Address(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new AddressList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -442,8 +439,7 @@ public function listTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new ListGlobalAddressesRequest()) - ->setProject($project); + $request = (new ListGlobalAddressesRequest())->setProject($project); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -470,17 +466,19 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new ListGlobalAddressesRequest()) - ->setProject($project); + $request = (new ListGlobalAddressesRequest())->setProject($project); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -585,12 +583,15 @@ public function moveExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $address = 'address-1147692044'; @@ -711,12 +712,15 @@ public function setLabelsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $globalSetLabelsRequestResource = new GlobalSetLabelsRequest(); @@ -774,9 +778,7 @@ public function deleteAsyncTest() // Mock request $address = 'address-1147692044'; $project = 'project-309310695'; - $request = (new DeleteGlobalAddressRequest()) - ->setAddress($address) - ->setProject($project); + $request = (new DeleteGlobalAddressRequest())->setAddress($address)->setProject($project); $response = $gapicClient->delete($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); diff --git a/Compute/tests/Unit/V1/Client/GlobalForwardingRulesClientTest.php b/Compute/tests/Unit/V1/Client/GlobalForwardingRulesClientTest.php index e32ab3891880..90ae271b7cf4 100644 --- a/Compute/tests/Unit/V1/Client/GlobalForwardingRulesClientTest.php +++ b/Compute/tests/Unit/V1/Client/GlobalForwardingRulesClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return GlobalForwardingRulesClient */ @@ -101,9 +103,7 @@ public function deleteTest() // Mock request $forwardingRule = 'forwardingRule-1340648706'; $project = 'project-309310695'; - $request = (new DeleteGlobalForwardingRuleRequest()) - ->setForwardingRule($forwardingRule) - ->setProject($project); + $request = (new DeleteGlobalForwardingRuleRequest())->setForwardingRule($forwardingRule)->setProject($project); $response = $gapicClient->delete($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); @@ -160,19 +160,20 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $forwardingRule = 'forwardingRule-1340648706'; $project = 'project-309310695'; - $request = (new DeleteGlobalForwardingRuleRequest()) - ->setForwardingRule($forwardingRule) - ->setProject($project); + $request = (new DeleteGlobalForwardingRuleRequest())->setForwardingRule($forwardingRule)->setProject($project); $response = $gapicClient->delete($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -246,7 +247,9 @@ public function getTest() $expectedResponse->setCreationTimestamp($creationTimestamp); $expectedResponse->setDescription($description); $expectedResponse->setExternalManagedBackendBucketMigrationState($externalManagedBackendBucketMigrationState); - $expectedResponse->setExternalManagedBackendBucketMigrationTestingPercentage($externalManagedBackendBucketMigrationTestingPercentage); + $expectedResponse->setExternalManagedBackendBucketMigrationTestingPercentage( + $externalManagedBackendBucketMigrationTestingPercentage + ); $expectedResponse->setFingerprint($fingerprint); $expectedResponse->setId($id); $expectedResponse->setIpCollection($ipCollection); @@ -273,9 +276,7 @@ public function getTest() // Mock request $forwardingRule = 'forwardingRule-1340648706'; $project = 'project-309310695'; - $request = (new GetGlobalForwardingRuleRequest()) - ->setForwardingRule($forwardingRule) - ->setProject($project); + $request = (new GetGlobalForwardingRuleRequest())->setForwardingRule($forwardingRule)->setProject($project); $response = $gapicClient->get($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -301,19 +302,20 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $forwardingRule = 'forwardingRule-1340648706'; $project = 'project-309310695'; - $request = (new GetGlobalForwardingRuleRequest()) - ->setForwardingRule($forwardingRule) - ->setProject($project); + $request = (new GetGlobalForwardingRuleRequest())->setForwardingRule($forwardingRule)->setProject($project); try { $gapicClient->get($request); // If the $gapicClient method call did not throw, fail the test @@ -414,12 +416,15 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $forwardingRuleResource = new ForwardingRule(); @@ -461,9 +466,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new ForwardingRule(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new ForwardingRuleList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -473,8 +476,7 @@ public function listTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new ListGlobalForwardingRulesRequest()) - ->setProject($project); + $request = (new ListGlobalForwardingRulesRequest())->setProject($project); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -501,17 +503,19 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new ListGlobalForwardingRulesRequest()) - ->setProject($project); + $request = (new ListGlobalForwardingRulesRequest())->setProject($project); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -616,12 +620,15 @@ public function patchExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $forwardingRule = 'forwardingRule-1340648706'; @@ -742,12 +749,15 @@ public function setLabelsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $globalSetLabelsRequestResource = new GlobalSetLabelsRequest(); @@ -868,12 +878,15 @@ public function setTargetExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $forwardingRule = 'forwardingRule-1340648706'; @@ -931,9 +944,7 @@ public function deleteAsyncTest() // Mock request $forwardingRule = 'forwardingRule-1340648706'; $project = 'project-309310695'; - $request = (new DeleteGlobalForwardingRuleRequest()) - ->setForwardingRule($forwardingRule) - ->setProject($project); + $request = (new DeleteGlobalForwardingRuleRequest())->setForwardingRule($forwardingRule)->setProject($project); $response = $gapicClient->delete($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); diff --git a/Compute/tests/Unit/V1/Client/GlobalNetworkEndpointGroupsClientTest.php b/Compute/tests/Unit/V1/Client/GlobalNetworkEndpointGroupsClientTest.php index 5a5775a2443a..fac2cc2b70c0 100644 --- a/Compute/tests/Unit/V1/Client/GlobalNetworkEndpointGroupsClientTest.php +++ b/Compute/tests/Unit/V1/Client/GlobalNetworkEndpointGroupsClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return GlobalNetworkEndpointGroupsClient */ @@ -105,7 +107,9 @@ public function attachNetworkEndpointsTest() $networkEndpointGroup = 'networkEndpointGroup-639834746'; $project = 'project-309310695'; $request = (new AttachNetworkEndpointsGlobalNetworkEndpointGroupRequest()) - ->setGlobalNetworkEndpointGroupsAttachEndpointsRequestResource($globalNetworkEndpointGroupsAttachEndpointsRequestResource) + ->setGlobalNetworkEndpointGroupsAttachEndpointsRequestResource( + $globalNetworkEndpointGroupsAttachEndpointsRequestResource + ) ->setNetworkEndpointGroup($networkEndpointGroup) ->setProject($project); $response = $gapicClient->attachNetworkEndpoints($request); @@ -116,7 +120,10 @@ public function attachNetworkEndpointsTest() $this->assertSame(0, count($operationsRequestsEmpty)); $actualApiFuncCall = $apiRequests[0]->getFuncCall(); $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.GlobalNetworkEndpointGroups/AttachNetworkEndpoints', $actualApiFuncCall); + $this->assertSame( + '/google.cloud.compute.v1.GlobalNetworkEndpointGroups/AttachNetworkEndpoints', + $actualApiFuncCall + ); $actualValue = $actualApiRequestObject->getGlobalNetworkEndpointGroupsAttachEndpointsRequestResource(); $this->assertProtobufEquals($globalNetworkEndpointGroupsAttachEndpointsRequestResource, $actualValue); $actualValue = $actualApiRequestObject->getNetworkEndpointGroup(); @@ -166,19 +173,24 @@ public function attachNetworkEndpointsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $globalNetworkEndpointGroupsAttachEndpointsRequestResource = new GlobalNetworkEndpointGroupsAttachEndpointsRequest(); $networkEndpointGroup = 'networkEndpointGroup-639834746'; $project = 'project-309310695'; $request = (new AttachNetworkEndpointsGlobalNetworkEndpointGroupRequest()) - ->setGlobalNetworkEndpointGroupsAttachEndpointsRequestResource($globalNetworkEndpointGroupsAttachEndpointsRequestResource) + ->setGlobalNetworkEndpointGroupsAttachEndpointsRequestResource( + $globalNetworkEndpointGroupsAttachEndpointsRequestResource + ) ->setNetworkEndpointGroup($networkEndpointGroup) ->setProject($project); $response = $gapicClient->attachNetworkEndpoints($request); @@ -288,12 +300,15 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $networkEndpointGroup = 'networkEndpointGroup-639834746'; @@ -351,7 +366,9 @@ public function detachNetworkEndpointsTest() $networkEndpointGroup = 'networkEndpointGroup-639834746'; $project = 'project-309310695'; $request = (new DetachNetworkEndpointsGlobalNetworkEndpointGroupRequest()) - ->setGlobalNetworkEndpointGroupsDetachEndpointsRequestResource($globalNetworkEndpointGroupsDetachEndpointsRequestResource) + ->setGlobalNetworkEndpointGroupsDetachEndpointsRequestResource( + $globalNetworkEndpointGroupsDetachEndpointsRequestResource + ) ->setNetworkEndpointGroup($networkEndpointGroup) ->setProject($project); $response = $gapicClient->detachNetworkEndpoints($request); @@ -362,7 +379,10 @@ public function detachNetworkEndpointsTest() $this->assertSame(0, count($operationsRequestsEmpty)); $actualApiFuncCall = $apiRequests[0]->getFuncCall(); $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.GlobalNetworkEndpointGroups/DetachNetworkEndpoints', $actualApiFuncCall); + $this->assertSame( + '/google.cloud.compute.v1.GlobalNetworkEndpointGroups/DetachNetworkEndpoints', + $actualApiFuncCall + ); $actualValue = $actualApiRequestObject->getGlobalNetworkEndpointGroupsDetachEndpointsRequestResource(); $this->assertProtobufEquals($globalNetworkEndpointGroupsDetachEndpointsRequestResource, $actualValue); $actualValue = $actualApiRequestObject->getNetworkEndpointGroup(); @@ -412,19 +432,24 @@ public function detachNetworkEndpointsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $globalNetworkEndpointGroupsDetachEndpointsRequestResource = new GlobalNetworkEndpointGroupsDetachEndpointsRequest(); $networkEndpointGroup = 'networkEndpointGroup-639834746'; $project = 'project-309310695'; $request = (new DetachNetworkEndpointsGlobalNetworkEndpointGroupRequest()) - ->setGlobalNetworkEndpointGroupsDetachEndpointsRequestResource($globalNetworkEndpointGroupsDetachEndpointsRequestResource) + ->setGlobalNetworkEndpointGroupsDetachEndpointsRequestResource( + $globalNetworkEndpointGroupsDetachEndpointsRequestResource + ) ->setNetworkEndpointGroup($networkEndpointGroup) ->setProject($project); $response = $gapicClient->detachNetworkEndpoints($request); @@ -517,12 +542,15 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $networkEndpointGroup = 'networkEndpointGroup-639834746'; @@ -630,12 +658,15 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $networkEndpointGroupResource = new NetworkEndpointGroup(); @@ -677,9 +708,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new NetworkEndpointGroup(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new NetworkEndpointGroupList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -689,8 +718,7 @@ public function listTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new ListGlobalNetworkEndpointGroupsRequest()) - ->setProject($project); + $request = (new ListGlobalNetworkEndpointGroupsRequest())->setProject($project); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -717,17 +745,19 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new ListGlobalNetworkEndpointGroupsRequest()) - ->setProject($project); + $request = (new ListGlobalNetworkEndpointGroupsRequest())->setProject($project); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -754,9 +784,7 @@ public function listNetworkEndpointsTest() $kind = 'kind3292052'; $nextPageToken = ''; $itemsElement = new NetworkEndpointWithHealthStatus(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new NetworkEndpointGroupsListNetworkEndpoints(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -797,12 +825,15 @@ public function listNetworkEndpointsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $networkEndpointGroup = 'networkEndpointGroup-639834746'; @@ -853,7 +884,9 @@ public function attachNetworkEndpointsAsyncTest() $networkEndpointGroup = 'networkEndpointGroup-639834746'; $project = 'project-309310695'; $request = (new AttachNetworkEndpointsGlobalNetworkEndpointGroupRequest()) - ->setGlobalNetworkEndpointGroupsAttachEndpointsRequestResource($globalNetworkEndpointGroupsAttachEndpointsRequestResource) + ->setGlobalNetworkEndpointGroupsAttachEndpointsRequestResource( + $globalNetworkEndpointGroupsAttachEndpointsRequestResource + ) ->setNetworkEndpointGroup($networkEndpointGroup) ->setProject($project); $response = $gapicClient->attachNetworkEndpoints($request); @@ -864,7 +897,10 @@ public function attachNetworkEndpointsAsyncTest() $this->assertSame(0, count($operationsRequestsEmpty)); $actualApiFuncCall = $apiRequests[0]->getFuncCall(); $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.GlobalNetworkEndpointGroups/AttachNetworkEndpoints', $actualApiFuncCall); + $this->assertSame( + '/google.cloud.compute.v1.GlobalNetworkEndpointGroups/AttachNetworkEndpoints', + $actualApiFuncCall + ); $actualValue = $actualApiRequestObject->getGlobalNetworkEndpointGroupsAttachEndpointsRequestResource(); $this->assertProtobufEquals($globalNetworkEndpointGroupsAttachEndpointsRequestResource, $actualValue); $actualValue = $actualApiRequestObject->getNetworkEndpointGroup(); diff --git a/Compute/tests/Unit/V1/Client/GlobalOperationsClientTest.php b/Compute/tests/Unit/V1/Client/GlobalOperationsClientTest.php index 6b6b4c07a23d..304624bf698f 100644 --- a/Compute/tests/Unit/V1/Client/GlobalOperationsClientTest.php +++ b/Compute/tests/Unit/V1/Client/GlobalOperationsClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return GlobalOperationsClient */ @@ -93,8 +95,7 @@ public function aggregatedListTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListGlobalOperationsRequest()) - ->setProject($project); + $request = (new AggregatedListGlobalOperationsRequest())->setProject($project); $response = $gapicClient->aggregatedList($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -123,17 +124,19 @@ public function aggregatedListExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListGlobalOperationsRequest()) - ->setProject($project); + $request = (new AggregatedListGlobalOperationsRequest())->setProject($project); try { $gapicClient->aggregatedList($request); // If the $gapicClient method call did not throw, fail the test @@ -161,9 +164,7 @@ public function deleteTest() // Mock request $operation = 'operation1662702951'; $project = 'project-309310695'; - $request = (new DeleteGlobalOperationRequest()) - ->setOperation($operation) - ->setProject($project); + $request = (new DeleteGlobalOperationRequest())->setOperation($operation)->setProject($project); $response = $gapicClient->delete($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -189,19 +190,20 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $operation = 'operation1662702951'; $project = 'project-309310695'; - $request = (new DeleteGlobalOperationRequest()) - ->setOperation($operation) - ->setProject($project); + $request = (new DeleteGlobalOperationRequest())->setOperation($operation)->setProject($project); try { $gapicClient->delete($request); // If the $gapicClient method call did not throw, fail the test @@ -271,9 +273,7 @@ public function getTest() // Mock request $operation = 'operation1662702951'; $project = 'project-309310695'; - $request = (new GetGlobalOperationRequest()) - ->setOperation($operation) - ->setProject($project); + $request = (new GetGlobalOperationRequest())->setOperation($operation)->setProject($project); $response = $gapicClient->get($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -299,19 +299,20 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $operation = 'operation1662702951'; $project = 'project-309310695'; - $request = (new GetGlobalOperationRequest()) - ->setOperation($operation) - ->setProject($project); + $request = (new GetGlobalOperationRequest())->setOperation($operation)->setProject($project); try { $gapicClient->get($request); // If the $gapicClient method call did not throw, fail the test @@ -339,9 +340,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new Operation(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new OperationList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -351,8 +350,7 @@ public function listTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new ListGlobalOperationsRequest()) - ->setProject($project); + $request = (new ListGlobalOperationsRequest())->setProject($project); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -379,17 +377,19 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new ListGlobalOperationsRequest()) - ->setProject($project); + $request = (new ListGlobalOperationsRequest())->setProject($project); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -459,9 +459,7 @@ public function waitTest() // Mock request $operation = 'operation1662702951'; $project = 'project-309310695'; - $request = (new WaitGlobalOperationRequest()) - ->setOperation($operation) - ->setProject($project); + $request = (new WaitGlobalOperationRequest())->setOperation($operation)->setProject($project); $response = $gapicClient->wait($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -487,19 +485,20 @@ public function waitExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $operation = 'operation1662702951'; $project = 'project-309310695'; - $request = (new WaitGlobalOperationRequest()) - ->setOperation($operation) - ->setProject($project); + $request = (new WaitGlobalOperationRequest())->setOperation($operation)->setProject($project); try { $gapicClient->wait($request); // If the $gapicClient method call did not throw, fail the test @@ -538,8 +537,7 @@ public function aggregatedListAsyncTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListGlobalOperationsRequest()) - ->setProject($project); + $request = (new AggregatedListGlobalOperationsRequest())->setProject($project); $response = $gapicClient->aggregatedListAsync($request)->wait(); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); diff --git a/Compute/tests/Unit/V1/Client/GlobalOrganizationOperationsClientTest.php b/Compute/tests/Unit/V1/Client/GlobalOrganizationOperationsClientTest.php index fd2e925baae1..926dc626b896 100644 --- a/Compute/tests/Unit/V1/Client/GlobalOrganizationOperationsClientTest.php +++ b/Compute/tests/Unit/V1/Client/GlobalOrganizationOperationsClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return GlobalOrganizationOperationsClient */ @@ -77,8 +79,7 @@ public function deleteTest() $transport->addResponse($expectedResponse); // Mock request $operation = 'operation1662702951'; - $request = (new DeleteGlobalOrganizationOperationRequest()) - ->setOperation($operation); + $request = (new DeleteGlobalOrganizationOperationRequest())->setOperation($operation); $response = $gapicClient->delete($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -102,17 +103,19 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $operation = 'operation1662702951'; - $request = (new DeleteGlobalOrganizationOperationRequest()) - ->setOperation($operation); + $request = (new DeleteGlobalOrganizationOperationRequest())->setOperation($operation); try { $gapicClient->delete($request); // If the $gapicClient method call did not throw, fail the test @@ -181,8 +184,7 @@ public function getTest() $transport->addResponse($expectedResponse); // Mock request $operation = 'operation1662702951'; - $request = (new GetGlobalOrganizationOperationRequest()) - ->setOperation($operation); + $request = (new GetGlobalOrganizationOperationRequest())->setOperation($operation); $response = $gapicClient->get($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -206,17 +208,19 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $operation = 'operation1662702951'; - $request = (new GetGlobalOrganizationOperationRequest()) - ->setOperation($operation); + $request = (new GetGlobalOrganizationOperationRequest())->setOperation($operation); try { $gapicClient->get($request); // If the $gapicClient method call did not throw, fail the test @@ -244,9 +248,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new Operation(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new OperationList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -279,12 +281,15 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], 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 ListGlobalOrganizationOperationsRequest(); try { @@ -313,8 +318,7 @@ public function deleteAsyncTest() $transport->addResponse($expectedResponse); // Mock request $operation = 'operation1662702951'; - $request = (new DeleteGlobalOrganizationOperationRequest()) - ->setOperation($operation); + $request = (new DeleteGlobalOrganizationOperationRequest())->setOperation($operation); $response = $gapicClient->deleteAsync($request)->wait(); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); diff --git a/Compute/tests/Unit/V1/Client/GlobalPublicDelegatedPrefixesClientTest.php b/Compute/tests/Unit/V1/Client/GlobalPublicDelegatedPrefixesClientTest.php index dcd3306f1afe..12fa9f52c42d 100644 --- a/Compute/tests/Unit/V1/Client/GlobalPublicDelegatedPrefixesClientTest.php +++ b/Compute/tests/Unit/V1/Client/GlobalPublicDelegatedPrefixesClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return GlobalPublicDelegatedPrefixesClient */ @@ -156,12 +158,15 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -261,12 +266,15 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; @@ -374,12 +382,15 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -421,9 +432,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new PublicDelegatedPrefix(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new PublicDelegatedPrefixList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -433,8 +442,7 @@ public function listTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new ListGlobalPublicDelegatedPrefixesRequest()) - ->setProject($project); + $request = (new ListGlobalPublicDelegatedPrefixesRequest())->setProject($project); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -461,17 +469,19 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new ListGlobalPublicDelegatedPrefixesRequest()) - ->setProject($project); + $request = (new ListGlobalPublicDelegatedPrefixesRequest())->setProject($project); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -576,12 +586,15 @@ public function patchExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; diff --git a/Compute/tests/Unit/V1/Client/HealthChecksClientTest.php b/Compute/tests/Unit/V1/Client/HealthChecksClientTest.php index 36418008bedb..fcdd82e7a767 100644 --- a/Compute/tests/Unit/V1/Client/HealthChecksClientTest.php +++ b/Compute/tests/Unit/V1/Client/HealthChecksClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return HealthChecksClient */ @@ -98,8 +100,7 @@ public function aggregatedListTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListHealthChecksRequest()) - ->setProject($project); + $request = (new AggregatedListHealthChecksRequest())->setProject($project); $response = $gapicClient->aggregatedList($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -128,17 +129,19 @@ public function aggregatedListExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListHealthChecksRequest()) - ->setProject($project); + $request = (new AggregatedListHealthChecksRequest())->setProject($project); try { $gapicClient->aggregatedList($request); // If the $gapicClient method call did not throw, fail the test @@ -180,9 +183,7 @@ public function deleteTest() // Mock request $healthCheck = 'healthCheck845747557'; $project = 'project-309310695'; - $request = (new DeleteHealthCheckRequest()) - ->setHealthCheck($healthCheck) - ->setProject($project); + $request = (new DeleteHealthCheckRequest())->setHealthCheck($healthCheck)->setProject($project); $response = $gapicClient->delete($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); @@ -239,19 +240,20 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $healthCheck = 'healthCheck845747557'; $project = 'project-309310695'; - $request = (new DeleteHealthCheckRequest()) - ->setHealthCheck($healthCheck) - ->setProject($project); + $request = (new DeleteHealthCheckRequest())->setHealthCheck($healthCheck)->setProject($project); $response = $gapicClient->delete($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -310,9 +312,7 @@ public function getTest() // Mock request $healthCheck = 'healthCheck845747557'; $project = 'project-309310695'; - $request = (new GetHealthCheckRequest()) - ->setHealthCheck($healthCheck) - ->setProject($project); + $request = (new GetHealthCheckRequest())->setHealthCheck($healthCheck)->setProject($project); $response = $gapicClient->get($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -338,19 +338,20 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $healthCheck = 'healthCheck845747557'; $project = 'project-309310695'; - $request = (new GetHealthCheckRequest()) - ->setHealthCheck($healthCheck) - ->setProject($project); + $request = (new GetHealthCheckRequest())->setHealthCheck($healthCheck)->setProject($project); try { $gapicClient->get($request); // If the $gapicClient method call did not throw, fail the test @@ -392,9 +393,7 @@ public function insertTest() // Mock request $healthCheckResource = new HealthCheck(); $project = 'project-309310695'; - $request = (new InsertHealthCheckRequest()) - ->setHealthCheckResource($healthCheckResource) - ->setProject($project); + $request = (new InsertHealthCheckRequest())->setHealthCheckResource($healthCheckResource)->setProject($project); $response = $gapicClient->insert($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); @@ -451,19 +450,20 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $healthCheckResource = new HealthCheck(); $project = 'project-309310695'; - $request = (new InsertHealthCheckRequest()) - ->setHealthCheckResource($healthCheckResource) - ->setProject($project); + $request = (new InsertHealthCheckRequest())->setHealthCheckResource($healthCheckResource)->setProject($project); $response = $gapicClient->insert($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -498,9 +498,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new HealthCheck(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new HealthCheckList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -510,8 +508,7 @@ public function listTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new ListHealthChecksRequest()) - ->setProject($project); + $request = (new ListHealthChecksRequest())->setProject($project); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -538,17 +535,19 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new ListHealthChecksRequest()) - ->setProject($project); + $request = (new ListHealthChecksRequest())->setProject($project); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -653,12 +652,15 @@ public function patchExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $healthCheck = 'healthCheck845747557'; @@ -779,12 +781,15 @@ public function updateExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $healthCheck = 'healthCheck845747557'; @@ -839,8 +844,7 @@ public function aggregatedListAsyncTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListHealthChecksRequest()) - ->setProject($project); + $request = (new AggregatedListHealthChecksRequest())->setProject($project); $response = $gapicClient->aggregatedListAsync($request)->wait(); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); diff --git a/Compute/tests/Unit/V1/Client/ImageFamilyViewsClientTest.php b/Compute/tests/Unit/V1/Client/ImageFamilyViewsClientTest.php index cecdfc200208..578c0850ebac 100644 --- a/Compute/tests/Unit/V1/Client/ImageFamilyViewsClientTest.php +++ b/Compute/tests/Unit/V1/Client/ImageFamilyViewsClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return ImageFamilyViewsClient */ @@ -106,12 +108,15 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $family = 'family-1281860764'; diff --git a/Compute/tests/Unit/V1/Client/ImagesClientTest.php b/Compute/tests/Unit/V1/Client/ImagesClientTest.php index 9ca8fec444ec..e02f71b28021 100644 --- a/Compute/tests/Unit/V1/Client/ImagesClientTest.php +++ b/Compute/tests/Unit/V1/Client/ImagesClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return ImagesClient */ @@ -109,9 +111,7 @@ public function deleteTest() // Mock request $image = 'image100313435'; $project = 'project-309310695'; - $request = (new DeleteImageRequest()) - ->setImage($image) - ->setProject($project); + $request = (new DeleteImageRequest())->setImage($image)->setProject($project); $response = $gapicClient->delete($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); @@ -168,19 +168,20 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $image = 'image100313435'; $project = 'project-309310695'; - $request = (new DeleteImageRequest()) - ->setImage($image) - ->setProject($project); + $request = (new DeleteImageRequest())->setImage($image)->setProject($project); $response = $gapicClient->delete($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -292,12 +293,15 @@ public function deprecateExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $deprecationStatusResource = new DeprecationStatus(); @@ -385,9 +389,7 @@ public function getTest() // Mock request $image = 'image100313435'; $project = 'project-309310695'; - $request = (new GetImageRequest()) - ->setImage($image) - ->setProject($project); + $request = (new GetImageRequest())->setImage($image)->setProject($project); $response = $gapicClient->get($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -413,19 +415,20 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $image = 'image100313435'; $project = 'project-309310695'; - $request = (new GetImageRequest()) - ->setImage($image) - ->setProject($project); + $request = (new GetImageRequest())->setImage($image)->setProject($project); try { $gapicClient->get($request); // If the $gapicClient method call did not throw, fail the test @@ -497,9 +500,7 @@ public function getFromFamilyTest() // Mock request $family = 'family-1281860764'; $project = 'project-309310695'; - $request = (new GetFromFamilyImageRequest()) - ->setFamily($family) - ->setProject($project); + $request = (new GetFromFamilyImageRequest())->setFamily($family)->setProject($project); $response = $gapicClient->getFromFamily($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -525,19 +526,20 @@ public function getFromFamilyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $family = 'family-1281860764'; $project = 'project-309310695'; - $request = (new GetFromFamilyImageRequest()) - ->setFamily($family) - ->setProject($project); + $request = (new GetFromFamilyImageRequest())->setFamily($family)->setProject($project); try { $gapicClient->getFromFamily($request); // If the $gapicClient method call did not throw, fail the test @@ -571,9 +573,7 @@ public function getIamPolicyTest() // Mock request $project = 'project-309310695'; $resource = 'resource-341064690'; - $request = (new GetIamPolicyImageRequest()) - ->setProject($project) - ->setResource($resource); + $request = (new GetIamPolicyImageRequest())->setProject($project)->setResource($resource); $response = $gapicClient->getIamPolicy($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -599,19 +599,20 @@ 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 $project = 'project-309310695'; $resource = 'resource-341064690'; - $request = (new GetIamPolicyImageRequest()) - ->setProject($project) - ->setResource($resource); + $request = (new GetIamPolicyImageRequest())->setProject($project)->setResource($resource); try { $gapicClient->getIamPolicy($request); // If the $gapicClient method call did not throw, fail the test @@ -653,9 +654,7 @@ public function insertTest() // Mock request $imageResource = new Image(); $project = 'project-309310695'; - $request = (new InsertImageRequest()) - ->setImageResource($imageResource) - ->setProject($project); + $request = (new InsertImageRequest())->setImageResource($imageResource)->setProject($project); $response = $gapicClient->insert($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); @@ -712,19 +711,20 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $imageResource = new Image(); $project = 'project-309310695'; - $request = (new InsertImageRequest()) - ->setImageResource($imageResource) - ->setProject($project); + $request = (new InsertImageRequest())->setImageResource($imageResource)->setProject($project); $response = $gapicClient->insert($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -759,9 +759,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new Image(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new ImageList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -771,8 +769,7 @@ public function listTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new ListImagesRequest()) - ->setProject($project); + $request = (new ListImagesRequest())->setProject($project); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -799,17 +796,19 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new ListImagesRequest()) - ->setProject($project); + $request = (new ListImagesRequest())->setProject($project); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -914,12 +913,15 @@ public function patchExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $image = 'image100313435'; @@ -1001,12 +1003,15 @@ 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 $globalSetPolicyRequestResource = new GlobalSetPolicyRequest(); @@ -1120,12 +1125,15 @@ public function setLabelsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $globalSetLabelsRequestResource = new GlobalSetLabelsRequest(); @@ -1201,12 +1209,15 @@ 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 $project = 'project-309310695'; @@ -1257,9 +1268,7 @@ public function deleteAsyncTest() // Mock request $image = 'image100313435'; $project = 'project-309310695'; - $request = (new DeleteImageRequest()) - ->setImage($image) - ->setProject($project); + $request = (new DeleteImageRequest())->setImage($image)->setProject($project); $response = $gapicClient->delete($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); diff --git a/Compute/tests/Unit/V1/Client/InstanceGroupManagerResizeRequestsClientTest.php b/Compute/tests/Unit/V1/Client/InstanceGroupManagerResizeRequestsClientTest.php index d7e8aee967e7..6bd21e033519 100644 --- a/Compute/tests/Unit/V1/Client/InstanceGroupManagerResizeRequestsClientTest.php +++ b/Compute/tests/Unit/V1/Client/InstanceGroupManagerResizeRequestsClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return InstanceGroupManagerResizeRequestsClient */ @@ -165,12 +167,15 @@ public function cancelExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instanceGroupManager = 'instanceGroupManager-1361249341'; @@ -298,12 +303,15 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instanceGroupManager = 'instanceGroupManager-1361249341'; @@ -405,12 +413,15 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $instanceGroupManager = 'instanceGroupManager-1361249341'; @@ -531,12 +542,15 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instanceGroupManager = 'instanceGroupManager-1361249341'; @@ -582,9 +596,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new InstanceGroupManagerResizeRequest(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new InstanceGroupManagerResizeRequestsListResponse(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -630,12 +642,15 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $instanceGroupManager = 'instanceGroupManager-1361249341'; diff --git a/Compute/tests/Unit/V1/Client/InstanceGroupManagersClientTest.php b/Compute/tests/Unit/V1/Client/InstanceGroupManagersClientTest.php index aa5681f62679..a10327fc6664 100644 --- a/Compute/tests/Unit/V1/Client/InstanceGroupManagersClientTest.php +++ b/Compute/tests/Unit/V1/Client/InstanceGroupManagersClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return InstanceGroupManagersClient */ @@ -142,7 +144,9 @@ public function abandonInstancesTest() $zone = 'zone3744684'; $request = (new AbandonInstancesInstanceGroupManagerRequest()) ->setInstanceGroupManager($instanceGroupManager) - ->setInstanceGroupManagersAbandonInstancesRequestResource($instanceGroupManagersAbandonInstancesRequestResource) + ->setInstanceGroupManagersAbandonInstancesRequestResource( + $instanceGroupManagersAbandonInstancesRequestResource + ) ->setProject($project) ->setZone($zone); $response = $gapicClient->abandonInstances($request); @@ -206,12 +210,15 @@ public function abandonInstancesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instanceGroupManager = 'instanceGroupManager-1361249341'; @@ -220,7 +227,9 @@ public function abandonInstancesExceptionTest() $zone = 'zone3744684'; $request = (new AbandonInstancesInstanceGroupManagerRequest()) ->setInstanceGroupManager($instanceGroupManager) - ->setInstanceGroupManagersAbandonInstancesRequestResource($instanceGroupManagersAbandonInstancesRequestResource) + ->setInstanceGroupManagersAbandonInstancesRequestResource( + $instanceGroupManagersAbandonInstancesRequestResource + ) ->setProject($project) ->setZone($zone); $response = $gapicClient->abandonInstances($request); @@ -268,8 +277,7 @@ public function aggregatedListTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListInstanceGroupManagersRequest()) - ->setProject($project); + $request = (new AggregatedListInstanceGroupManagersRequest())->setProject($project); $response = $gapicClient->aggregatedList($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -298,17 +306,19 @@ public function aggregatedListExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListInstanceGroupManagersRequest()) - ->setProject($project); + $request = (new AggregatedListInstanceGroupManagersRequest())->setProject($project); try { $gapicClient->aggregatedList($request); // If the $gapicClient method call did not throw, fail the test @@ -418,12 +428,15 @@ public function applyUpdatesToInstancesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instanceGroupManager = 'instanceGroupManager-1361249341'; @@ -487,7 +500,9 @@ public function createInstancesTest() $zone = 'zone3744684'; $request = (new CreateInstancesInstanceGroupManagerRequest()) ->setInstanceGroupManager($instanceGroupManager) - ->setInstanceGroupManagersCreateInstancesRequestResource($instanceGroupManagersCreateInstancesRequestResource) + ->setInstanceGroupManagersCreateInstancesRequestResource( + $instanceGroupManagersCreateInstancesRequestResource + ) ->setProject($project) ->setZone($zone); $response = $gapicClient->createInstances($request); @@ -551,12 +566,15 @@ public function createInstancesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instanceGroupManager = 'instanceGroupManager-1361249341'; @@ -565,7 +583,9 @@ public function createInstancesExceptionTest() $zone = 'zone3744684'; $request = (new CreateInstancesInstanceGroupManagerRequest()) ->setInstanceGroupManager($instanceGroupManager) - ->setInstanceGroupManagersCreateInstancesRequestResource($instanceGroupManagersCreateInstancesRequestResource) + ->setInstanceGroupManagersCreateInstancesRequestResource( + $instanceGroupManagersCreateInstancesRequestResource + ) ->setProject($project) ->setZone($zone); $response = $gapicClient->createInstances($request); @@ -680,12 +700,15 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instanceGroupManager = 'instanceGroupManager-1361249341'; @@ -747,7 +770,9 @@ public function deleteInstancesTest() $zone = 'zone3744684'; $request = (new DeleteInstancesInstanceGroupManagerRequest()) ->setInstanceGroupManager($instanceGroupManager) - ->setInstanceGroupManagersDeleteInstancesRequestResource($instanceGroupManagersDeleteInstancesRequestResource) + ->setInstanceGroupManagersDeleteInstancesRequestResource( + $instanceGroupManagersDeleteInstancesRequestResource + ) ->setProject($project) ->setZone($zone); $response = $gapicClient->deleteInstances($request); @@ -811,12 +836,15 @@ public function deleteInstancesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instanceGroupManager = 'instanceGroupManager-1361249341'; @@ -825,7 +853,9 @@ public function deleteInstancesExceptionTest() $zone = 'zone3744684'; $request = (new DeleteInstancesInstanceGroupManagerRequest()) ->setInstanceGroupManager($instanceGroupManager) - ->setInstanceGroupManagersDeleteInstancesRequestResource($instanceGroupManagersDeleteInstancesRequestResource) + ->setInstanceGroupManagersDeleteInstancesRequestResource( + $instanceGroupManagersDeleteInstancesRequestResource + ) ->setProject($project) ->setZone($zone); $response = $gapicClient->deleteInstances($request); @@ -880,7 +910,9 @@ public function deletePerInstanceConfigsTest() $zone = 'zone3744684'; $request = (new DeletePerInstanceConfigsInstanceGroupManagerRequest()) ->setInstanceGroupManager($instanceGroupManager) - ->setInstanceGroupManagersDeletePerInstanceConfigsReqResource($instanceGroupManagersDeletePerInstanceConfigsReqResource) + ->setInstanceGroupManagersDeletePerInstanceConfigsReqResource( + $instanceGroupManagersDeletePerInstanceConfigsReqResource + ) ->setProject($project) ->setZone($zone); $response = $gapicClient->deletePerInstanceConfigs($request); @@ -891,7 +923,10 @@ public function deletePerInstanceConfigsTest() $this->assertSame(0, count($operationsRequestsEmpty)); $actualApiFuncCall = $apiRequests[0]->getFuncCall(); $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.InstanceGroupManagers/DeletePerInstanceConfigs', $actualApiFuncCall); + $this->assertSame( + '/google.cloud.compute.v1.InstanceGroupManagers/DeletePerInstanceConfigs', + $actualApiFuncCall + ); $actualValue = $actualApiRequestObject->getInstanceGroupManager(); $this->assertProtobufEquals($instanceGroupManager, $actualValue); $actualValue = $actualApiRequestObject->getInstanceGroupManagersDeletePerInstanceConfigsReqResource(); @@ -944,12 +979,15 @@ public function deletePerInstanceConfigsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instanceGroupManager = 'instanceGroupManager-1361249341'; @@ -958,7 +996,9 @@ public function deletePerInstanceConfigsExceptionTest() $zone = 'zone3744684'; $request = (new DeletePerInstanceConfigsInstanceGroupManagerRequest()) ->setInstanceGroupManager($instanceGroupManager) - ->setInstanceGroupManagersDeletePerInstanceConfigsReqResource($instanceGroupManagersDeletePerInstanceConfigsReqResource) + ->setInstanceGroupManagersDeletePerInstanceConfigsReqResource( + $instanceGroupManagersDeletePerInstanceConfigsReqResource + ) ->setProject($project) ->setZone($zone); $response = $gapicClient->deletePerInstanceConfigs($request); @@ -1063,12 +1103,15 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $instanceGroupManager = 'instanceGroupManager-1361249341'; @@ -1183,12 +1226,15 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instanceGroupManagerResource = new InstanceGroupManager(); @@ -1232,9 +1278,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new InstanceGroupManager(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new InstanceGroupManagerList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -1245,9 +1289,7 @@ public function listTest() // Mock request $project = 'project-309310695'; $zone = 'zone3744684'; - $request = (new ListInstanceGroupManagersRequest()) - ->setProject($project) - ->setZone($zone); + $request = (new ListInstanceGroupManagersRequest())->setProject($project)->setZone($zone); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -1276,19 +1318,20 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $zone = 'zone3744684'; - $request = (new ListInstanceGroupManagersRequest()) - ->setProject($project) - ->setZone($zone); + $request = (new ListInstanceGroupManagersRequest())->setProject($project)->setZone($zone); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -1313,9 +1356,7 @@ public function listErrorsTest() // Mock response $nextPageToken = ''; $itemsElement = new InstanceManagedByIgmError(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new InstanceGroupManagersListErrorsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setItems($items); @@ -1358,12 +1399,15 @@ public function listErrorsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $instanceGroupManager = 'instanceGroupManager-1361249341'; @@ -1397,9 +1441,7 @@ public function listManagedInstancesTest() // Mock response $nextPageToken = ''; $managedInstancesElement = new ManagedInstance(); - $managedInstances = [ - $managedInstancesElement, - ]; + $managedInstances = [$managedInstancesElement]; $expectedResponse = new InstanceGroupManagersListManagedInstancesResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setManagedInstances($managedInstances); @@ -1442,12 +1484,15 @@ public function listManagedInstancesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $instanceGroupManager = 'instanceGroupManager-1361249341'; @@ -1481,9 +1526,7 @@ public function listPerInstanceConfigsTest() // Mock response $nextPageToken = ''; $itemsElement = new PerInstanceConfig(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new InstanceGroupManagersListPerInstanceConfigsResp(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setItems($items); @@ -1526,12 +1569,15 @@ public function listPerInstanceConfigsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $instanceGroupManager = 'instanceGroupManager-1361249341'; @@ -1650,12 +1696,15 @@ public function patchExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instanceGroupManager = 'instanceGroupManager-1361249341'; @@ -1719,7 +1768,9 @@ public function patchPerInstanceConfigsTest() $zone = 'zone3744684'; $request = (new PatchPerInstanceConfigsInstanceGroupManagerRequest()) ->setInstanceGroupManager($instanceGroupManager) - ->setInstanceGroupManagersPatchPerInstanceConfigsReqResource($instanceGroupManagersPatchPerInstanceConfigsReqResource) + ->setInstanceGroupManagersPatchPerInstanceConfigsReqResource( + $instanceGroupManagersPatchPerInstanceConfigsReqResource + ) ->setProject($project) ->setZone($zone); $response = $gapicClient->patchPerInstanceConfigs($request); @@ -1783,12 +1834,15 @@ public function patchPerInstanceConfigsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instanceGroupManager = 'instanceGroupManager-1361249341'; @@ -1797,7 +1851,9 @@ public function patchPerInstanceConfigsExceptionTest() $zone = 'zone3744684'; $request = (new PatchPerInstanceConfigsInstanceGroupManagerRequest()) ->setInstanceGroupManager($instanceGroupManager) - ->setInstanceGroupManagersPatchPerInstanceConfigsReqResource($instanceGroupManagersPatchPerInstanceConfigsReqResource) + ->setInstanceGroupManagersPatchPerInstanceConfigsReqResource( + $instanceGroupManagersPatchPerInstanceConfigsReqResource + ) ->setProject($project) ->setZone($zone); $response = $gapicClient->patchPerInstanceConfigs($request); @@ -1852,7 +1908,9 @@ public function recreateInstancesTest() $zone = 'zone3744684'; $request = (new RecreateInstancesInstanceGroupManagerRequest()) ->setInstanceGroupManager($instanceGroupManager) - ->setInstanceGroupManagersRecreateInstancesRequestResource($instanceGroupManagersRecreateInstancesRequestResource) + ->setInstanceGroupManagersRecreateInstancesRequestResource( + $instanceGroupManagersRecreateInstancesRequestResource + ) ->setProject($project) ->setZone($zone); $response = $gapicClient->recreateInstances($request); @@ -1916,12 +1974,15 @@ public function recreateInstancesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instanceGroupManager = 'instanceGroupManager-1361249341'; @@ -1930,7 +1991,9 @@ public function recreateInstancesExceptionTest() $zone = 'zone3744684'; $request = (new RecreateInstancesInstanceGroupManagerRequest()) ->setInstanceGroupManager($instanceGroupManager) - ->setInstanceGroupManagersRecreateInstancesRequestResource($instanceGroupManagersRecreateInstancesRequestResource) + ->setInstanceGroupManagersRecreateInstancesRequestResource( + $instanceGroupManagersRecreateInstancesRequestResource + ) ->setProject($project) ->setZone($zone); $response = $gapicClient->recreateInstances($request); @@ -2049,12 +2112,15 @@ public function resizeExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instanceGroupManager = 'instanceGroupManager-1361249341'; @@ -2118,7 +2184,9 @@ public function resumeInstancesTest() $zone = 'zone3744684'; $request = (new ResumeInstancesInstanceGroupManagerRequest()) ->setInstanceGroupManager($instanceGroupManager) - ->setInstanceGroupManagersResumeInstancesRequestResource($instanceGroupManagersResumeInstancesRequestResource) + ->setInstanceGroupManagersResumeInstancesRequestResource( + $instanceGroupManagersResumeInstancesRequestResource + ) ->setProject($project) ->setZone($zone); $response = $gapicClient->resumeInstances($request); @@ -2182,12 +2250,15 @@ public function resumeInstancesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instanceGroupManager = 'instanceGroupManager-1361249341'; @@ -2196,7 +2267,9 @@ public function resumeInstancesExceptionTest() $zone = 'zone3744684'; $request = (new ResumeInstancesInstanceGroupManagerRequest()) ->setInstanceGroupManager($instanceGroupManager) - ->setInstanceGroupManagersResumeInstancesRequestResource($instanceGroupManagersResumeInstancesRequestResource) + ->setInstanceGroupManagersResumeInstancesRequestResource( + $instanceGroupManagersResumeInstancesRequestResource + ) ->setProject($project) ->setZone($zone); $response = $gapicClient->resumeInstances($request); @@ -2251,7 +2324,9 @@ public function setInstanceTemplateTest() $zone = 'zone3744684'; $request = (new SetInstanceTemplateInstanceGroupManagerRequest()) ->setInstanceGroupManager($instanceGroupManager) - ->setInstanceGroupManagersSetInstanceTemplateRequestResource($instanceGroupManagersSetInstanceTemplateRequestResource) + ->setInstanceGroupManagersSetInstanceTemplateRequestResource( + $instanceGroupManagersSetInstanceTemplateRequestResource + ) ->setProject($project) ->setZone($zone); $response = $gapicClient->setInstanceTemplate($request); @@ -2315,12 +2390,15 @@ public function setInstanceTemplateExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instanceGroupManager = 'instanceGroupManager-1361249341'; @@ -2329,7 +2407,9 @@ public function setInstanceTemplateExceptionTest() $zone = 'zone3744684'; $request = (new SetInstanceTemplateInstanceGroupManagerRequest()) ->setInstanceGroupManager($instanceGroupManager) - ->setInstanceGroupManagersSetInstanceTemplateRequestResource($instanceGroupManagersSetInstanceTemplateRequestResource) + ->setInstanceGroupManagersSetInstanceTemplateRequestResource( + $instanceGroupManagersSetInstanceTemplateRequestResource + ) ->setProject($project) ->setZone($zone); $response = $gapicClient->setInstanceTemplate($request); @@ -2448,12 +2528,15 @@ public function setTargetPoolsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instanceGroupManager = 'instanceGroupManager-1361249341'; @@ -2581,12 +2664,15 @@ public function startInstancesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instanceGroupManager = 'instanceGroupManager-1361249341'; @@ -2714,12 +2800,15 @@ public function stopInstancesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instanceGroupManager = 'instanceGroupManager-1361249341'; @@ -2783,7 +2872,9 @@ public function suspendInstancesTest() $zone = 'zone3744684'; $request = (new SuspendInstancesInstanceGroupManagerRequest()) ->setInstanceGroupManager($instanceGroupManager) - ->setInstanceGroupManagersSuspendInstancesRequestResource($instanceGroupManagersSuspendInstancesRequestResource) + ->setInstanceGroupManagersSuspendInstancesRequestResource( + $instanceGroupManagersSuspendInstancesRequestResource + ) ->setProject($project) ->setZone($zone); $response = $gapicClient->suspendInstances($request); @@ -2847,12 +2938,15 @@ public function suspendInstancesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instanceGroupManager = 'instanceGroupManager-1361249341'; @@ -2861,7 +2955,9 @@ public function suspendInstancesExceptionTest() $zone = 'zone3744684'; $request = (new SuspendInstancesInstanceGroupManagerRequest()) ->setInstanceGroupManager($instanceGroupManager) - ->setInstanceGroupManagersSuspendInstancesRequestResource($instanceGroupManagersSuspendInstancesRequestResource) + ->setInstanceGroupManagersSuspendInstancesRequestResource( + $instanceGroupManagersSuspendInstancesRequestResource + ) ->setProject($project) ->setZone($zone); $response = $gapicClient->suspendInstances($request); @@ -2916,7 +3012,9 @@ public function updatePerInstanceConfigsTest() $zone = 'zone3744684'; $request = (new UpdatePerInstanceConfigsInstanceGroupManagerRequest()) ->setInstanceGroupManager($instanceGroupManager) - ->setInstanceGroupManagersUpdatePerInstanceConfigsReqResource($instanceGroupManagersUpdatePerInstanceConfigsReqResource) + ->setInstanceGroupManagersUpdatePerInstanceConfigsReqResource( + $instanceGroupManagersUpdatePerInstanceConfigsReqResource + ) ->setProject($project) ->setZone($zone); $response = $gapicClient->updatePerInstanceConfigs($request); @@ -2927,7 +3025,10 @@ public function updatePerInstanceConfigsTest() $this->assertSame(0, count($operationsRequestsEmpty)); $actualApiFuncCall = $apiRequests[0]->getFuncCall(); $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.InstanceGroupManagers/UpdatePerInstanceConfigs', $actualApiFuncCall); + $this->assertSame( + '/google.cloud.compute.v1.InstanceGroupManagers/UpdatePerInstanceConfigs', + $actualApiFuncCall + ); $actualValue = $actualApiRequestObject->getInstanceGroupManager(); $this->assertProtobufEquals($instanceGroupManager, $actualValue); $actualValue = $actualApiRequestObject->getInstanceGroupManagersUpdatePerInstanceConfigsReqResource(); @@ -2980,12 +3081,15 @@ public function updatePerInstanceConfigsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instanceGroupManager = 'instanceGroupManager-1361249341'; @@ -2994,7 +3098,9 @@ public function updatePerInstanceConfigsExceptionTest() $zone = 'zone3744684'; $request = (new UpdatePerInstanceConfigsInstanceGroupManagerRequest()) ->setInstanceGroupManager($instanceGroupManager) - ->setInstanceGroupManagersUpdatePerInstanceConfigsReqResource($instanceGroupManagersUpdatePerInstanceConfigsReqResource) + ->setInstanceGroupManagersUpdatePerInstanceConfigsReqResource( + $instanceGroupManagersUpdatePerInstanceConfigsReqResource + ) ->setProject($project) ->setZone($zone); $response = $gapicClient->updatePerInstanceConfigs($request); @@ -3049,7 +3155,9 @@ public function abandonInstancesAsyncTest() $zone = 'zone3744684'; $request = (new AbandonInstancesInstanceGroupManagerRequest()) ->setInstanceGroupManager($instanceGroupManager) - ->setInstanceGroupManagersAbandonInstancesRequestResource($instanceGroupManagersAbandonInstancesRequestResource) + ->setInstanceGroupManagersAbandonInstancesRequestResource( + $instanceGroupManagersAbandonInstancesRequestResource + ) ->setProject($project) ->setZone($zone); $response = $gapicClient->abandonInstances($request); diff --git a/Compute/tests/Unit/V1/Client/InstanceGroupsClientTest.php b/Compute/tests/Unit/V1/Client/InstanceGroupsClientTest.php index 879ab27a97cd..1a3c5a96a7f8 100644 --- a/Compute/tests/Unit/V1/Client/InstanceGroupsClientTest.php +++ b/Compute/tests/Unit/V1/Client/InstanceGroupsClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return InstanceGroupsClient */ @@ -177,12 +179,15 @@ public function addInstancesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instanceGroup = 'instanceGroup81095253'; @@ -239,8 +244,7 @@ public function aggregatedListTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListInstanceGroupsRequest()) - ->setProject($project); + $request = (new AggregatedListInstanceGroupsRequest())->setProject($project); $response = $gapicClient->aggregatedList($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -269,17 +273,19 @@ public function aggregatedListExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListInstanceGroupsRequest()) - ->setProject($project); + $request = (new AggregatedListInstanceGroupsRequest())->setProject($project); try { $gapicClient->aggregatedList($request); // If the $gapicClient method call did not throw, fail the test @@ -385,12 +391,15 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instanceGroup = 'instanceGroup81095253'; @@ -490,12 +499,15 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $instanceGroup = 'instanceGroup81095253'; @@ -610,12 +622,15 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instanceGroupResource = new InstanceGroup(); @@ -659,9 +674,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new InstanceGroup(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new InstanceGroupList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -672,9 +685,7 @@ public function listTest() // Mock request $project = 'project-309310695'; $zone = 'zone3744684'; - $request = (new ListInstanceGroupsRequest()) - ->setProject($project) - ->setZone($zone); + $request = (new ListInstanceGroupsRequest())->setProject($project)->setZone($zone); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -703,19 +714,20 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $zone = 'zone3744684'; - $request = (new ListInstanceGroupsRequest()) - ->setProject($project) - ->setZone($zone); + $request = (new ListInstanceGroupsRequest())->setProject($project)->setZone($zone); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -743,9 +755,7 @@ public function listInstancesTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new InstanceWithNamedPorts(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new InstanceGroupsListInstances(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -795,12 +805,15 @@ public function listInstancesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $instanceGroup = 'instanceGroup81095253'; @@ -921,12 +934,15 @@ public function removeInstancesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instanceGroup = 'instanceGroup81095253'; @@ -1054,12 +1070,15 @@ public function setNamedPortsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instanceGroup = 'instanceGroup81095253'; diff --git a/Compute/tests/Unit/V1/Client/InstanceSettingsServiceClientTest.php b/Compute/tests/Unit/V1/Client/InstanceSettingsServiceClientTest.php index 5ecd5e5c3125..695b588213ed 100644 --- a/Compute/tests/Unit/V1/Client/InstanceSettingsServiceClientTest.php +++ b/Compute/tests/Unit/V1/Client/InstanceSettingsServiceClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return InstanceSettingsServiceClient */ @@ -85,9 +87,7 @@ public function getTest() // Mock request $project = 'project-309310695'; $zone = 'zone3744684'; - $request = (new GetInstanceSettingRequest()) - ->setProject($project) - ->setZone($zone); + $request = (new GetInstanceSettingRequest())->setProject($project)->setZone($zone); $response = $gapicClient->get($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -113,19 +113,20 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $zone = 'zone3744684'; - $request = (new GetInstanceSettingRequest()) - ->setProject($project) - ->setZone($zone); + $request = (new GetInstanceSettingRequest())->setProject($project)->setZone($zone); try { $gapicClient->get($request); // If the $gapicClient method call did not throw, fail the test @@ -231,12 +232,15 @@ public function patchExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instanceSettingsResource = new InstanceSettings(); @@ -286,9 +290,7 @@ public function getAsyncTest() // Mock request $project = 'project-309310695'; $zone = 'zone3744684'; - $request = (new GetInstanceSettingRequest()) - ->setProject($project) - ->setZone($zone); + $request = (new GetInstanceSettingRequest())->setProject($project)->setZone($zone); $response = $gapicClient->getAsync($request)->wait(); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); diff --git a/Compute/tests/Unit/V1/Client/InstanceTemplatesClientTest.php b/Compute/tests/Unit/V1/Client/InstanceTemplatesClientTest.php index cd9ccc73e6d7..37c14c7fbf60 100644 --- a/Compute/tests/Unit/V1/Client/InstanceTemplatesClientTest.php +++ b/Compute/tests/Unit/V1/Client/InstanceTemplatesClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return InstanceTemplatesClient */ @@ -103,8 +105,7 @@ public function aggregatedListTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListInstanceTemplatesRequest()) - ->setProject($project); + $request = (new AggregatedListInstanceTemplatesRequest())->setProject($project); $response = $gapicClient->aggregatedList($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -133,17 +134,19 @@ public function aggregatedListExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListInstanceTemplatesRequest()) - ->setProject($project); + $request = (new AggregatedListInstanceTemplatesRequest())->setProject($project); try { $gapicClient->aggregatedList($request); // If the $gapicClient method call did not throw, fail the test @@ -185,9 +188,7 @@ public function deleteTest() // Mock request $instanceTemplate = 'instanceTemplate309248228'; $project = 'project-309310695'; - $request = (new DeleteInstanceTemplateRequest()) - ->setInstanceTemplate($instanceTemplate) - ->setProject($project); + $request = (new DeleteInstanceTemplateRequest())->setInstanceTemplate($instanceTemplate)->setProject($project); $response = $gapicClient->delete($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); @@ -244,19 +245,20 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instanceTemplate = 'instanceTemplate309248228'; $project = 'project-309310695'; - $request = (new DeleteInstanceTemplateRequest()) - ->setInstanceTemplate($instanceTemplate) - ->setProject($project); + $request = (new DeleteInstanceTemplateRequest())->setInstanceTemplate($instanceTemplate)->setProject($project); $response = $gapicClient->delete($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -307,9 +309,7 @@ public function getTest() // Mock request $instanceTemplate = 'instanceTemplate309248228'; $project = 'project-309310695'; - $request = (new GetInstanceTemplateRequest()) - ->setInstanceTemplate($instanceTemplate) - ->setProject($project); + $request = (new GetInstanceTemplateRequest())->setInstanceTemplate($instanceTemplate)->setProject($project); $response = $gapicClient->get($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -335,19 +335,20 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $instanceTemplate = 'instanceTemplate309248228'; $project = 'project-309310695'; - $request = (new GetInstanceTemplateRequest()) - ->setInstanceTemplate($instanceTemplate) - ->setProject($project); + $request = (new GetInstanceTemplateRequest())->setInstanceTemplate($instanceTemplate)->setProject($project); try { $gapicClient->get($request); // If the $gapicClient method call did not throw, fail the test @@ -381,9 +382,7 @@ public function getIamPolicyTest() // Mock request $project = 'project-309310695'; $resource = 'resource-341064690'; - $request = (new GetIamPolicyInstanceTemplateRequest()) - ->setProject($project) - ->setResource($resource); + $request = (new GetIamPolicyInstanceTemplateRequest())->setProject($project)->setResource($resource); $response = $gapicClient->getIamPolicy($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -409,19 +408,20 @@ 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 $project = 'project-309310695'; $resource = 'resource-341064690'; - $request = (new GetIamPolicyInstanceTemplateRequest()) - ->setProject($project) - ->setResource($resource); + $request = (new GetIamPolicyInstanceTemplateRequest())->setProject($project)->setResource($resource); try { $gapicClient->getIamPolicy($request); // If the $gapicClient method call did not throw, fail the test @@ -522,12 +522,15 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instanceTemplateResource = new InstanceTemplate(); @@ -569,9 +572,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new InstanceTemplate(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new InstanceTemplateList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -581,8 +582,7 @@ public function listTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new ListInstanceTemplatesRequest()) - ->setProject($project); + $request = (new ListInstanceTemplatesRequest())->setProject($project); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -609,17 +609,19 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new ListInstanceTemplatesRequest()) - ->setProject($project); + $request = (new ListInstanceTemplatesRequest())->setProject($project); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -685,12 +687,15 @@ 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 $globalSetPolicyRequestResource = new GlobalSetPolicyRequest(); @@ -759,12 +764,15 @@ 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 $project = 'project-309310695'; @@ -812,8 +820,7 @@ public function aggregatedListAsyncTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListInstanceTemplatesRequest()) - ->setProject($project); + $request = (new AggregatedListInstanceTemplatesRequest())->setProject($project); $response = $gapicClient->aggregatedListAsync($request)->wait(); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); diff --git a/Compute/tests/Unit/V1/Client/InstancesClientTest.php b/Compute/tests/Unit/V1/Client/InstancesClientTest.php index 22ee12cbdb48..644e78fe3fe8 100644 --- a/Compute/tests/Unit/V1/Client/InstancesClientTest.php +++ b/Compute/tests/Unit/V1/Client/InstancesClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return InstancesClient */ @@ -248,12 +250,15 @@ public function addAccessConfigExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $accessConfigResource = new AccessConfig(); @@ -383,12 +388,15 @@ public function addResourcePoliciesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instance = 'instance555127957'; @@ -445,8 +453,7 @@ public function aggregatedListTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListInstancesRequest()) - ->setProject($project); + $request = (new AggregatedListInstancesRequest())->setProject($project); $response = $gapicClient->aggregatedList($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -475,17 +482,19 @@ public function aggregatedListExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListInstancesRequest()) - ->setProject($project); + $request = (new AggregatedListInstancesRequest())->setProject($project); try { $gapicClient->aggregatedList($request); // If the $gapicClient method call did not throw, fail the test @@ -595,12 +604,15 @@ public function attachDiskExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $attachedDiskResource = new AttachedDisk(); @@ -724,12 +736,15 @@ public function bulkInsertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $bulkInsertInstanceResourceResource = new BulkInsertInstanceResource(); @@ -851,12 +866,15 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instance = 'instance555127957'; @@ -986,12 +1004,15 @@ public function deleteAccessConfigExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $accessConfig = 'accessConfig-464014723'; @@ -1121,12 +1142,15 @@ public function detachDiskExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $deviceName = 'deviceName-1543071020'; @@ -1256,12 +1280,15 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $instance = 'instance555127957'; @@ -1334,12 +1361,15 @@ public function getEffectiveFirewallsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $instance = 'instance555127957'; @@ -1420,12 +1450,15 @@ public function getGuestAttributesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $instance = 'instance555127957'; @@ -1500,12 +1533,15 @@ 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 $project = 'project-309310695'; @@ -1578,12 +1614,15 @@ public function getScreenshotExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $instance = 'instance555127957'; @@ -1662,12 +1701,15 @@ public function getSerialPortOutputExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $instance = 'instance555127957'; @@ -1738,12 +1780,15 @@ public function getShieldedInstanceIdentityExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $instance = 'instance555127957'; @@ -1858,12 +1903,15 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instanceResource = new Instance(); @@ -1907,9 +1955,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new Instance(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new InstanceList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -1920,9 +1966,7 @@ public function listTest() // Mock request $project = 'project-309310695'; $zone = 'zone3744684'; - $request = (new ListInstancesRequest()) - ->setProject($project) - ->setZone($zone); + $request = (new ListInstancesRequest())->setProject($project)->setZone($zone); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -1951,19 +1995,20 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $zone = 'zone3744684'; - $request = (new ListInstancesRequest()) - ->setProject($project) - ->setZone($zone); + $request = (new ListInstancesRequest())->setProject($project)->setZone($zone); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -1991,9 +2036,7 @@ public function listReferrersTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new Reference(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new InstanceListReferrers(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -2039,12 +2082,15 @@ public function listReferrersExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $instance = 'instance555127957'; @@ -2159,12 +2205,15 @@ public function performMaintenanceExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instance = 'instance555127957'; @@ -2290,12 +2339,15 @@ public function removeResourcePoliciesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instance = 'instance555127957'; @@ -2423,12 +2475,15 @@ public function reportHostAsFaultyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instance = 'instance555127957'; @@ -2552,12 +2607,15 @@ public function resetExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instance = 'instance555127957'; @@ -2679,12 +2737,15 @@ public function resumeExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instance = 'instance555127957'; @@ -2760,12 +2821,15 @@ public function sendDiagnosticInterruptExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $instance = 'instance555127957'; @@ -2880,12 +2944,15 @@ public function setDeletionProtectionExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -3015,12 +3082,15 @@ public function setDiskAutoDeleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $autoDelete = false; @@ -3110,12 +3180,15 @@ 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 $project = 'project-309310695'; @@ -3236,12 +3309,15 @@ public function setLabelsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instance = 'instance555127957'; @@ -3369,12 +3445,15 @@ public function setMachineResourcesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instance = 'instance555127957'; @@ -3502,12 +3581,15 @@ public function setMachineTypeExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instance = 'instance555127957'; @@ -3635,12 +3717,15 @@ public function setMetadataExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instance = 'instance555127957'; @@ -3768,12 +3853,15 @@ public function setMinCpuPlatformExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instance = 'instance555127957'; @@ -3901,12 +3989,15 @@ public function setNameExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instance = 'instance555127957'; @@ -4034,12 +4125,15 @@ public function setSchedulingExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instance = 'instance555127957'; @@ -4167,12 +4261,15 @@ public function setSecurityPolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instance = 'instance555127957'; @@ -4300,12 +4397,15 @@ public function setServiceAccountExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instance = 'instance555127957'; @@ -4433,12 +4533,15 @@ public function setShieldedInstanceIntegrityPolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instance = 'instance555127957'; @@ -4566,12 +4669,15 @@ public function setTagsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instance = 'instance555127957'; @@ -4695,12 +4801,15 @@ public function simulateMaintenanceEventExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instance = 'instance555127957'; @@ -4822,12 +4931,15 @@ public function startExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instance = 'instance555127957'; @@ -4953,12 +5065,15 @@ public function startWithEncryptionKeyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instance = 'instance555127957'; @@ -5082,12 +5197,15 @@ public function stopExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instance = 'instance555127957'; @@ -5209,12 +5327,15 @@ public function suspendExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instance = 'instance555127957'; @@ -5294,12 +5415,15 @@ 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 $project = 'project-309310695'; @@ -5420,12 +5544,15 @@ public function updateExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instance = 'instance555127957'; @@ -5557,12 +5684,15 @@ public function updateAccessConfigExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $accessConfigResource = new AccessConfig(); @@ -5692,12 +5822,15 @@ public function updateDisplayDeviceExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $displayDeviceResource = new DisplayDevice(); @@ -5829,12 +5962,15 @@ public function updateNetworkInterfaceExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instance = 'instance555127957'; @@ -5964,12 +6100,15 @@ public function updateShieldedInstanceConfigExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instance = 'instance555127957'; diff --git a/Compute/tests/Unit/V1/Client/InstantSnapshotsClientTest.php b/Compute/tests/Unit/V1/Client/InstantSnapshotsClientTest.php index 3f169fc59d1a..c37ff9d8650a 100644 --- a/Compute/tests/Unit/V1/Client/InstantSnapshotsClientTest.php +++ b/Compute/tests/Unit/V1/Client/InstantSnapshotsClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return InstantSnapshotsClient */ @@ -105,8 +107,7 @@ public function aggregatedListTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListInstantSnapshotsRequest()) - ->setProject($project); + $request = (new AggregatedListInstantSnapshotsRequest())->setProject($project); $response = $gapicClient->aggregatedList($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -135,17 +136,19 @@ public function aggregatedListExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListInstantSnapshotsRequest()) - ->setProject($project); + $request = (new AggregatedListInstantSnapshotsRequest())->setProject($project); try { $gapicClient->aggregatedList($request); // If the $gapicClient method call did not throw, fail the test @@ -251,12 +254,15 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instantSnapshot = 'instantSnapshot1465380450'; @@ -366,12 +372,15 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $instantSnapshot = 'instantSnapshot1465380450'; @@ -446,12 +455,15 @@ 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 $project = 'project-309310695'; @@ -566,12 +578,15 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instantSnapshotResource = new InstantSnapshot(); @@ -615,9 +630,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new InstantSnapshot(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new InstantSnapshotList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -628,9 +641,7 @@ public function listTest() // Mock request $project = 'project-309310695'; $zone = 'zone3744684'; - $request = (new ListInstantSnapshotsRequest()) - ->setProject($project) - ->setZone($zone); + $request = (new ListInstantSnapshotsRequest())->setProject($project)->setZone($zone); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -659,19 +670,20 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $zone = 'zone3744684'; - $request = (new ListInstantSnapshotsRequest()) - ->setProject($project) - ->setZone($zone); + $request = (new ListInstantSnapshotsRequest())->setProject($project)->setZone($zone); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -741,12 +753,15 @@ 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 $project = 'project-309310695'; @@ -867,12 +882,15 @@ public function setLabelsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -954,12 +972,15 @@ 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 $project = 'project-309310695'; @@ -1009,8 +1030,7 @@ public function aggregatedListAsyncTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListInstantSnapshotsRequest()) - ->setProject($project); + $request = (new AggregatedListInstantSnapshotsRequest())->setProject($project); $response = $gapicClient->aggregatedListAsync($request)->wait(); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); diff --git a/Compute/tests/Unit/V1/Client/InterconnectAttachmentGroupsClientTest.php b/Compute/tests/Unit/V1/Client/InterconnectAttachmentGroupsClientTest.php index a73bfd230683..170efeec0489 100644 --- a/Compute/tests/Unit/V1/Client/InterconnectAttachmentGroupsClientTest.php +++ b/Compute/tests/Unit/V1/Client/InterconnectAttachmentGroupsClientTest.php @@ -26,13 +26,13 @@ use Google\ApiCore\CredentialsWrapper; use Google\ApiCore\Testing\GeneratedTest; use Google\ApiCore\Testing\MockTransport; +use Google\Cloud\Compute\V1\Client\GlobalOperationsClient; use Google\Cloud\Compute\V1\Client\InterconnectAttachmentGroupsClient; use Google\Cloud\Compute\V1\DeleteInterconnectAttachmentGroupRequest; use Google\Cloud\Compute\V1\GetGlobalOperationRequest; use Google\Cloud\Compute\V1\GetIamPolicyInterconnectAttachmentGroupRequest; use Google\Cloud\Compute\V1\GetInterconnectAttachmentGroupRequest; use Google\Cloud\Compute\V1\GetOperationalStatusInterconnectAttachmentGroupRequest; -use Google\Cloud\Compute\V1\GlobalOperationsClient; use Google\Cloud\Compute\V1\GlobalSetPolicyRequest; use Google\Cloud\Compute\V1\InsertInterconnectAttachmentGroupRequest; use Google\Cloud\Compute\V1\InterconnectAttachmentGroup; @@ -66,7 +66,9 @@ private function createTransport($deserialize = null) /** @return CredentialsWrapper */ private function createCredentials() { - return $this->getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return InterconnectAttachmentGroupsClient */ @@ -165,12 +167,15 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $interconnectAttachmentGroup = 'interconnectAttachmentGroup-460965900'; @@ -256,12 +261,15 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $interconnectAttachmentGroup = 'interconnectAttachmentGroup-460965900'; @@ -302,9 +310,7 @@ public function getIamPolicyTest() // Mock request $project = 'project-309310695'; $resource = 'resource-341064690'; - $request = (new GetIamPolicyInterconnectAttachmentGroupRequest()) - ->setProject($project) - ->setResource($resource); + $request = (new GetIamPolicyInterconnectAttachmentGroupRequest())->setProject($project)->setResource($resource); $response = $gapicClient->getIamPolicy($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -330,19 +336,20 @@ 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 $project = 'project-309310695'; $resource = 'resource-341064690'; - $request = (new GetIamPolicyInterconnectAttachmentGroupRequest()) - ->setProject($project) - ->setResource($resource); + $request = (new GetIamPolicyInterconnectAttachmentGroupRequest())->setProject($project)->setResource($resource); try { $gapicClient->getIamPolicy($request); // If the $gapicClient method call did not throw, fail the test @@ -381,7 +388,10 @@ public function getOperationalStatusTest() $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.InterconnectAttachmentGroups/GetOperationalStatus', $actualFuncCall); + $this->assertSame( + '/google.cloud.compute.v1.InterconnectAttachmentGroups/GetOperationalStatus', + $actualFuncCall + ); $actualValue = $actualRequestObject->getInterconnectAttachmentGroup(); $this->assertProtobufEquals($interconnectAttachmentGroup, $actualValue); $actualValue = $actualRequestObject->getProject(); @@ -400,12 +410,15 @@ public function getOperationalStatusExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $interconnectAttachmentGroup = 'interconnectAttachmentGroup-460965900'; @@ -513,12 +526,15 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $interconnectAttachmentGroupResource = new InterconnectAttachmentGroup(); @@ -569,8 +585,7 @@ public function listTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new ListInterconnectAttachmentGroupsRequest()) - ->setProject($project); + $request = (new ListInterconnectAttachmentGroupsRequest())->setProject($project); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -594,17 +609,19 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new ListInterconnectAttachmentGroupsRequest()) - ->setProject($project); + $request = (new ListInterconnectAttachmentGroupsRequest())->setProject($project); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -709,12 +726,15 @@ public function patchExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $interconnectAttachmentGroup = 'interconnectAttachmentGroup-460965900'; @@ -796,12 +816,15 @@ 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 $globalSetPolicyRequestResource = new GlobalSetPolicyRequest(); @@ -870,12 +893,15 @@ 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 $project = 'project-309310695'; diff --git a/Compute/tests/Unit/V1/Client/InterconnectAttachmentsClientTest.php b/Compute/tests/Unit/V1/Client/InterconnectAttachmentsClientTest.php index 8274c7313824..7e423594dd75 100644 --- a/Compute/tests/Unit/V1/Client/InterconnectAttachmentsClientTest.php +++ b/Compute/tests/Unit/V1/Client/InterconnectAttachmentsClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return InterconnectAttachmentsClient */ @@ -99,8 +101,7 @@ public function aggregatedListTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListInterconnectAttachmentsRequest()) - ->setProject($project); + $request = (new AggregatedListInterconnectAttachmentsRequest())->setProject($project); $response = $gapicClient->aggregatedList($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -129,17 +130,19 @@ public function aggregatedListExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListInterconnectAttachmentsRequest()) - ->setProject($project); + $request = (new AggregatedListInterconnectAttachmentsRequest())->setProject($project); try { $gapicClient->aggregatedList($request); // If the $gapicClient method call did not throw, fail the test @@ -245,12 +248,15 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $interconnectAttachment = 'interconnectAttachment308135284'; @@ -394,12 +400,15 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $interconnectAttachment = 'interconnectAttachment308135284'; @@ -514,12 +523,15 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $interconnectAttachmentResource = new InterconnectAttachment(); @@ -563,9 +575,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new InterconnectAttachment(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new InterconnectAttachmentList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -576,9 +586,7 @@ public function listTest() // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListInterconnectAttachmentsRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListInterconnectAttachmentsRequest())->setProject($project)->setRegion($region); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -607,19 +615,20 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListInterconnectAttachmentsRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListInterconnectAttachmentsRequest())->setProject($project)->setRegion($region); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -729,12 +738,15 @@ public function patchExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $interconnectAttachment = 'interconnectAttachment308135284'; @@ -862,12 +874,15 @@ public function setLabelsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -924,8 +939,7 @@ public function aggregatedListAsyncTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListInterconnectAttachmentsRequest()) - ->setProject($project); + $request = (new AggregatedListInterconnectAttachmentsRequest())->setProject($project); $response = $gapicClient->aggregatedListAsync($request)->wait(); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); diff --git a/Compute/tests/Unit/V1/Client/InterconnectGroupsClientTest.php b/Compute/tests/Unit/V1/Client/InterconnectGroupsClientTest.php index b4ac7ac089aa..b33b4abed8d8 100644 --- a/Compute/tests/Unit/V1/Client/InterconnectGroupsClientTest.php +++ b/Compute/tests/Unit/V1/Client/InterconnectGroupsClientTest.php @@ -26,6 +26,7 @@ use Google\ApiCore\CredentialsWrapper; use Google\ApiCore\Testing\GeneratedTest; use Google\ApiCore\Testing\MockTransport; +use Google\Cloud\Compute\V1\Client\GlobalOperationsClient; use Google\Cloud\Compute\V1\Client\InterconnectGroupsClient; use Google\Cloud\Compute\V1\CreateMembersInterconnectGroupRequest; use Google\Cloud\Compute\V1\DeleteInterconnectGroupRequest; @@ -33,7 +34,6 @@ use Google\Cloud\Compute\V1\GetIamPolicyInterconnectGroupRequest; use Google\Cloud\Compute\V1\GetInterconnectGroupRequest; use Google\Cloud\Compute\V1\GetOperationalStatusInterconnectGroupRequest; -use Google\Cloud\Compute\V1\GlobalOperationsClient; use Google\Cloud\Compute\V1\GlobalSetPolicyRequest; use Google\Cloud\Compute\V1\InsertInterconnectGroupRequest; use Google\Cloud\Compute\V1\InterconnectGroup; @@ -68,7 +68,9 @@ private function createTransport($deserialize = null) /** @return CredentialsWrapper */ private function createCredentials() { - return $this->getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return InterconnectGroupsClient */ @@ -171,12 +173,15 @@ public function createMembersExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $interconnectGroup = 'interconnectGroup1462393742'; @@ -293,12 +298,15 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $interconnectGroup = 'interconnectGroup1462393742'; @@ -354,9 +362,7 @@ public function getTest() // Mock request $interconnectGroup = 'interconnectGroup1462393742'; $project = 'project-309310695'; - $request = (new GetInterconnectGroupRequest()) - ->setInterconnectGroup($interconnectGroup) - ->setProject($project); + $request = (new GetInterconnectGroupRequest())->setInterconnectGroup($interconnectGroup)->setProject($project); $response = $gapicClient->get($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -382,19 +388,20 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $interconnectGroup = 'interconnectGroup1462393742'; $project = 'project-309310695'; - $request = (new GetInterconnectGroupRequest()) - ->setInterconnectGroup($interconnectGroup) - ->setProject($project); + $request = (new GetInterconnectGroupRequest())->setInterconnectGroup($interconnectGroup)->setProject($project); try { $gapicClient->get($request); // If the $gapicClient method call did not throw, fail the test @@ -428,9 +435,7 @@ public function getIamPolicyTest() // Mock request $project = 'project-309310695'; $resource = 'resource-341064690'; - $request = (new GetIamPolicyInterconnectGroupRequest()) - ->setProject($project) - ->setResource($resource); + $request = (new GetIamPolicyInterconnectGroupRequest())->setProject($project)->setResource($resource); $response = $gapicClient->getIamPolicy($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -456,19 +461,20 @@ 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 $project = 'project-309310695'; $resource = 'resource-341064690'; - $request = (new GetIamPolicyInterconnectGroupRequest()) - ->setProject($project) - ->setResource($resource); + $request = (new GetIamPolicyInterconnectGroupRequest())->setProject($project)->setResource($resource); try { $gapicClient->getIamPolicy($request); // If the $gapicClient method call did not throw, fail the test @@ -526,12 +532,15 @@ public function getOperationalStatusExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $interconnectGroup = 'interconnectGroup1462393742'; @@ -639,12 +648,15 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $interconnectGroupResource = new InterconnectGroup(); @@ -695,8 +707,7 @@ public function listTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new ListInterconnectGroupsRequest()) - ->setProject($project); + $request = (new ListInterconnectGroupsRequest())->setProject($project); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -720,17 +731,19 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new ListInterconnectGroupsRequest()) - ->setProject($project); + $request = (new ListInterconnectGroupsRequest())->setProject($project); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -835,12 +848,15 @@ public function patchExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $interconnectGroup = 'interconnectGroup1462393742'; @@ -922,12 +938,15 @@ 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 $globalSetPolicyRequestResource = new GlobalSetPolicyRequest(); @@ -996,12 +1015,15 @@ 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 $project = 'project-309310695'; diff --git a/Compute/tests/Unit/V1/Client/InterconnectLocationsClientTest.php b/Compute/tests/Unit/V1/Client/InterconnectLocationsClientTest.php index 98bc157dc92f..49cd219fb6b7 100644 --- a/Compute/tests/Unit/V1/Client/InterconnectLocationsClientTest.php +++ b/Compute/tests/Unit/V1/Client/InterconnectLocationsClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return InterconnectLocationsClient */ @@ -134,12 +136,15 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $interconnectLocation = 'interconnectLocation-581505978'; @@ -174,9 +179,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new InterconnectLocation(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new InterconnectLocationList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -186,8 +189,7 @@ public function listTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new ListInterconnectLocationsRequest()) - ->setProject($project); + $request = (new ListInterconnectLocationsRequest())->setProject($project); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -214,17 +216,19 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new ListInterconnectLocationsRequest()) - ->setProject($project); + $request = (new ListInterconnectLocationsRequest())->setProject($project); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test diff --git a/Compute/tests/Unit/V1/Client/InterconnectRemoteLocationsClientTest.php b/Compute/tests/Unit/V1/Client/InterconnectRemoteLocationsClientTest.php index 754c612cd459..83599254cc13 100644 --- a/Compute/tests/Unit/V1/Client/InterconnectRemoteLocationsClientTest.php +++ b/Compute/tests/Unit/V1/Client/InterconnectRemoteLocationsClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return InterconnectRemoteLocationsClient */ @@ -138,12 +140,15 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $interconnectRemoteLocation = 'interconnectRemoteLocation1363895773'; @@ -178,9 +183,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new InterconnectRemoteLocation(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new InterconnectRemoteLocationList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -190,8 +193,7 @@ public function listTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new ListInterconnectRemoteLocationsRequest()) - ->setProject($project); + $request = (new ListInterconnectRemoteLocationsRequest())->setProject($project); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -218,17 +220,19 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new ListInterconnectRemoteLocationsRequest()) - ->setProject($project); + $request = (new ListInterconnectRemoteLocationsRequest())->setProject($project); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test diff --git a/Compute/tests/Unit/V1/Client/InterconnectsClientTest.php b/Compute/tests/Unit/V1/Client/InterconnectsClientTest.php index 101d80d47ed5..fd66b67495ec 100644 --- a/Compute/tests/Unit/V1/Client/InterconnectsClientTest.php +++ b/Compute/tests/Unit/V1/Client/InterconnectsClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return InterconnectsClient */ @@ -103,9 +105,7 @@ public function deleteTest() // Mock request $interconnect = 'interconnect-849140594'; $project = 'project-309310695'; - $request = (new DeleteInterconnectRequest()) - ->setInterconnect($interconnect) - ->setProject($project); + $request = (new DeleteInterconnectRequest())->setInterconnect($interconnect)->setProject($project); $response = $gapicClient->delete($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); @@ -162,19 +162,20 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $interconnect = 'interconnect-849140594'; $project = 'project-309310695'; - $request = (new DeleteInterconnectRequest()) - ->setInterconnect($interconnect) - ->setProject($project); + $request = (new DeleteInterconnectRequest())->setInterconnect($interconnect)->setProject($project); $response = $gapicClient->delete($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -257,9 +258,7 @@ public function getTest() // Mock request $interconnect = 'interconnect-849140594'; $project = 'project-309310695'; - $request = (new GetInterconnectRequest()) - ->setInterconnect($interconnect) - ->setProject($project); + $request = (new GetInterconnectRequest())->setInterconnect($interconnect)->setProject($project); $response = $gapicClient->get($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -285,19 +284,20 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $interconnect = 'interconnect-849140594'; $project = 'project-309310695'; - $request = (new GetInterconnectRequest()) - ->setInterconnect($interconnect) - ->setProject($project); + $request = (new GetInterconnectRequest())->setInterconnect($interconnect)->setProject($project); try { $gapicClient->get($request); // If the $gapicClient method call did not throw, fail the test @@ -325,9 +325,7 @@ public function getDiagnosticsTest() // Mock request $interconnect = 'interconnect-849140594'; $project = 'project-309310695'; - $request = (new GetDiagnosticsInterconnectRequest()) - ->setInterconnect($interconnect) - ->setProject($project); + $request = (new GetDiagnosticsInterconnectRequest())->setInterconnect($interconnect)->setProject($project); $response = $gapicClient->getDiagnostics($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -353,19 +351,20 @@ public function getDiagnosticsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $interconnect = 'interconnect-849140594'; $project = 'project-309310695'; - $request = (new GetDiagnosticsInterconnectRequest()) - ->setInterconnect($interconnect) - ->setProject($project); + $request = (new GetDiagnosticsInterconnectRequest())->setInterconnect($interconnect)->setProject($project); try { $gapicClient->getDiagnostics($request); // If the $gapicClient method call did not throw, fail the test @@ -395,9 +394,7 @@ public function getMacsecConfigTest() // Mock request $interconnect = 'interconnect-849140594'; $project = 'project-309310695'; - $request = (new GetMacsecConfigInterconnectRequest()) - ->setInterconnect($interconnect) - ->setProject($project); + $request = (new GetMacsecConfigInterconnectRequest())->setInterconnect($interconnect)->setProject($project); $response = $gapicClient->getMacsecConfig($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -423,19 +420,20 @@ public function getMacsecConfigExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $interconnect = 'interconnect-849140594'; $project = 'project-309310695'; - $request = (new GetMacsecConfigInterconnectRequest()) - ->setInterconnect($interconnect) - ->setProject($project); + $request = (new GetMacsecConfigInterconnectRequest())->setInterconnect($interconnect)->setProject($project); try { $gapicClient->getMacsecConfig($request); // If the $gapicClient method call did not throw, fail the test @@ -536,12 +534,15 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $interconnectResource = new Interconnect(); @@ -583,9 +584,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new Interconnect(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new InterconnectList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -595,8 +594,7 @@ public function listTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new ListInterconnectsRequest()) - ->setProject($project); + $request = (new ListInterconnectsRequest())->setProject($project); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -623,17 +621,19 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new ListInterconnectsRequest()) - ->setProject($project); + $request = (new ListInterconnectsRequest())->setProject($project); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -738,12 +738,15 @@ public function patchExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $interconnect = 'interconnect-849140594'; @@ -864,12 +867,15 @@ public function setLabelsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $globalSetLabelsRequestResource = new GlobalSetLabelsRequest(); @@ -927,9 +933,7 @@ public function deleteAsyncTest() // Mock request $interconnect = 'interconnect-849140594'; $project = 'project-309310695'; - $request = (new DeleteInterconnectRequest()) - ->setInterconnect($interconnect) - ->setProject($project); + $request = (new DeleteInterconnectRequest())->setInterconnect($interconnect)->setProject($project); $response = $gapicClient->delete($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); diff --git a/Compute/tests/Unit/V1/Client/LicenseCodesClientTest.php b/Compute/tests/Unit/V1/Client/LicenseCodesClientTest.php index 7ba6bda1be97..531a2f16f87a 100644 --- a/Compute/tests/Unit/V1/Client/LicenseCodesClientTest.php +++ b/Compute/tests/Unit/V1/Client/LicenseCodesClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return LicenseCodesClient */ @@ -93,9 +95,7 @@ public function getTest() // Mock request $licenseCode = 'licenseCode1612079915'; $project = 'project-309310695'; - $request = (new GetLicenseCodeRequest()) - ->setLicenseCode($licenseCode) - ->setProject($project); + $request = (new GetLicenseCodeRequest())->setLicenseCode($licenseCode)->setProject($project); $response = $gapicClient->get($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -121,19 +121,20 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $licenseCode = 'licenseCode1612079915'; $project = 'project-309310695'; - $request = (new GetLicenseCodeRequest()) - ->setLicenseCode($licenseCode) - ->setProject($project); + $request = (new GetLicenseCodeRequest())->setLicenseCode($licenseCode)->setProject($project); try { $gapicClient->get($request); // If the $gapicClient method call did not throw, fail the test @@ -193,12 +194,15 @@ 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 $project = 'project-309310695'; @@ -251,9 +255,7 @@ public function getAsyncTest() // Mock request $licenseCode = 'licenseCode1612079915'; $project = 'project-309310695'; - $request = (new GetLicenseCodeRequest()) - ->setLicenseCode($licenseCode) - ->setProject($project); + $request = (new GetLicenseCodeRequest())->setLicenseCode($licenseCode)->setProject($project); $response = $gapicClient->getAsync($request)->wait(); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); diff --git a/Compute/tests/Unit/V1/Client/LicensesClientTest.php b/Compute/tests/Unit/V1/Client/LicensesClientTest.php index 114eda362fab..f4228a048cd9 100644 --- a/Compute/tests/Unit/V1/Client/LicensesClientTest.php +++ b/Compute/tests/Unit/V1/Client/LicensesClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return LicensesClient */ @@ -104,9 +106,7 @@ public function deleteTest() // Mock request $license = 'license166757441'; $project = 'project-309310695'; - $request = (new DeleteLicenseRequest()) - ->setLicense($license) - ->setProject($project); + $request = (new DeleteLicenseRequest())->setLicense($license)->setProject($project); $response = $gapicClient->delete($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); @@ -163,19 +163,20 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $license = 'license166757441'; $project = 'project-309310695'; - $request = (new DeleteLicenseRequest()) - ->setLicense($license) - ->setProject($project); + $request = (new DeleteLicenseRequest())->setLicense($license)->setProject($project); $response = $gapicClient->delete($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -242,9 +243,7 @@ public function getTest() // Mock request $license = 'license166757441'; $project = 'project-309310695'; - $request = (new GetLicenseRequest()) - ->setLicense($license) - ->setProject($project); + $request = (new GetLicenseRequest())->setLicense($license)->setProject($project); $response = $gapicClient->get($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -270,19 +269,20 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $license = 'license166757441'; $project = 'project-309310695'; - $request = (new GetLicenseRequest()) - ->setLicense($license) - ->setProject($project); + $request = (new GetLicenseRequest())->setLicense($license)->setProject($project); try { $gapicClient->get($request); // If the $gapicClient method call did not throw, fail the test @@ -316,9 +316,7 @@ public function getIamPolicyTest() // Mock request $project = 'project-309310695'; $resource = 'resource-341064690'; - $request = (new GetIamPolicyLicenseRequest()) - ->setProject($project) - ->setResource($resource); + $request = (new GetIamPolicyLicenseRequest())->setProject($project)->setResource($resource); $response = $gapicClient->getIamPolicy($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -344,19 +342,20 @@ 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 $project = 'project-309310695'; $resource = 'resource-341064690'; - $request = (new GetIamPolicyLicenseRequest()) - ->setProject($project) - ->setResource($resource); + $request = (new GetIamPolicyLicenseRequest())->setProject($project)->setResource($resource); try { $gapicClient->getIamPolicy($request); // If the $gapicClient method call did not throw, fail the test @@ -398,9 +397,7 @@ public function insertTest() // Mock request $licenseResource = new License(); $project = 'project-309310695'; - $request = (new InsertLicenseRequest()) - ->setLicenseResource($licenseResource) - ->setProject($project); + $request = (new InsertLicenseRequest())->setLicenseResource($licenseResource)->setProject($project); $response = $gapicClient->insert($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); @@ -457,19 +454,20 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $licenseResource = new License(); $project = 'project-309310695'; - $request = (new InsertLicenseRequest()) - ->setLicenseResource($licenseResource) - ->setProject($project); + $request = (new InsertLicenseRequest())->setLicenseResource($licenseResource)->setProject($project); $response = $gapicClient->insert($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -503,9 +501,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new License(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new LicensesListResponse(); $expectedResponse->setId($id); $expectedResponse->setNextPageToken($nextPageToken); @@ -514,8 +510,7 @@ public function listTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new ListLicensesRequest()) - ->setProject($project); + $request = (new ListLicensesRequest())->setProject($project); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -542,17 +537,19 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new ListLicensesRequest()) - ->setProject($project); + $request = (new ListLicensesRequest())->setProject($project); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -618,12 +615,15 @@ 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 $globalSetPolicyRequestResource = new GlobalSetPolicyRequest(); @@ -692,12 +692,15 @@ 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 $project = 'project-309310695'; @@ -811,12 +814,15 @@ public function updateExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $license = 'license166757441'; @@ -874,9 +880,7 @@ public function deleteAsyncTest() // Mock request $license = 'license166757441'; $project = 'project-309310695'; - $request = (new DeleteLicenseRequest()) - ->setLicense($license) - ->setProject($project); + $request = (new DeleteLicenseRequest())->setLicense($license)->setProject($project); $response = $gapicClient->delete($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); diff --git a/Compute/tests/Unit/V1/Client/MachineImagesClientTest.php b/Compute/tests/Unit/V1/Client/MachineImagesClientTest.php index e82a43235b24..6e2e65dfc70f 100644 --- a/Compute/tests/Unit/V1/Client/MachineImagesClientTest.php +++ b/Compute/tests/Unit/V1/Client/MachineImagesClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return MachineImagesClient */ @@ -105,9 +107,7 @@ public function deleteTest() // Mock request $machineImage = 'machineImage1142931299'; $project = 'project-309310695'; - $request = (new DeleteMachineImageRequest()) - ->setMachineImage($machineImage) - ->setProject($project); + $request = (new DeleteMachineImageRequest())->setMachineImage($machineImage)->setProject($project); $response = $gapicClient->delete($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); @@ -164,19 +164,20 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $machineImage = 'machineImage1142931299'; $project = 'project-309310695'; - $request = (new DeleteMachineImageRequest()) - ->setMachineImage($machineImage) - ->setProject($project); + $request = (new DeleteMachineImageRequest())->setMachineImage($machineImage)->setProject($project); $response = $gapicClient->delete($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -237,9 +238,7 @@ public function getTest() // Mock request $machineImage = 'machineImage1142931299'; $project = 'project-309310695'; - $request = (new GetMachineImageRequest()) - ->setMachineImage($machineImage) - ->setProject($project); + $request = (new GetMachineImageRequest())->setMachineImage($machineImage)->setProject($project); $response = $gapicClient->get($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -265,19 +264,20 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $machineImage = 'machineImage1142931299'; $project = 'project-309310695'; - $request = (new GetMachineImageRequest()) - ->setMachineImage($machineImage) - ->setProject($project); + $request = (new GetMachineImageRequest())->setMachineImage($machineImage)->setProject($project); try { $gapicClient->get($request); // If the $gapicClient method call did not throw, fail the test @@ -311,9 +311,7 @@ public function getIamPolicyTest() // Mock request $project = 'project-309310695'; $resource = 'resource-341064690'; - $request = (new GetIamPolicyMachineImageRequest()) - ->setProject($project) - ->setResource($resource); + $request = (new GetIamPolicyMachineImageRequest())->setProject($project)->setResource($resource); $response = $gapicClient->getIamPolicy($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -339,19 +337,20 @@ 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 $project = 'project-309310695'; $resource = 'resource-341064690'; - $request = (new GetIamPolicyMachineImageRequest()) - ->setProject($project) - ->setResource($resource); + $request = (new GetIamPolicyMachineImageRequest())->setProject($project)->setResource($resource); try { $gapicClient->getIamPolicy($request); // If the $gapicClient method call did not throw, fail the test @@ -452,12 +451,15 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $machineImageResource = new MachineImage(); @@ -499,9 +501,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new MachineImage(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new MachineImageList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -511,8 +511,7 @@ public function listTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new ListMachineImagesRequest()) - ->setProject($project); + $request = (new ListMachineImagesRequest())->setProject($project); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -539,17 +538,19 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new ListMachineImagesRequest()) - ->setProject($project); + $request = (new ListMachineImagesRequest())->setProject($project); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -615,12 +616,15 @@ 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 $globalSetPolicyRequestResource = new GlobalSetPolicyRequest(); @@ -734,12 +738,15 @@ public function setLabelsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $globalSetLabelsRequestResource = new GlobalSetLabelsRequest(); @@ -815,12 +822,15 @@ 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 $project = 'project-309310695'; @@ -871,9 +881,7 @@ public function deleteAsyncTest() // Mock request $machineImage = 'machineImage1142931299'; $project = 'project-309310695'; - $request = (new DeleteMachineImageRequest()) - ->setMachineImage($machineImage) - ->setProject($project); + $request = (new DeleteMachineImageRequest())->setMachineImage($machineImage)->setProject($project); $response = $gapicClient->delete($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); diff --git a/Compute/tests/Unit/V1/Client/MachineTypesClientTest.php b/Compute/tests/Unit/V1/Client/MachineTypesClientTest.php index 8dcc2fda5adc..90ff6b650505 100644 --- a/Compute/tests/Unit/V1/Client/MachineTypesClientTest.php +++ b/Compute/tests/Unit/V1/Client/MachineTypesClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return MachineTypesClient */ @@ -90,8 +92,7 @@ public function aggregatedListTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListMachineTypesRequest()) - ->setProject($project); + $request = (new AggregatedListMachineTypesRequest())->setProject($project); $response = $gapicClient->aggregatedList($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -120,17 +121,19 @@ public function aggregatedListExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListMachineTypesRequest()) - ->setProject($project); + $request = (new AggregatedListMachineTypesRequest())->setProject($project); try { $gapicClient->aggregatedList($request); // If the $gapicClient method call did not throw, fail the test @@ -218,12 +221,15 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $machineType = 'machineType1838323762'; @@ -260,9 +266,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new MachineType(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new MachineTypeList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -273,9 +277,7 @@ public function listTest() // Mock request $project = 'project-309310695'; $zone = 'zone3744684'; - $request = (new ListMachineTypesRequest()) - ->setProject($project) - ->setZone($zone); + $request = (new ListMachineTypesRequest())->setProject($project)->setZone($zone); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -304,19 +306,20 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $zone = 'zone3744684'; - $request = (new ListMachineTypesRequest()) - ->setProject($project) - ->setZone($zone); + $request = (new ListMachineTypesRequest())->setProject($project)->setZone($zone); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -355,8 +358,7 @@ public function aggregatedListAsyncTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListMachineTypesRequest()) - ->setProject($project); + $request = (new AggregatedListMachineTypesRequest())->setProject($project); $response = $gapicClient->aggregatedListAsync($request)->wait(); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); diff --git a/Compute/tests/Unit/V1/Client/NetworkAttachmentsClientTest.php b/Compute/tests/Unit/V1/Client/NetworkAttachmentsClientTest.php index f6d88b18a889..281de9926006 100644 --- a/Compute/tests/Unit/V1/Client/NetworkAttachmentsClientTest.php +++ b/Compute/tests/Unit/V1/Client/NetworkAttachmentsClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return NetworkAttachmentsClient */ @@ -104,8 +106,7 @@ public function aggregatedListTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListNetworkAttachmentsRequest()) - ->setProject($project); + $request = (new AggregatedListNetworkAttachmentsRequest())->setProject($project); $response = $gapicClient->aggregatedList($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -134,17 +135,19 @@ public function aggregatedListExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListNetworkAttachmentsRequest()) - ->setProject($project); + $request = (new AggregatedListNetworkAttachmentsRequest())->setProject($project); try { $gapicClient->aggregatedList($request); // If the $gapicClient method call did not throw, fail the test @@ -250,12 +253,15 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $networkAttachment = 'networkAttachment1835256788'; @@ -353,12 +359,15 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $networkAttachment = 'networkAttachment1835256788'; @@ -433,12 +442,15 @@ 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 $project = 'project-309310695'; @@ -553,12 +565,15 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $networkAttachmentResource = new NetworkAttachment(); @@ -602,9 +617,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new NetworkAttachment(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new NetworkAttachmentList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -615,9 +628,7 @@ public function listTest() // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListNetworkAttachmentsRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListNetworkAttachmentsRequest())->setProject($project)->setRegion($region); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -646,19 +657,20 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListNetworkAttachmentsRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListNetworkAttachmentsRequest())->setProject($project)->setRegion($region); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -768,12 +780,15 @@ public function patchExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $networkAttachment = 'networkAttachment1835256788'; @@ -861,12 +876,15 @@ 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 $project = 'project-309310695'; @@ -941,12 +959,15 @@ 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 $project = 'project-309310695'; @@ -996,8 +1017,7 @@ public function aggregatedListAsyncTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListNetworkAttachmentsRequest()) - ->setProject($project); + $request = (new AggregatedListNetworkAttachmentsRequest())->setProject($project); $response = $gapicClient->aggregatedListAsync($request)->wait(); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); diff --git a/Compute/tests/Unit/V1/Client/NetworkEdgeSecurityServicesClientTest.php b/Compute/tests/Unit/V1/Client/NetworkEdgeSecurityServicesClientTest.php index e3d9f41d6613..6565aaa03bcc 100644 --- a/Compute/tests/Unit/V1/Client/NetworkEdgeSecurityServicesClientTest.php +++ b/Compute/tests/Unit/V1/Client/NetworkEdgeSecurityServicesClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return NetworkEdgeSecurityServicesClient */ @@ -97,8 +99,7 @@ public function aggregatedListTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListNetworkEdgeSecurityServicesRequest()) - ->setProject($project); + $request = (new AggregatedListNetworkEdgeSecurityServicesRequest())->setProject($project); $response = $gapicClient->aggregatedList($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -127,17 +128,19 @@ public function aggregatedListExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListNetworkEdgeSecurityServicesRequest()) - ->setProject($project); + $request = (new AggregatedListNetworkEdgeSecurityServicesRequest())->setProject($project); try { $gapicClient->aggregatedList($request); // If the $gapicClient method call did not throw, fail the test @@ -243,12 +246,15 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $networkEdgeSecurityService = 'networkEdgeSecurityService693882791'; @@ -344,12 +350,15 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $networkEdgeSecurityService = 'networkEdgeSecurityService693882791'; @@ -464,12 +473,15 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $networkEdgeSecurityServiceResource = new NetworkEdgeSecurityService(); @@ -595,12 +607,15 @@ public function patchExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $networkEdgeSecurityService = 'networkEdgeSecurityService693882791'; @@ -659,8 +674,7 @@ public function aggregatedListAsyncTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListNetworkEdgeSecurityServicesRequest()) - ->setProject($project); + $request = (new AggregatedListNetworkEdgeSecurityServicesRequest())->setProject($project); $response = $gapicClient->aggregatedListAsync($request)->wait(); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); diff --git a/Compute/tests/Unit/V1/Client/NetworkEndpointGroupsClientTest.php b/Compute/tests/Unit/V1/Client/NetworkEndpointGroupsClientTest.php index a715ec2a3491..4ff88a6e7813 100644 --- a/Compute/tests/Unit/V1/Client/NetworkEndpointGroupsClientTest.php +++ b/Compute/tests/Unit/V1/Client/NetworkEndpointGroupsClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return NetworkEndpointGroupsClient */ @@ -107,8 +109,7 @@ public function aggregatedListTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListNetworkEndpointGroupsRequest()) - ->setProject($project); + $request = (new AggregatedListNetworkEndpointGroupsRequest())->setProject($project); $response = $gapicClient->aggregatedList($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -137,17 +138,19 @@ public function aggregatedListExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListNetworkEndpointGroupsRequest()) - ->setProject($project); + $request = (new AggregatedListNetworkEndpointGroupsRequest())->setProject($project); try { $gapicClient->aggregatedList($request); // If the $gapicClient method call did not throw, fail the test @@ -193,7 +196,9 @@ public function attachNetworkEndpointsTest() $zone = 'zone3744684'; $request = (new AttachNetworkEndpointsNetworkEndpointGroupRequest()) ->setNetworkEndpointGroup($networkEndpointGroup) - ->setNetworkEndpointGroupsAttachEndpointsRequestResource($networkEndpointGroupsAttachEndpointsRequestResource) + ->setNetworkEndpointGroupsAttachEndpointsRequestResource( + $networkEndpointGroupsAttachEndpointsRequestResource + ) ->setProject($project) ->setZone($zone); $response = $gapicClient->attachNetworkEndpoints($request); @@ -257,12 +262,15 @@ public function attachNetworkEndpointsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $networkEndpointGroup = 'networkEndpointGroup-639834746'; @@ -271,7 +279,9 @@ public function attachNetworkEndpointsExceptionTest() $zone = 'zone3744684'; $request = (new AttachNetworkEndpointsNetworkEndpointGroupRequest()) ->setNetworkEndpointGroup($networkEndpointGroup) - ->setNetworkEndpointGroupsAttachEndpointsRequestResource($networkEndpointGroupsAttachEndpointsRequestResource) + ->setNetworkEndpointGroupsAttachEndpointsRequestResource( + $networkEndpointGroupsAttachEndpointsRequestResource + ) ->setProject($project) ->setZone($zone); $response = $gapicClient->attachNetworkEndpoints($request); @@ -386,12 +396,15 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $networkEndpointGroup = 'networkEndpointGroup-639834746'; @@ -453,7 +466,9 @@ public function detachNetworkEndpointsTest() $zone = 'zone3744684'; $request = (new DetachNetworkEndpointsNetworkEndpointGroupRequest()) ->setNetworkEndpointGroup($networkEndpointGroup) - ->setNetworkEndpointGroupsDetachEndpointsRequestResource($networkEndpointGroupsDetachEndpointsRequestResource) + ->setNetworkEndpointGroupsDetachEndpointsRequestResource( + $networkEndpointGroupsDetachEndpointsRequestResource + ) ->setProject($project) ->setZone($zone); $response = $gapicClient->detachNetworkEndpoints($request); @@ -517,12 +532,15 @@ public function detachNetworkEndpointsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $networkEndpointGroup = 'networkEndpointGroup-639834746'; @@ -531,7 +549,9 @@ public function detachNetworkEndpointsExceptionTest() $zone = 'zone3744684'; $request = (new DetachNetworkEndpointsNetworkEndpointGroupRequest()) ->setNetworkEndpointGroup($networkEndpointGroup) - ->setNetworkEndpointGroupsDetachEndpointsRequestResource($networkEndpointGroupsDetachEndpointsRequestResource) + ->setNetworkEndpointGroupsDetachEndpointsRequestResource( + $networkEndpointGroupsDetachEndpointsRequestResource + ) ->setProject($project) ->setZone($zone); $response = $gapicClient->detachNetworkEndpoints($request); @@ -628,12 +648,15 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $networkEndpointGroup = 'networkEndpointGroup-639834746'; @@ -748,12 +771,15 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $networkEndpointGroupResource = new NetworkEndpointGroup(); @@ -797,9 +823,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new NetworkEndpointGroup(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new NetworkEndpointGroupList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -810,9 +834,7 @@ public function listTest() // Mock request $project = 'project-309310695'; $zone = 'zone3744684'; - $request = (new ListNetworkEndpointGroupsRequest()) - ->setProject($project) - ->setZone($zone); + $request = (new ListNetworkEndpointGroupsRequest())->setProject($project)->setZone($zone); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -841,19 +863,20 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $zone = 'zone3744684'; - $request = (new ListNetworkEndpointGroupsRequest()) - ->setProject($project) - ->setZone($zone); + $request = (new ListNetworkEndpointGroupsRequest())->setProject($project)->setZone($zone); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -880,9 +903,7 @@ public function listNetworkEndpointsTest() $kind = 'kind3292052'; $nextPageToken = ''; $itemsElement = new NetworkEndpointWithHealthStatus(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new NetworkEndpointGroupsListNetworkEndpoints(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -931,12 +952,15 @@ public function listNetworkEndpointsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $networkEndpointGroup = 'networkEndpointGroup-639834746'; @@ -1011,12 +1035,15 @@ 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 $project = 'project-309310695'; @@ -1066,8 +1093,7 @@ public function aggregatedListAsyncTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListNetworkEndpointGroupsRequest()) - ->setProject($project); + $request = (new AggregatedListNetworkEndpointGroupsRequest())->setProject($project); $response = $gapicClient->aggregatedListAsync($request)->wait(); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); diff --git a/Compute/tests/Unit/V1/Client/NetworkFirewallPoliciesClientTest.php b/Compute/tests/Unit/V1/Client/NetworkFirewallPoliciesClientTest.php index 3177f96f8522..fdbc259934f7 100644 --- a/Compute/tests/Unit/V1/Client/NetworkFirewallPoliciesClientTest.php +++ b/Compute/tests/Unit/V1/Client/NetworkFirewallPoliciesClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return NetworkFirewallPoliciesClient */ @@ -184,12 +186,15 @@ public function addAssociationExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $firewallPolicy = 'firewallPolicy1035044177'; @@ -260,7 +265,10 @@ public function addPacketMirroringRuleTest() $this->assertSame(0, count($operationsRequestsEmpty)); $actualApiFuncCall = $apiRequests[0]->getFuncCall(); $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.NetworkFirewallPolicies/AddPacketMirroringRule', $actualApiFuncCall); + $this->assertSame( + '/google.cloud.compute.v1.NetworkFirewallPolicies/AddPacketMirroringRule', + $actualApiFuncCall + ); $actualValue = $actualApiRequestObject->getFirewallPolicy(); $this->assertProtobufEquals($firewallPolicy, $actualValue); $actualValue = $actualApiRequestObject->getFirewallPolicyRuleResource(); @@ -310,12 +318,15 @@ public function addPacketMirroringRuleExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $firewallPolicy = 'firewallPolicy1035044177'; @@ -436,12 +447,15 @@ public function addRuleExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $firewallPolicy = 'firewallPolicy1035044177'; @@ -496,8 +510,7 @@ public function aggregatedListTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListNetworkFirewallPoliciesRequest()) - ->setProject($project); + $request = (new AggregatedListNetworkFirewallPoliciesRequest())->setProject($project); $response = $gapicClient->aggregatedList($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -526,17 +539,19 @@ public function aggregatedListExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListNetworkFirewallPoliciesRequest()) - ->setProject($project); + $request = (new AggregatedListNetworkFirewallPoliciesRequest())->setProject($project); try { $gapicClient->aggregatedList($request); // If the $gapicClient method call did not throw, fail the test @@ -637,12 +652,15 @@ public function cloneRulesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $firewallPolicy = 'firewallPolicy1035044177'; @@ -698,9 +716,7 @@ public function deleteTest() // Mock request $firewallPolicy = 'firewallPolicy1035044177'; $project = 'project-309310695'; - $request = (new DeleteNetworkFirewallPolicyRequest()) - ->setFirewallPolicy($firewallPolicy) - ->setProject($project); + $request = (new DeleteNetworkFirewallPolicyRequest())->setFirewallPolicy($firewallPolicy)->setProject($project); $response = $gapicClient->delete($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); @@ -757,19 +773,20 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $firewallPolicy = 'firewallPolicy1035044177'; $project = 'project-309310695'; - $request = (new DeleteNetworkFirewallPolicyRequest()) - ->setFirewallPolicy($firewallPolicy) - ->setProject($project); + $request = (new DeleteNetworkFirewallPolicyRequest())->setFirewallPolicy($firewallPolicy)->setProject($project); $response = $gapicClient->delete($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -830,9 +847,7 @@ public function getTest() // Mock request $firewallPolicy = 'firewallPolicy1035044177'; $project = 'project-309310695'; - $request = (new GetNetworkFirewallPolicyRequest()) - ->setFirewallPolicy($firewallPolicy) - ->setProject($project); + $request = (new GetNetworkFirewallPolicyRequest())->setFirewallPolicy($firewallPolicy)->setProject($project); $response = $gapicClient->get($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -858,19 +873,20 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $firewallPolicy = 'firewallPolicy1035044177'; $project = 'project-309310695'; - $request = (new GetNetworkFirewallPolicyRequest()) - ->setFirewallPolicy($firewallPolicy) - ->setProject($project); + $request = (new GetNetworkFirewallPolicyRequest())->setFirewallPolicy($firewallPolicy)->setProject($project); try { $gapicClient->get($request); // If the $gapicClient method call did not throw, fail the test @@ -936,12 +952,15 @@ public function getAssociationExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $firewallPolicy = 'firewallPolicy1035044177'; @@ -982,9 +1001,7 @@ public function getIamPolicyTest() // Mock request $project = 'project-309310695'; $resource = 'resource-341064690'; - $request = (new GetIamPolicyNetworkFirewallPolicyRequest()) - ->setProject($project) - ->setResource($resource); + $request = (new GetIamPolicyNetworkFirewallPolicyRequest())->setProject($project)->setResource($resource); $response = $gapicClient->getIamPolicy($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -1010,19 +1027,20 @@ 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 $project = 'project-309310695'; $resource = 'resource-341064690'; - $request = (new GetIamPolicyNetworkFirewallPolicyRequest()) - ->setProject($project) - ->setResource($resource); + $request = (new GetIamPolicyNetworkFirewallPolicyRequest())->setProject($project)->setResource($resource); try { $gapicClient->getIamPolicy($request); // If the $gapicClient method call did not throw, fail the test @@ -1100,12 +1118,15 @@ public function getPacketMirroringRuleExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $firewallPolicy = 'firewallPolicy1035044177'; @@ -1190,12 +1211,15 @@ public function getRuleExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $firewallPolicy = 'firewallPolicy1035044177'; @@ -1303,12 +1327,15 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $firewallPolicyResource = new FirewallPolicy(); @@ -1349,9 +1376,7 @@ public function listTest() $kind = 'kind3292052'; $nextPageToken = ''; $itemsElement = new FirewallPolicy(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new FirewallPolicyList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -1360,8 +1385,7 @@ public function listTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new ListNetworkFirewallPoliciesRequest()) - ->setProject($project); + $request = (new ListNetworkFirewallPoliciesRequest())->setProject($project); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -1388,17 +1412,19 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new ListNetworkFirewallPoliciesRequest()) - ->setProject($project); + $request = (new ListNetworkFirewallPoliciesRequest())->setProject($project); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -1503,12 +1529,15 @@ public function patchExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $firewallPolicy = 'firewallPolicy1035044177'; @@ -1579,7 +1608,10 @@ public function patchPacketMirroringRuleTest() $this->assertSame(0, count($operationsRequestsEmpty)); $actualApiFuncCall = $apiRequests[0]->getFuncCall(); $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.NetworkFirewallPolicies/PatchPacketMirroringRule', $actualApiFuncCall); + $this->assertSame( + '/google.cloud.compute.v1.NetworkFirewallPolicies/PatchPacketMirroringRule', + $actualApiFuncCall + ); $actualValue = $actualApiRequestObject->getFirewallPolicy(); $this->assertProtobufEquals($firewallPolicy, $actualValue); $actualValue = $actualApiRequestObject->getFirewallPolicyRuleResource(); @@ -1629,12 +1661,15 @@ public function patchPacketMirroringRuleExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $firewallPolicy = 'firewallPolicy1035044177'; @@ -1755,12 +1790,15 @@ public function patchRuleExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $firewallPolicy = 'firewallPolicy1035044177'; @@ -1877,12 +1915,15 @@ public function removeAssociationExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $firewallPolicy = 'firewallPolicy1035044177'; @@ -1949,7 +1990,10 @@ public function removePacketMirroringRuleTest() $this->assertSame(0, count($operationsRequestsEmpty)); $actualApiFuncCall = $apiRequests[0]->getFuncCall(); $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.NetworkFirewallPolicies/RemovePacketMirroringRule', $actualApiFuncCall); + $this->assertSame( + '/google.cloud.compute.v1.NetworkFirewallPolicies/RemovePacketMirroringRule', + $actualApiFuncCall + ); $actualValue = $actualApiRequestObject->getFirewallPolicy(); $this->assertProtobufEquals($firewallPolicy, $actualValue); $actualValue = $actualApiRequestObject->getProject(); @@ -1997,12 +2041,15 @@ public function removePacketMirroringRuleExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $firewallPolicy = 'firewallPolicy1035044177'; @@ -2117,12 +2164,15 @@ public function removeRuleExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $firewallPolicy = 'firewallPolicy1035044177'; @@ -2202,12 +2252,15 @@ 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 $globalSetPolicyRequestResource = new GlobalSetPolicyRequest(); @@ -2276,12 +2329,15 @@ 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 $project = 'project-309310695'; diff --git a/Compute/tests/Unit/V1/Client/NetworkProfilesClientTest.php b/Compute/tests/Unit/V1/Client/NetworkProfilesClientTest.php index 84d6e24edcc3..60705f9faef4 100644 --- a/Compute/tests/Unit/V1/Client/NetworkProfilesClientTest.php +++ b/Compute/tests/Unit/V1/Client/NetworkProfilesClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return NetworkProfilesClient */ @@ -92,9 +94,7 @@ public function getTest() // Mock request $networkProfile = 'networkProfile709983384'; $project = 'project-309310695'; - $request = (new GetNetworkProfileRequest()) - ->setNetworkProfile($networkProfile) - ->setProject($project); + $request = (new GetNetworkProfileRequest())->setNetworkProfile($networkProfile)->setProject($project); $response = $gapicClient->get($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -120,19 +120,20 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $networkProfile = 'networkProfile709983384'; $project = 'project-309310695'; - $request = (new GetNetworkProfileRequest()) - ->setNetworkProfile($networkProfile) - ->setProject($project); + $request = (new GetNetworkProfileRequest())->setNetworkProfile($networkProfile)->setProject($project); try { $gapicClient->get($request); // If the $gapicClient method call did not throw, fail the test @@ -169,8 +170,7 @@ public function listTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new ListNetworkProfilesRequest()) - ->setProject($project); + $request = (new ListNetworkProfilesRequest())->setProject($project); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -194,17 +194,19 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new ListNetworkProfilesRequest()) - ->setProject($project); + $request = (new ListNetworkProfilesRequest())->setProject($project); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -248,9 +250,7 @@ public function getAsyncTest() // Mock request $networkProfile = 'networkProfile709983384'; $project = 'project-309310695'; - $request = (new GetNetworkProfileRequest()) - ->setNetworkProfile($networkProfile) - ->setProject($project); + $request = (new GetNetworkProfileRequest())->setNetworkProfile($networkProfile)->setProject($project); $response = $gapicClient->getAsync($request)->wait(); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); diff --git a/Compute/tests/Unit/V1/Client/NetworksClientTest.php b/Compute/tests/Unit/V1/Client/NetworksClientTest.php index 6a953723edb7..d5596b8aae4a 100644 --- a/Compute/tests/Unit/V1/Client/NetworksClientTest.php +++ b/Compute/tests/Unit/V1/Client/NetworksClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return NetworksClient */ @@ -174,12 +176,15 @@ public function addPeeringExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $network = 'network1843485230'; @@ -237,9 +242,7 @@ public function deleteTest() // Mock request $network = 'network1843485230'; $project = 'project-309310695'; - $request = (new DeleteNetworkRequest()) - ->setNetwork($network) - ->setProject($project); + $request = (new DeleteNetworkRequest())->setNetwork($network)->setProject($project); $response = $gapicClient->delete($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); @@ -296,19 +299,20 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $network = 'network1843485230'; $project = 'project-309310695'; - $request = (new DeleteNetworkRequest()) - ->setNetwork($network) - ->setProject($project); + $request = (new DeleteNetworkRequest())->setNetwork($network)->setProject($project); $response = $gapicClient->delete($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -375,9 +379,7 @@ public function getTest() // Mock request $network = 'network1843485230'; $project = 'project-309310695'; - $request = (new GetNetworkRequest()) - ->setNetwork($network) - ->setProject($project); + $request = (new GetNetworkRequest())->setNetwork($network)->setProject($project); $response = $gapicClient->get($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -403,19 +405,20 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $network = 'network1843485230'; $project = 'project-309310695'; - $request = (new GetNetworkRequest()) - ->setNetwork($network) - ->setProject($project); + $request = (new GetNetworkRequest())->setNetwork($network)->setProject($project); try { $gapicClient->get($request); // If the $gapicClient method call did not throw, fail the test @@ -443,9 +446,7 @@ public function getEffectiveFirewallsTest() // Mock request $network = 'network1843485230'; $project = 'project-309310695'; - $request = (new GetEffectiveFirewallsNetworkRequest()) - ->setNetwork($network) - ->setProject($project); + $request = (new GetEffectiveFirewallsNetworkRequest())->setNetwork($network)->setProject($project); $response = $gapicClient->getEffectiveFirewalls($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -471,19 +472,20 @@ public function getEffectiveFirewallsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $network = 'network1843485230'; $project = 'project-309310695'; - $request = (new GetEffectiveFirewallsNetworkRequest()) - ->setNetwork($network) - ->setProject($project); + $request = (new GetEffectiveFirewallsNetworkRequest())->setNetwork($network)->setProject($project); try { $gapicClient->getEffectiveFirewalls($request); // If the $gapicClient method call did not throw, fail the test @@ -525,9 +527,7 @@ public function insertTest() // Mock request $networkResource = new Network(); $project = 'project-309310695'; - $request = (new InsertNetworkRequest()) - ->setNetworkResource($networkResource) - ->setProject($project); + $request = (new InsertNetworkRequest())->setNetworkResource($networkResource)->setProject($project); $response = $gapicClient->insert($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); @@ -584,19 +584,20 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $networkResource = new Network(); $project = 'project-309310695'; - $request = (new InsertNetworkRequest()) - ->setNetworkResource($networkResource) - ->setProject($project); + $request = (new InsertNetworkRequest())->setNetworkResource($networkResource)->setProject($project); $response = $gapicClient->insert($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -631,9 +632,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new Network(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new NetworkList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -643,8 +642,7 @@ public function listTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new ListNetworksRequest()) - ->setProject($project); + $request = (new ListNetworksRequest())->setProject($project); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -671,17 +669,19 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new ListNetworksRequest()) - ->setProject($project); + $request = (new ListNetworksRequest())->setProject($project); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -709,9 +709,7 @@ public function listPeeringRoutesTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new ExchangedPeeringRoute(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new ExchangedPeeringRoutesList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -722,9 +720,7 @@ public function listPeeringRoutesTest() // Mock request $network = 'network1843485230'; $project = 'project-309310695'; - $request = (new ListPeeringRoutesNetworksRequest()) - ->setNetwork($network) - ->setProject($project); + $request = (new ListPeeringRoutesNetworksRequest())->setNetwork($network)->setProject($project); $response = $gapicClient->listPeeringRoutes($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -753,19 +749,20 @@ 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 $network = 'network1843485230'; $project = 'project-309310695'; - $request = (new ListPeeringRoutesNetworksRequest()) - ->setNetwork($network) - ->setProject($project); + $request = (new ListPeeringRoutesNetworksRequest())->setNetwork($network)->setProject($project); try { $gapicClient->listPeeringRoutes($request); // If the $gapicClient method call did not throw, fail the test @@ -870,12 +867,15 @@ public function patchExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $network = 'network1843485230'; @@ -996,12 +996,15 @@ public function removePeeringExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $network = 'network1843485230'; @@ -1122,12 +1125,15 @@ public function requestRemovePeeringExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $network = 'network1843485230'; @@ -1185,9 +1191,7 @@ public function switchToCustomModeTest() // Mock request $network = 'network1843485230'; $project = 'project-309310695'; - $request = (new SwitchToCustomModeNetworkRequest()) - ->setNetwork($network) - ->setProject($project); + $request = (new SwitchToCustomModeNetworkRequest())->setNetwork($network)->setProject($project); $response = $gapicClient->switchToCustomMode($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); @@ -1244,19 +1248,20 @@ public function switchToCustomModeExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $network = 'network1843485230'; $project = 'project-309310695'; - $request = (new SwitchToCustomModeNetworkRequest()) - ->setNetwork($network) - ->setProject($project); + $request = (new SwitchToCustomModeNetworkRequest())->setNetwork($network)->setProject($project); $response = $gapicClient->switchToCustomMode($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1368,12 +1373,15 @@ public function updatePeeringExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $network = 'network1843485230'; diff --git a/Compute/tests/Unit/V1/Client/NodeGroupsClientTest.php b/Compute/tests/Unit/V1/Client/NodeGroupsClientTest.php index bbca426460de..7f15cb8a210a 100644 --- a/Compute/tests/Unit/V1/Client/NodeGroupsClientTest.php +++ b/Compute/tests/Unit/V1/Client/NodeGroupsClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return NodeGroupsClient */ @@ -188,12 +190,15 @@ public function addNodesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $nodeGroup = 'nodeGroup1543699970'; @@ -250,8 +255,7 @@ public function aggregatedListTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListNodeGroupsRequest()) - ->setProject($project); + $request = (new AggregatedListNodeGroupsRequest())->setProject($project); $response = $gapicClient->aggregatedList($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -280,17 +284,19 @@ public function aggregatedListExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListNodeGroupsRequest()) - ->setProject($project); + $request = (new AggregatedListNodeGroupsRequest())->setProject($project); try { $gapicClient->aggregatedList($request); // If the $gapicClient method call did not throw, fail the test @@ -396,12 +402,15 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $nodeGroup = 'nodeGroup1543699970'; @@ -527,12 +536,15 @@ public function deleteNodesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $nodeGroup = 'nodeGroup1543699970'; @@ -638,12 +650,15 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $nodeGroup = 'nodeGroup1543699970'; @@ -718,12 +733,15 @@ 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 $project = 'project-309310695'; @@ -842,12 +860,15 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $initialNodeCount = 1682564205; @@ -893,9 +914,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new NodeGroup(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new NodeGroupList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -906,9 +925,7 @@ public function listTest() // Mock request $project = 'project-309310695'; $zone = 'zone3744684'; - $request = (new ListNodeGroupsRequest()) - ->setProject($project) - ->setZone($zone); + $request = (new ListNodeGroupsRequest())->setProject($project)->setZone($zone); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -937,19 +954,20 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $zone = 'zone3744684'; - $request = (new ListNodeGroupsRequest()) - ->setProject($project) - ->setZone($zone); + $request = (new ListNodeGroupsRequest())->setProject($project)->setZone($zone); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -977,9 +995,7 @@ public function listNodesTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new NodeGroupNode(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new NodeGroupsListNodes(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -1025,12 +1041,15 @@ 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 $nodeGroup = 'nodeGroup1543699970'; @@ -1149,12 +1168,15 @@ public function patchExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $nodeGroup = 'nodeGroup1543699970'; @@ -1282,12 +1304,15 @@ public function performMaintenanceExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $nodeGroup = 'nodeGroup1543699970'; @@ -1375,12 +1400,15 @@ 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 $project = 'project-309310695'; @@ -1501,12 +1529,15 @@ public function setNodeTemplateExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $nodeGroup = 'nodeGroup1543699970'; @@ -1634,12 +1665,15 @@ public function simulateMaintenanceEventExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $nodeGroup = 'nodeGroup1543699970'; @@ -1721,12 +1755,15 @@ 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 $project = 'project-309310695'; diff --git a/Compute/tests/Unit/V1/Client/NodeTemplatesClientTest.php b/Compute/tests/Unit/V1/Client/NodeTemplatesClientTest.php index ed515a122b49..0ec92f916484 100644 --- a/Compute/tests/Unit/V1/Client/NodeTemplatesClientTest.php +++ b/Compute/tests/Unit/V1/Client/NodeTemplatesClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return NodeTemplatesClient */ @@ -103,8 +105,7 @@ public function aggregatedListTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListNodeTemplatesRequest()) - ->setProject($project); + $request = (new AggregatedListNodeTemplatesRequest())->setProject($project); $response = $gapicClient->aggregatedList($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -133,17 +134,19 @@ public function aggregatedListExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListNodeTemplatesRequest()) - ->setProject($project); + $request = (new AggregatedListNodeTemplatesRequest())->setProject($project); try { $gapicClient->aggregatedList($request); // If the $gapicClient method call did not throw, fail the test @@ -249,12 +252,15 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $nodeTemplate = 'nodeTemplate323154455'; @@ -352,12 +358,15 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $nodeTemplate = 'nodeTemplate323154455'; @@ -432,12 +441,15 @@ 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 $project = 'project-309310695'; @@ -552,12 +564,15 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $nodeTemplateResource = new NodeTemplate(); @@ -601,9 +616,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new NodeTemplate(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new NodeTemplateList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -614,9 +627,7 @@ public function listTest() // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListNodeTemplatesRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListNodeTemplatesRequest())->setProject($project)->setRegion($region); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -645,19 +656,20 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListNodeTemplatesRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListNodeTemplatesRequest())->setProject($project)->setRegion($region); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -727,12 +739,15 @@ 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 $project = 'project-309310695'; @@ -807,12 +822,15 @@ 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 $project = 'project-309310695'; @@ -862,8 +880,7 @@ public function aggregatedListAsyncTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListNodeTemplatesRequest()) - ->setProject($project); + $request = (new AggregatedListNodeTemplatesRequest())->setProject($project); $response = $gapicClient->aggregatedListAsync($request)->wait(); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); diff --git a/Compute/tests/Unit/V1/Client/NodeTypesClientTest.php b/Compute/tests/Unit/V1/Client/NodeTypesClientTest.php index b422e9f1d85e..3fbae22a109e 100644 --- a/Compute/tests/Unit/V1/Client/NodeTypesClientTest.php +++ b/Compute/tests/Unit/V1/Client/NodeTypesClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return NodeTypesClient */ @@ -90,8 +92,7 @@ public function aggregatedListTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListNodeTypesRequest()) - ->setProject($project); + $request = (new AggregatedListNodeTypesRequest())->setProject($project); $response = $gapicClient->aggregatedList($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -120,17 +121,19 @@ public function aggregatedListExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListNodeTypesRequest()) - ->setProject($project); + $request = (new AggregatedListNodeTypesRequest())->setProject($project); try { $gapicClient->aggregatedList($request); // If the $gapicClient method call did not throw, fail the test @@ -214,12 +217,15 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $nodeType = 'nodeType465832791'; @@ -256,9 +262,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new NodeType(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new NodeTypeList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -269,9 +273,7 @@ public function listTest() // Mock request $project = 'project-309310695'; $zone = 'zone3744684'; - $request = (new ListNodeTypesRequest()) - ->setProject($project) - ->setZone($zone); + $request = (new ListNodeTypesRequest())->setProject($project)->setZone($zone); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -300,19 +302,20 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $zone = 'zone3744684'; - $request = (new ListNodeTypesRequest()) - ->setProject($project) - ->setZone($zone); + $request = (new ListNodeTypesRequest())->setProject($project)->setZone($zone); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -351,8 +354,7 @@ public function aggregatedListAsyncTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListNodeTypesRequest()) - ->setProject($project); + $request = (new AggregatedListNodeTypesRequest())->setProject($project); $response = $gapicClient->aggregatedListAsync($request)->wait(); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); diff --git a/Compute/tests/Unit/V1/Client/PacketMirroringsClientTest.php b/Compute/tests/Unit/V1/Client/PacketMirroringsClientTest.php index a105858754e5..ff7dedb37e36 100644 --- a/Compute/tests/Unit/V1/Client/PacketMirroringsClientTest.php +++ b/Compute/tests/Unit/V1/Client/PacketMirroringsClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return PacketMirroringsClient */ @@ -100,8 +102,7 @@ public function aggregatedListTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListPacketMirroringsRequest()) - ->setProject($project); + $request = (new AggregatedListPacketMirroringsRequest())->setProject($project); $response = $gapicClient->aggregatedList($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -130,17 +131,19 @@ public function aggregatedListExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListPacketMirroringsRequest()) - ->setProject($project); + $request = (new AggregatedListPacketMirroringsRequest())->setProject($project); try { $gapicClient->aggregatedList($request); // If the $gapicClient method call did not throw, fail the test @@ -246,12 +249,15 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $packetMirroring = 'packetMirroring22305996'; @@ -345,12 +351,15 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $packetMirroring = 'packetMirroring22305996'; @@ -465,12 +474,15 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $packetMirroringResource = new PacketMirroring(); @@ -514,9 +526,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new PacketMirroring(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new PacketMirroringList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -527,9 +537,7 @@ public function listTest() // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListPacketMirroringsRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListPacketMirroringsRequest())->setProject($project)->setRegion($region); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -558,19 +566,20 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListPacketMirroringsRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListPacketMirroringsRequest())->setProject($project)->setRegion($region); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -680,12 +689,15 @@ public function patchExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $packetMirroring = 'packetMirroring22305996'; @@ -767,12 +779,15 @@ 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 $project = 'project-309310695'; @@ -822,8 +837,7 @@ public function aggregatedListAsyncTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListPacketMirroringsRequest()) - ->setProject($project); + $request = (new AggregatedListPacketMirroringsRequest())->setProject($project); $response = $gapicClient->aggregatedListAsync($request)->wait(); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); diff --git a/Compute/tests/Unit/V1/Client/ProjectsClientTest.php b/Compute/tests/Unit/V1/Client/ProjectsClientTest.php index 6dbbfc2c6671..c6a5784002c6 100644 --- a/Compute/tests/Unit/V1/Client/ProjectsClientTest.php +++ b/Compute/tests/Unit/V1/Client/ProjectsClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return ProjectsClient */ @@ -116,8 +118,7 @@ public function disableXpnHostTest() $operationsTransport->addResponse($completeOperation); // Mock request $project = 'project-309310695'; - $request = (new DisableXpnHostProjectRequest()) - ->setProject($project); + $request = (new DisableXpnHostProjectRequest())->setProject($project); $response = $gapicClient->disableXpnHost($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); @@ -172,17 +173,19 @@ public function disableXpnHostExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; - $request = (new DisableXpnHostProjectRequest()) - ->setProject($project); + $request = (new DisableXpnHostProjectRequest())->setProject($project); $response = $gapicClient->disableXpnHost($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -290,12 +293,15 @@ public function disableXpnResourceExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -350,8 +356,7 @@ public function enableXpnHostTest() $operationsTransport->addResponse($completeOperation); // Mock request $project = 'project-309310695'; - $request = (new EnableXpnHostProjectRequest()) - ->setProject($project); + $request = (new EnableXpnHostProjectRequest())->setProject($project); $response = $gapicClient->enableXpnHost($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); @@ -406,17 +411,19 @@ public function enableXpnHostExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; - $request = (new EnableXpnHostProjectRequest()) - ->setProject($project); + $request = (new EnableXpnHostProjectRequest())->setProject($project); $response = $gapicClient->enableXpnHost($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -524,12 +531,15 @@ public function enableXpnResourceExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -592,8 +602,7 @@ public function getTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new GetProjectRequest()) - ->setProject($project); + $request = (new GetProjectRequest())->setProject($project); $response = $gapicClient->get($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -617,17 +626,19 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new GetProjectRequest()) - ->setProject($project); + $request = (new GetProjectRequest())->setProject($project); try { $gapicClient->get($request); // If the $gapicClient method call did not throw, fail the test @@ -676,8 +687,7 @@ public function getXpnHostTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new GetXpnHostProjectRequest()) - ->setProject($project); + $request = (new GetXpnHostProjectRequest())->setProject($project); $response = $gapicClient->getXpnHost($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -701,17 +711,19 @@ public function getXpnHostExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new GetXpnHostProjectRequest()) - ->setProject($project); + $request = (new GetXpnHostProjectRequest())->setProject($project); try { $gapicClient->getXpnHost($request); // If the $gapicClient method call did not throw, fail the test @@ -737,9 +749,7 @@ public function getXpnResourcesTest() $kind = 'kind3292052'; $nextPageToken = ''; $resourcesElement = new XpnResourceId(); - $resources = [ - $resourcesElement, - ]; + $resources = [$resourcesElement]; $expectedResponse = new ProjectsGetXpnResources(); $expectedResponse->setKind($kind); $expectedResponse->setNextPageToken($nextPageToken); @@ -747,8 +757,7 @@ public function getXpnResourcesTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new GetXpnResourcesProjectsRequest()) - ->setProject($project); + $request = (new GetXpnResourcesProjectsRequest())->setProject($project); $response = $gapicClient->getXpnResources($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -775,17 +784,19 @@ public function getXpnResourcesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new GetXpnResourcesProjectsRequest()) - ->setProject($project); + $request = (new GetXpnResourcesProjectsRequest())->setProject($project); try { $gapicClient->getXpnResources($request); // If the $gapicClient method call did not throw, fail the test @@ -813,9 +824,7 @@ public function listXpnHostsTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new Project(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new XpnHostList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -857,12 +866,15 @@ public function listXpnHostsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; @@ -970,12 +982,15 @@ public function moveDiskExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $diskMoveRequestResource = new DiskMoveRequest(); @@ -1090,12 +1105,15 @@ public function moveInstanceExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instanceMoveRequestResource = new InstanceMoveRequest(); @@ -1210,12 +1228,15 @@ public function setCloudArmorTierExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -1330,12 +1351,15 @@ public function setCommonInstanceMetadataExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $metadataResource = new Metadata(); @@ -1450,12 +1474,15 @@ public function setDefaultNetworkTierExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -1570,12 +1597,15 @@ public function setUsageExportBucketExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -1630,8 +1660,7 @@ public function disableXpnHostAsyncTest() $operationsTransport->addResponse($completeOperation); // Mock request $project = 'project-309310695'; - $request = (new DisableXpnHostProjectRequest()) - ->setProject($project); + $request = (new DisableXpnHostProjectRequest())->setProject($project); $response = $gapicClient->disableXpnHost($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); diff --git a/Compute/tests/Unit/V1/Client/PublicAdvertisedPrefixesClientTest.php b/Compute/tests/Unit/V1/Client/PublicAdvertisedPrefixesClientTest.php index bd889c438e66..a7d5a9252eec 100644 --- a/Compute/tests/Unit/V1/Client/PublicAdvertisedPrefixesClientTest.php +++ b/Compute/tests/Unit/V1/Client/PublicAdvertisedPrefixesClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return PublicAdvertisedPrefixesClient */ @@ -158,12 +160,15 @@ public function announceExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -278,12 +283,15 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -379,12 +387,15 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; @@ -492,12 +503,15 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -539,9 +553,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new PublicAdvertisedPrefix(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new PublicAdvertisedPrefixList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -551,8 +563,7 @@ public function listTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new ListPublicAdvertisedPrefixesRequest()) - ->setProject($project); + $request = (new ListPublicAdvertisedPrefixesRequest())->setProject($project); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -579,17 +590,19 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new ListPublicAdvertisedPrefixesRequest()) - ->setProject($project); + $request = (new ListPublicAdvertisedPrefixesRequest())->setProject($project); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -694,12 +707,15 @@ public function patchExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -816,12 +832,15 @@ public function withdrawExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; diff --git a/Compute/tests/Unit/V1/Client/PublicDelegatedPrefixesClientTest.php b/Compute/tests/Unit/V1/Client/PublicDelegatedPrefixesClientTest.php index a0f8b9a77be7..dd8c3d4e1cdf 100644 --- a/Compute/tests/Unit/V1/Client/PublicDelegatedPrefixesClientTest.php +++ b/Compute/tests/Unit/V1/Client/PublicDelegatedPrefixesClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return PublicDelegatedPrefixesClient */ @@ -99,8 +101,7 @@ public function aggregatedListTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListPublicDelegatedPrefixesRequest()) - ->setProject($project); + $request = (new AggregatedListPublicDelegatedPrefixesRequest())->setProject($project); $response = $gapicClient->aggregatedList($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -129,17 +130,19 @@ public function aggregatedListExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListPublicDelegatedPrefixesRequest()) - ->setProject($project); + $request = (new AggregatedListPublicDelegatedPrefixesRequest())->setProject($project); try { $gapicClient->aggregatedList($request); // If the $gapicClient method call did not throw, fail the test @@ -245,12 +248,15 @@ public function announceExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -372,12 +378,15 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -483,12 +492,15 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; @@ -603,12 +615,15 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -652,9 +667,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new PublicDelegatedPrefix(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new PublicDelegatedPrefixList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -665,9 +678,7 @@ public function listTest() // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListPublicDelegatedPrefixesRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListPublicDelegatedPrefixesRequest())->setProject($project)->setRegion($region); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -696,19 +707,20 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListPublicDelegatedPrefixesRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListPublicDelegatedPrefixesRequest())->setProject($project)->setRegion($region); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -818,12 +830,15 @@ public function patchExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -947,12 +962,15 @@ public function withdrawExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -1007,8 +1025,7 @@ public function aggregatedListAsyncTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListPublicDelegatedPrefixesRequest()) - ->setProject($project); + $request = (new AggregatedListPublicDelegatedPrefixesRequest())->setProject($project); $response = $gapicClient->aggregatedListAsync($request)->wait(); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); diff --git a/Compute/tests/Unit/V1/Client/RegionAutoscalersClientTest.php b/Compute/tests/Unit/V1/Client/RegionAutoscalersClientTest.php index 9ef1930ba72d..94bb0b600fc4 100644 --- a/Compute/tests/Unit/V1/Client/RegionAutoscalersClientTest.php +++ b/Compute/tests/Unit/V1/Client/RegionAutoscalersClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return RegionAutoscalersClient */ @@ -162,12 +164,15 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $autoscaler = 'autoscaler517258967'; @@ -265,12 +270,15 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $autoscaler = 'autoscaler517258967'; @@ -385,12 +393,15 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $autoscalerResource = new Autoscaler(); @@ -434,9 +445,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new Autoscaler(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new RegionAutoscalerList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -447,9 +456,7 @@ public function listTest() // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListRegionAutoscalersRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListRegionAutoscalersRequest())->setProject($project)->setRegion($region); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -478,19 +485,20 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListRegionAutoscalersRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListRegionAutoscalersRequest())->setProject($project)->setRegion($region); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -596,12 +604,15 @@ public function patchExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $autoscalerResource = new Autoscaler(); @@ -723,12 +734,15 @@ public function updateExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $autoscalerResource = new Autoscaler(); diff --git a/Compute/tests/Unit/V1/Client/RegionBackendServicesClientTest.php b/Compute/tests/Unit/V1/Client/RegionBackendServicesClientTest.php index 9c49999b69ce..10ff4a08d554 100644 --- a/Compute/tests/Unit/V1/Client/RegionBackendServicesClientTest.php +++ b/Compute/tests/Unit/V1/Client/RegionBackendServicesClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return RegionBackendServicesClient */ @@ -176,12 +178,15 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $backendService = 'backendService306946058'; @@ -307,12 +312,15 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $backendService = 'backendService306946058'; @@ -387,12 +395,15 @@ public function getHealthExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $backendService = 'backendService306946058'; @@ -469,12 +480,15 @@ 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 $project = 'project-309310695'; @@ -589,12 +603,15 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $backendServiceResource = new BackendService(); @@ -638,9 +655,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new BackendService(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new BackendServiceList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -651,9 +666,7 @@ public function listTest() // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListRegionBackendServicesRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListRegionBackendServicesRequest())->setProject($project)->setRegion($region); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -682,19 +695,20 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListRegionBackendServicesRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListRegionBackendServicesRequest())->setProject($project)->setRegion($region); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -722,9 +736,7 @@ public function listUsableTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new BackendService(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new BackendServiceListUsable(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -735,9 +747,7 @@ public function listUsableTest() // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListUsableRegionBackendServicesRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListUsableRegionBackendServicesRequest())->setProject($project)->setRegion($region); $response = $gapicClient->listUsable($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -766,19 +776,20 @@ public function listUsableExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListUsableRegionBackendServicesRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListUsableRegionBackendServicesRequest())->setProject($project)->setRegion($region); try { $gapicClient->listUsable($request); // If the $gapicClient method call did not throw, fail the test @@ -888,12 +899,15 @@ public function patchExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $backendService = 'backendService306946058'; @@ -981,12 +995,15 @@ 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 $project = 'project-309310695'; @@ -1107,12 +1124,15 @@ public function setSecurityPolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $backendService = 'backendService306946058'; @@ -1194,12 +1214,15 @@ 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 $project = 'project-309310695'; @@ -1320,12 +1343,15 @@ public function updateExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $backendService = 'backendService306946058'; diff --git a/Compute/tests/Unit/V1/Client/RegionCommitmentsClientTest.php b/Compute/tests/Unit/V1/Client/RegionCommitmentsClientTest.php index d3b4847fa69e..8bea7e00139a 100644 --- a/Compute/tests/Unit/V1/Client/RegionCommitmentsClientTest.php +++ b/Compute/tests/Unit/V1/Client/RegionCommitmentsClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return RegionCommitmentsClient */ @@ -96,8 +98,7 @@ public function aggregatedListTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListRegionCommitmentsRequest()) - ->setProject($project); + $request = (new AggregatedListRegionCommitmentsRequest())->setProject($project); $response = $gapicClient->aggregatedList($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -126,17 +127,19 @@ public function aggregatedListExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListRegionCommitmentsRequest()) - ->setProject($project); + $request = (new AggregatedListRegionCommitmentsRequest())->setProject($project); try { $gapicClient->aggregatedList($request); // If the $gapicClient method call did not throw, fail the test @@ -230,12 +233,15 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $commitment = 'commitment1019005717'; @@ -350,12 +356,15 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $commitmentResource = new Commitment(); @@ -399,9 +408,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new Commitment(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new CommitmentList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -412,9 +419,7 @@ public function listTest() // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListRegionCommitmentsRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListRegionCommitmentsRequest())->setProject($project)->setRegion($region); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -443,19 +448,20 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListRegionCommitmentsRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListRegionCommitmentsRequest())->setProject($project)->setRegion($region); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -565,12 +571,15 @@ public function updateExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $commitment = 'commitment1019005717'; @@ -627,8 +636,7 @@ public function aggregatedListAsyncTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListRegionCommitmentsRequest()) - ->setProject($project); + $request = (new AggregatedListRegionCommitmentsRequest())->setProject($project); $response = $gapicClient->aggregatedListAsync($request)->wait(); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); diff --git a/Compute/tests/Unit/V1/Client/RegionDiskTypesClientTest.php b/Compute/tests/Unit/V1/Client/RegionDiskTypesClientTest.php index 14a8980d01a3..70dfef0dc675 100644 --- a/Compute/tests/Unit/V1/Client/RegionDiskTypesClientTest.php +++ b/Compute/tests/Unit/V1/Client/RegionDiskTypesClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return RegionDiskTypesClient */ @@ -128,12 +130,15 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $diskType = 'diskType93009052'; @@ -170,9 +175,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new DiskType(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new RegionDiskTypeList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -183,9 +186,7 @@ public function listTest() // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListRegionDiskTypesRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListRegionDiskTypesRequest())->setProject($project)->setRegion($region); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -214,19 +215,20 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListRegionDiskTypesRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListRegionDiskTypesRequest())->setProject($project)->setRegion($region); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test diff --git a/Compute/tests/Unit/V1/Client/RegionDisksClientTest.php b/Compute/tests/Unit/V1/Client/RegionDisksClientTest.php index 69f49293dcc7..9b9242f55a57 100644 --- a/Compute/tests/Unit/V1/Client/RegionDisksClientTest.php +++ b/Compute/tests/Unit/V1/Client/RegionDisksClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return RegionDisksClient */ @@ -189,12 +191,15 @@ public function addResourcePoliciesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $disk = 'disk3083677'; @@ -318,12 +323,15 @@ public function bulkInsertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $bulkInsertDiskResourceResource = new BulkInsertDiskResource(); @@ -449,12 +457,15 @@ public function createSnapshotExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $disk = 'disk3083677'; @@ -578,12 +589,15 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $disk = 'disk3083677'; @@ -731,12 +745,15 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $disk = 'disk3083677'; @@ -811,12 +828,15 @@ 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 $project = 'project-309310695'; @@ -931,12 +951,15 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $diskResource = new Disk(); @@ -980,9 +1003,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new Disk(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new DiskList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -993,9 +1014,7 @@ public function listTest() // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListRegionDisksRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListRegionDisksRequest())->setProject($project)->setRegion($region); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -1024,19 +1043,20 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListRegionDisksRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListRegionDisksRequest())->setProject($project)->setRegion($region); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -1146,12 +1166,15 @@ public function removeResourcePoliciesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $disk = 'disk3083677'; @@ -1279,12 +1302,15 @@ public function resizeExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $disk = 'disk3083677'; @@ -1372,12 +1398,15 @@ 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 $project = 'project-309310695'; @@ -1498,12 +1527,15 @@ public function setLabelsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -1631,12 +1663,15 @@ public function startAsyncReplicationExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $disk = 'disk3083677'; @@ -1760,12 +1795,15 @@ public function stopAsyncReplicationExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $disk = 'disk3083677'; @@ -1887,12 +1925,15 @@ public function stopGroupAsyncReplicationExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $disksStopGroupAsyncReplicationResourceResource = new DisksStopGroupAsyncReplicationResource(); @@ -1972,12 +2013,15 @@ 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 $project = 'project-309310695'; @@ -2098,12 +2142,15 @@ public function updateExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $disk = 'disk3083677'; diff --git a/Compute/tests/Unit/V1/Client/RegionHealthCheckServicesClientTest.php b/Compute/tests/Unit/V1/Client/RegionHealthCheckServicesClientTest.php index 32ff090dd9f9..e3326a454c6f 100644 --- a/Compute/tests/Unit/V1/Client/RegionHealthCheckServicesClientTest.php +++ b/Compute/tests/Unit/V1/Client/RegionHealthCheckServicesClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return RegionHealthCheckServicesClient */ @@ -161,12 +163,15 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $healthCheckService = 'healthCheckService-665367077'; @@ -260,12 +265,15 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $healthCheckService = 'healthCheckService-665367077'; @@ -380,12 +388,15 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $healthCheckServiceResource = new HealthCheckService(); @@ -429,9 +440,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new HealthCheckService(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new HealthCheckServicesList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -442,9 +451,7 @@ public function listTest() // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListRegionHealthCheckServicesRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListRegionHealthCheckServicesRequest())->setProject($project)->setRegion($region); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -473,19 +480,20 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListRegionHealthCheckServicesRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListRegionHealthCheckServicesRequest())->setProject($project)->setRegion($region); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -595,12 +603,15 @@ public function patchExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $healthCheckService = 'healthCheckService-665367077'; diff --git a/Compute/tests/Unit/V1/Client/RegionHealthChecksClientTest.php b/Compute/tests/Unit/V1/Client/RegionHealthChecksClientTest.php index 4d30f0acbb2a..87cadcedb237 100644 --- a/Compute/tests/Unit/V1/Client/RegionHealthChecksClientTest.php +++ b/Compute/tests/Unit/V1/Client/RegionHealthChecksClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return RegionHealthChecksClient */ @@ -162,12 +164,15 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $healthCheck = 'healthCheck845747557'; @@ -267,12 +272,15 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $healthCheck = 'healthCheck845747557'; @@ -387,12 +395,15 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $healthCheckResource = new HealthCheck(); @@ -436,9 +447,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new HealthCheck(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new HealthCheckList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -449,9 +458,7 @@ public function listTest() // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListRegionHealthChecksRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListRegionHealthChecksRequest())->setProject($project)->setRegion($region); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -480,19 +487,20 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListRegionHealthChecksRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListRegionHealthChecksRequest())->setProject($project)->setRegion($region); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -602,12 +610,15 @@ public function patchExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $healthCheck = 'healthCheck845747557'; @@ -735,12 +746,15 @@ public function updateExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $healthCheck = 'healthCheck845747557'; diff --git a/Compute/tests/Unit/V1/Client/RegionInstanceGroupManagersClientTest.php b/Compute/tests/Unit/V1/Client/RegionInstanceGroupManagersClientTest.php index bda936d47826..307630f7c685 100644 --- a/Compute/tests/Unit/V1/Client/RegionInstanceGroupManagersClientTest.php +++ b/Compute/tests/Unit/V1/Client/RegionInstanceGroupManagersClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return RegionInstanceGroupManagersClient */ @@ -141,7 +143,9 @@ public function abandonInstancesTest() ->setInstanceGroupManager($instanceGroupManager) ->setProject($project) ->setRegion($region) - ->setRegionInstanceGroupManagersAbandonInstancesRequestResource($regionInstanceGroupManagersAbandonInstancesRequestResource); + ->setRegionInstanceGroupManagersAbandonInstancesRequestResource( + $regionInstanceGroupManagersAbandonInstancesRequestResource + ); $response = $gapicClient->abandonInstances($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); @@ -203,12 +207,15 @@ public function abandonInstancesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instanceGroupManager = 'instanceGroupManager-1361249341'; @@ -219,7 +226,9 @@ public function abandonInstancesExceptionTest() ->setInstanceGroupManager($instanceGroupManager) ->setProject($project) ->setRegion($region) - ->setRegionInstanceGroupManagersAbandonInstancesRequestResource($regionInstanceGroupManagersAbandonInstancesRequestResource); + ->setRegionInstanceGroupManagersAbandonInstancesRequestResource( + $regionInstanceGroupManagersAbandonInstancesRequestResource + ); $response = $gapicClient->abandonInstances($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -274,7 +283,9 @@ public function applyUpdatesToInstancesTest() ->setInstanceGroupManager($instanceGroupManager) ->setProject($project) ->setRegion($region) - ->setRegionInstanceGroupManagersApplyUpdatesRequestResource($regionInstanceGroupManagersApplyUpdatesRequestResource); + ->setRegionInstanceGroupManagersApplyUpdatesRequestResource( + $regionInstanceGroupManagersApplyUpdatesRequestResource + ); $response = $gapicClient->applyUpdatesToInstances($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); @@ -283,7 +294,10 @@ public function applyUpdatesToInstancesTest() $this->assertSame(0, count($operationsRequestsEmpty)); $actualApiFuncCall = $apiRequests[0]->getFuncCall(); $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionInstanceGroupManagers/ApplyUpdatesToInstances', $actualApiFuncCall); + $this->assertSame( + '/google.cloud.compute.v1.RegionInstanceGroupManagers/ApplyUpdatesToInstances', + $actualApiFuncCall + ); $actualValue = $actualApiRequestObject->getInstanceGroupManager(); $this->assertProtobufEquals($instanceGroupManager, $actualValue); $actualValue = $actualApiRequestObject->getProject(); @@ -336,12 +350,15 @@ public function applyUpdatesToInstancesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instanceGroupManager = 'instanceGroupManager-1361249341'; @@ -352,7 +369,9 @@ public function applyUpdatesToInstancesExceptionTest() ->setInstanceGroupManager($instanceGroupManager) ->setProject($project) ->setRegion($region) - ->setRegionInstanceGroupManagersApplyUpdatesRequestResource($regionInstanceGroupManagersApplyUpdatesRequestResource); + ->setRegionInstanceGroupManagersApplyUpdatesRequestResource( + $regionInstanceGroupManagersApplyUpdatesRequestResource + ); $response = $gapicClient->applyUpdatesToInstances($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -407,7 +426,9 @@ public function createInstancesTest() ->setInstanceGroupManager($instanceGroupManager) ->setProject($project) ->setRegion($region) - ->setRegionInstanceGroupManagersCreateInstancesRequestResource($regionInstanceGroupManagersCreateInstancesRequestResource); + ->setRegionInstanceGroupManagersCreateInstancesRequestResource( + $regionInstanceGroupManagersCreateInstancesRequestResource + ); $response = $gapicClient->createInstances($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); @@ -469,12 +490,15 @@ public function createInstancesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instanceGroupManager = 'instanceGroupManager-1361249341'; @@ -485,7 +509,9 @@ public function createInstancesExceptionTest() ->setInstanceGroupManager($instanceGroupManager) ->setProject($project) ->setRegion($region) - ->setRegionInstanceGroupManagersCreateInstancesRequestResource($regionInstanceGroupManagersCreateInstancesRequestResource); + ->setRegionInstanceGroupManagersCreateInstancesRequestResource( + $regionInstanceGroupManagersCreateInstancesRequestResource + ); $response = $gapicClient->createInstances($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -598,12 +624,15 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instanceGroupManager = 'instanceGroupManager-1361249341'; @@ -667,7 +696,9 @@ public function deleteInstancesTest() ->setInstanceGroupManager($instanceGroupManager) ->setProject($project) ->setRegion($region) - ->setRegionInstanceGroupManagersDeleteInstancesRequestResource($regionInstanceGroupManagersDeleteInstancesRequestResource); + ->setRegionInstanceGroupManagersDeleteInstancesRequestResource( + $regionInstanceGroupManagersDeleteInstancesRequestResource + ); $response = $gapicClient->deleteInstances($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); @@ -729,12 +760,15 @@ public function deleteInstancesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instanceGroupManager = 'instanceGroupManager-1361249341'; @@ -745,7 +779,9 @@ public function deleteInstancesExceptionTest() ->setInstanceGroupManager($instanceGroupManager) ->setProject($project) ->setRegion($region) - ->setRegionInstanceGroupManagersDeleteInstancesRequestResource($regionInstanceGroupManagersDeleteInstancesRequestResource); + ->setRegionInstanceGroupManagersDeleteInstancesRequestResource( + $regionInstanceGroupManagersDeleteInstancesRequestResource + ); $response = $gapicClient->deleteInstances($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -800,7 +836,9 @@ public function deletePerInstanceConfigsTest() ->setInstanceGroupManager($instanceGroupManager) ->setProject($project) ->setRegion($region) - ->setRegionInstanceGroupManagerDeleteInstanceConfigReqResource($regionInstanceGroupManagerDeleteInstanceConfigReqResource); + ->setRegionInstanceGroupManagerDeleteInstanceConfigReqResource( + $regionInstanceGroupManagerDeleteInstanceConfigReqResource + ); $response = $gapicClient->deletePerInstanceConfigs($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); @@ -809,7 +847,10 @@ public function deletePerInstanceConfigsTest() $this->assertSame(0, count($operationsRequestsEmpty)); $actualApiFuncCall = $apiRequests[0]->getFuncCall(); $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionInstanceGroupManagers/DeletePerInstanceConfigs', $actualApiFuncCall); + $this->assertSame( + '/google.cloud.compute.v1.RegionInstanceGroupManagers/DeletePerInstanceConfigs', + $actualApiFuncCall + ); $actualValue = $actualApiRequestObject->getInstanceGroupManager(); $this->assertProtobufEquals($instanceGroupManager, $actualValue); $actualValue = $actualApiRequestObject->getProject(); @@ -862,12 +903,15 @@ public function deletePerInstanceConfigsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instanceGroupManager = 'instanceGroupManager-1361249341'; @@ -878,7 +922,9 @@ public function deletePerInstanceConfigsExceptionTest() ->setInstanceGroupManager($instanceGroupManager) ->setProject($project) ->setRegion($region) - ->setRegionInstanceGroupManagerDeleteInstanceConfigReqResource($regionInstanceGroupManagerDeleteInstanceConfigReqResource); + ->setRegionInstanceGroupManagerDeleteInstanceConfigReqResource( + $regionInstanceGroupManagerDeleteInstanceConfigReqResource + ); $response = $gapicClient->deletePerInstanceConfigs($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -981,12 +1027,15 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $instanceGroupManager = 'instanceGroupManager-1361249341'; @@ -1101,12 +1150,15 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instanceGroupManagerResource = new InstanceGroupManager(); @@ -1150,9 +1202,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new InstanceGroupManager(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new RegionInstanceGroupManagerList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -1163,9 +1213,7 @@ public function listTest() // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListRegionInstanceGroupManagersRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListRegionInstanceGroupManagersRequest())->setProject($project)->setRegion($region); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -1194,19 +1242,20 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListRegionInstanceGroupManagersRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListRegionInstanceGroupManagersRequest())->setProject($project)->setRegion($region); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -1231,9 +1280,7 @@ public function listErrorsTest() // Mock response $nextPageToken = ''; $itemsElement = new InstanceManagedByIgmError(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new RegionInstanceGroupManagersListErrorsResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setItems($items); @@ -1276,12 +1323,15 @@ public function listErrorsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $instanceGroupManager = 'instanceGroupManager-1361249341'; @@ -1315,9 +1365,7 @@ public function listManagedInstancesTest() // Mock response $nextPageToken = ''; $managedInstancesElement = new ManagedInstance(); - $managedInstances = [ - $managedInstancesElement, - ]; + $managedInstances = [$managedInstancesElement]; $expectedResponse = new RegionInstanceGroupManagersListInstancesResponse(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setManagedInstances($managedInstances); @@ -1360,12 +1408,15 @@ public function listManagedInstancesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $instanceGroupManager = 'instanceGroupManager-1361249341'; @@ -1399,9 +1450,7 @@ public function listPerInstanceConfigsTest() // Mock response $nextPageToken = ''; $itemsElement = new PerInstanceConfig(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new RegionInstanceGroupManagersListInstanceConfigsResp(); $expectedResponse->setNextPageToken($nextPageToken); $expectedResponse->setItems($items); @@ -1423,7 +1472,10 @@ public function listPerInstanceConfigsTest() $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionInstanceGroupManagers/ListPerInstanceConfigs', $actualFuncCall); + $this->assertSame( + '/google.cloud.compute.v1.RegionInstanceGroupManagers/ListPerInstanceConfigs', + $actualFuncCall + ); $actualValue = $actualRequestObject->getInstanceGroupManager(); $this->assertProtobufEquals($instanceGroupManager, $actualValue); $actualValue = $actualRequestObject->getProject(); @@ -1444,12 +1496,15 @@ public function listPerInstanceConfigsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $instanceGroupManager = 'instanceGroupManager-1361249341'; @@ -1568,12 +1623,15 @@ public function patchExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instanceGroupManager = 'instanceGroupManager-1361249341'; @@ -1639,7 +1697,9 @@ public function patchPerInstanceConfigsTest() ->setInstanceGroupManager($instanceGroupManager) ->setProject($project) ->setRegion($region) - ->setRegionInstanceGroupManagerPatchInstanceConfigReqResource($regionInstanceGroupManagerPatchInstanceConfigReqResource); + ->setRegionInstanceGroupManagerPatchInstanceConfigReqResource( + $regionInstanceGroupManagerPatchInstanceConfigReqResource + ); $response = $gapicClient->patchPerInstanceConfigs($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); @@ -1648,7 +1708,10 @@ public function patchPerInstanceConfigsTest() $this->assertSame(0, count($operationsRequestsEmpty)); $actualApiFuncCall = $apiRequests[0]->getFuncCall(); $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionInstanceGroupManagers/PatchPerInstanceConfigs', $actualApiFuncCall); + $this->assertSame( + '/google.cloud.compute.v1.RegionInstanceGroupManagers/PatchPerInstanceConfigs', + $actualApiFuncCall + ); $actualValue = $actualApiRequestObject->getInstanceGroupManager(); $this->assertProtobufEquals($instanceGroupManager, $actualValue); $actualValue = $actualApiRequestObject->getProject(); @@ -1701,12 +1764,15 @@ public function patchPerInstanceConfigsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instanceGroupManager = 'instanceGroupManager-1361249341'; @@ -1717,7 +1783,9 @@ public function patchPerInstanceConfigsExceptionTest() ->setInstanceGroupManager($instanceGroupManager) ->setProject($project) ->setRegion($region) - ->setRegionInstanceGroupManagerPatchInstanceConfigReqResource($regionInstanceGroupManagerPatchInstanceConfigReqResource); + ->setRegionInstanceGroupManagerPatchInstanceConfigReqResource( + $regionInstanceGroupManagerPatchInstanceConfigReqResource + ); $response = $gapicClient->patchPerInstanceConfigs($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1772,7 +1840,9 @@ public function recreateInstancesTest() ->setInstanceGroupManager($instanceGroupManager) ->setProject($project) ->setRegion($region) - ->setRegionInstanceGroupManagersRecreateRequestResource($regionInstanceGroupManagersRecreateRequestResource); + ->setRegionInstanceGroupManagersRecreateRequestResource( + $regionInstanceGroupManagersRecreateRequestResource + ); $response = $gapicClient->recreateInstances($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); @@ -1834,12 +1904,15 @@ public function recreateInstancesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instanceGroupManager = 'instanceGroupManager-1361249341'; @@ -1850,7 +1923,9 @@ public function recreateInstancesExceptionTest() ->setInstanceGroupManager($instanceGroupManager) ->setProject($project) ->setRegion($region) - ->setRegionInstanceGroupManagersRecreateRequestResource($regionInstanceGroupManagersRecreateRequestResource); + ->setRegionInstanceGroupManagersRecreateRequestResource( + $regionInstanceGroupManagersRecreateRequestResource + ); $response = $gapicClient->recreateInstances($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1967,12 +2042,15 @@ public function resizeExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instanceGroupManager = 'instanceGroupManager-1361249341'; @@ -2038,7 +2116,9 @@ public function resumeInstancesTest() ->setInstanceGroupManager($instanceGroupManager) ->setProject($project) ->setRegion($region) - ->setRegionInstanceGroupManagersResumeInstancesRequestResource($regionInstanceGroupManagersResumeInstancesRequestResource); + ->setRegionInstanceGroupManagersResumeInstancesRequestResource( + $regionInstanceGroupManagersResumeInstancesRequestResource + ); $response = $gapicClient->resumeInstances($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); @@ -2100,12 +2180,15 @@ public function resumeInstancesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instanceGroupManager = 'instanceGroupManager-1361249341'; @@ -2116,7 +2199,9 @@ public function resumeInstancesExceptionTest() ->setInstanceGroupManager($instanceGroupManager) ->setProject($project) ->setRegion($region) - ->setRegionInstanceGroupManagersResumeInstancesRequestResource($regionInstanceGroupManagersResumeInstancesRequestResource); + ->setRegionInstanceGroupManagersResumeInstancesRequestResource( + $regionInstanceGroupManagersResumeInstancesRequestResource + ); $response = $gapicClient->resumeInstances($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -2171,7 +2256,9 @@ public function setInstanceTemplateTest() ->setInstanceGroupManager($instanceGroupManager) ->setProject($project) ->setRegion($region) - ->setRegionInstanceGroupManagersSetTemplateRequestResource($regionInstanceGroupManagersSetTemplateRequestResource); + ->setRegionInstanceGroupManagersSetTemplateRequestResource( + $regionInstanceGroupManagersSetTemplateRequestResource + ); $response = $gapicClient->setInstanceTemplate($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); @@ -2180,7 +2267,10 @@ public function setInstanceTemplateTest() $this->assertSame(0, count($operationsRequestsEmpty)); $actualApiFuncCall = $apiRequests[0]->getFuncCall(); $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionInstanceGroupManagers/SetInstanceTemplate', $actualApiFuncCall); + $this->assertSame( + '/google.cloud.compute.v1.RegionInstanceGroupManagers/SetInstanceTemplate', + $actualApiFuncCall + ); $actualValue = $actualApiRequestObject->getInstanceGroupManager(); $this->assertProtobufEquals($instanceGroupManager, $actualValue); $actualValue = $actualApiRequestObject->getProject(); @@ -2233,12 +2323,15 @@ public function setInstanceTemplateExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instanceGroupManager = 'instanceGroupManager-1361249341'; @@ -2249,7 +2342,9 @@ public function setInstanceTemplateExceptionTest() ->setInstanceGroupManager($instanceGroupManager) ->setProject($project) ->setRegion($region) - ->setRegionInstanceGroupManagersSetTemplateRequestResource($regionInstanceGroupManagersSetTemplateRequestResource); + ->setRegionInstanceGroupManagersSetTemplateRequestResource( + $regionInstanceGroupManagersSetTemplateRequestResource + ); $response = $gapicClient->setInstanceTemplate($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -2304,7 +2399,9 @@ public function setTargetPoolsTest() ->setInstanceGroupManager($instanceGroupManager) ->setProject($project) ->setRegion($region) - ->setRegionInstanceGroupManagersSetTargetPoolsRequestResource($regionInstanceGroupManagersSetTargetPoolsRequestResource); + ->setRegionInstanceGroupManagersSetTargetPoolsRequestResource( + $regionInstanceGroupManagersSetTargetPoolsRequestResource + ); $response = $gapicClient->setTargetPools($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); @@ -2366,12 +2463,15 @@ public function setTargetPoolsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instanceGroupManager = 'instanceGroupManager-1361249341'; @@ -2382,7 +2482,9 @@ public function setTargetPoolsExceptionTest() ->setInstanceGroupManager($instanceGroupManager) ->setProject($project) ->setRegion($region) - ->setRegionInstanceGroupManagersSetTargetPoolsRequestResource($regionInstanceGroupManagersSetTargetPoolsRequestResource); + ->setRegionInstanceGroupManagersSetTargetPoolsRequestResource( + $regionInstanceGroupManagersSetTargetPoolsRequestResource + ); $response = $gapicClient->setTargetPools($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -2437,7 +2539,9 @@ public function startInstancesTest() ->setInstanceGroupManager($instanceGroupManager) ->setProject($project) ->setRegion($region) - ->setRegionInstanceGroupManagersStartInstancesRequestResource($regionInstanceGroupManagersStartInstancesRequestResource); + ->setRegionInstanceGroupManagersStartInstancesRequestResource( + $regionInstanceGroupManagersStartInstancesRequestResource + ); $response = $gapicClient->startInstances($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); @@ -2499,12 +2603,15 @@ public function startInstancesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instanceGroupManager = 'instanceGroupManager-1361249341'; @@ -2515,7 +2622,9 @@ public function startInstancesExceptionTest() ->setInstanceGroupManager($instanceGroupManager) ->setProject($project) ->setRegion($region) - ->setRegionInstanceGroupManagersStartInstancesRequestResource($regionInstanceGroupManagersStartInstancesRequestResource); + ->setRegionInstanceGroupManagersStartInstancesRequestResource( + $regionInstanceGroupManagersStartInstancesRequestResource + ); $response = $gapicClient->startInstances($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -2570,7 +2679,9 @@ public function stopInstancesTest() ->setInstanceGroupManager($instanceGroupManager) ->setProject($project) ->setRegion($region) - ->setRegionInstanceGroupManagersStopInstancesRequestResource($regionInstanceGroupManagersStopInstancesRequestResource); + ->setRegionInstanceGroupManagersStopInstancesRequestResource( + $regionInstanceGroupManagersStopInstancesRequestResource + ); $response = $gapicClient->stopInstances($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); @@ -2632,12 +2743,15 @@ public function stopInstancesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instanceGroupManager = 'instanceGroupManager-1361249341'; @@ -2648,7 +2762,9 @@ public function stopInstancesExceptionTest() ->setInstanceGroupManager($instanceGroupManager) ->setProject($project) ->setRegion($region) - ->setRegionInstanceGroupManagersStopInstancesRequestResource($regionInstanceGroupManagersStopInstancesRequestResource); + ->setRegionInstanceGroupManagersStopInstancesRequestResource( + $regionInstanceGroupManagersStopInstancesRequestResource + ); $response = $gapicClient->stopInstances($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -2703,7 +2819,9 @@ public function suspendInstancesTest() ->setInstanceGroupManager($instanceGroupManager) ->setProject($project) ->setRegion($region) - ->setRegionInstanceGroupManagersSuspendInstancesRequestResource($regionInstanceGroupManagersSuspendInstancesRequestResource); + ->setRegionInstanceGroupManagersSuspendInstancesRequestResource( + $regionInstanceGroupManagersSuspendInstancesRequestResource + ); $response = $gapicClient->suspendInstances($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); @@ -2765,12 +2883,15 @@ public function suspendInstancesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instanceGroupManager = 'instanceGroupManager-1361249341'; @@ -2781,7 +2902,9 @@ public function suspendInstancesExceptionTest() ->setInstanceGroupManager($instanceGroupManager) ->setProject($project) ->setRegion($region) - ->setRegionInstanceGroupManagersSuspendInstancesRequestResource($regionInstanceGroupManagersSuspendInstancesRequestResource); + ->setRegionInstanceGroupManagersSuspendInstancesRequestResource( + $regionInstanceGroupManagersSuspendInstancesRequestResource + ); $response = $gapicClient->suspendInstances($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -2836,7 +2959,9 @@ public function updatePerInstanceConfigsTest() ->setInstanceGroupManager($instanceGroupManager) ->setProject($project) ->setRegion($region) - ->setRegionInstanceGroupManagerUpdateInstanceConfigReqResource($regionInstanceGroupManagerUpdateInstanceConfigReqResource); + ->setRegionInstanceGroupManagerUpdateInstanceConfigReqResource( + $regionInstanceGroupManagerUpdateInstanceConfigReqResource + ); $response = $gapicClient->updatePerInstanceConfigs($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); @@ -2845,7 +2970,10 @@ public function updatePerInstanceConfigsTest() $this->assertSame(0, count($operationsRequestsEmpty)); $actualApiFuncCall = $apiRequests[0]->getFuncCall(); $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionInstanceGroupManagers/UpdatePerInstanceConfigs', $actualApiFuncCall); + $this->assertSame( + '/google.cloud.compute.v1.RegionInstanceGroupManagers/UpdatePerInstanceConfigs', + $actualApiFuncCall + ); $actualValue = $actualApiRequestObject->getInstanceGroupManager(); $this->assertProtobufEquals($instanceGroupManager, $actualValue); $actualValue = $actualApiRequestObject->getProject(); @@ -2898,12 +3026,15 @@ public function updatePerInstanceConfigsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instanceGroupManager = 'instanceGroupManager-1361249341'; @@ -2914,7 +3045,9 @@ public function updatePerInstanceConfigsExceptionTest() ->setInstanceGroupManager($instanceGroupManager) ->setProject($project) ->setRegion($region) - ->setRegionInstanceGroupManagerUpdateInstanceConfigReqResource($regionInstanceGroupManagerUpdateInstanceConfigReqResource); + ->setRegionInstanceGroupManagerUpdateInstanceConfigReqResource( + $regionInstanceGroupManagerUpdateInstanceConfigReqResource + ); $response = $gapicClient->updatePerInstanceConfigs($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -2969,7 +3102,9 @@ public function abandonInstancesAsyncTest() ->setInstanceGroupManager($instanceGroupManager) ->setProject($project) ->setRegion($region) - ->setRegionInstanceGroupManagersAbandonInstancesRequestResource($regionInstanceGroupManagersAbandonInstancesRequestResource); + ->setRegionInstanceGroupManagersAbandonInstancesRequestResource( + $regionInstanceGroupManagersAbandonInstancesRequestResource + ); $response = $gapicClient->abandonInstances($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); diff --git a/Compute/tests/Unit/V1/Client/RegionInstanceGroupsClientTest.php b/Compute/tests/Unit/V1/Client/RegionInstanceGroupsClientTest.php index 32d740d0ee51..afdbacf38197 100644 --- a/Compute/tests/Unit/V1/Client/RegionInstanceGroupsClientTest.php +++ b/Compute/tests/Unit/V1/Client/RegionInstanceGroupsClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return RegionInstanceGroupsClient */ @@ -142,12 +144,15 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $instanceGroup = 'instanceGroup81095253'; @@ -184,9 +189,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new InstanceGroup(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new RegionInstanceGroupList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -197,9 +200,7 @@ public function listTest() // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListRegionInstanceGroupsRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListRegionInstanceGroupsRequest())->setProject($project)->setRegion($region); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -228,19 +229,20 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListRegionInstanceGroupsRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListRegionInstanceGroupsRequest())->setProject($project)->setRegion($region); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -268,9 +270,7 @@ public function listInstancesTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new InstanceWithNamedPorts(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new RegionInstanceGroupsListInstances(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -320,12 +320,15 @@ public function listInstancesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $instanceGroup = 'instanceGroup81095253'; @@ -446,12 +449,15 @@ public function setNamedPortsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instanceGroup = 'instanceGroup81095253'; diff --git a/Compute/tests/Unit/V1/Client/RegionInstanceTemplatesClientTest.php b/Compute/tests/Unit/V1/Client/RegionInstanceTemplatesClientTest.php index 3f9b6133b1e2..96f28d3c80c6 100644 --- a/Compute/tests/Unit/V1/Client/RegionInstanceTemplatesClientTest.php +++ b/Compute/tests/Unit/V1/Client/RegionInstanceTemplatesClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return RegionInstanceTemplatesClient */ @@ -160,12 +162,15 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instanceTemplate = 'instanceTemplate309248228'; @@ -257,12 +262,15 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $instanceTemplate = 'instanceTemplate309248228'; @@ -377,12 +385,15 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instanceTemplateResource = new InstanceTemplate(); @@ -426,9 +437,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new InstanceTemplate(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new InstanceTemplateList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -439,9 +448,7 @@ public function listTest() // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListRegionInstanceTemplatesRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListRegionInstanceTemplatesRequest())->setProject($project)->setRegion($region); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -470,19 +477,20 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListRegionInstanceTemplatesRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListRegionInstanceTemplatesRequest())->setProject($project)->setRegion($region); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test diff --git a/Compute/tests/Unit/V1/Client/RegionInstancesClientTest.php b/Compute/tests/Unit/V1/Client/RegionInstancesClientTest.php index 0c6aaab9b9df..9dd979755f12 100644 --- a/Compute/tests/Unit/V1/Client/RegionInstancesClientTest.php +++ b/Compute/tests/Unit/V1/Client/RegionInstancesClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return RegionInstancesClient */ @@ -156,12 +158,15 @@ public function bulkInsertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $bulkInsertInstanceResourceResource = new BulkInsertInstanceResource(); diff --git a/Compute/tests/Unit/V1/Client/RegionInstantSnapshotsClientTest.php b/Compute/tests/Unit/V1/Client/RegionInstantSnapshotsClientTest.php index 6ac21d5d6f03..4795325a9794 100644 --- a/Compute/tests/Unit/V1/Client/RegionInstantSnapshotsClientTest.php +++ b/Compute/tests/Unit/V1/Client/RegionInstantSnapshotsClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return RegionInstantSnapshotsClient */ @@ -169,12 +171,15 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instantSnapshot = 'instantSnapshot1465380450'; @@ -284,12 +289,15 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $instantSnapshot = 'instantSnapshot1465380450'; @@ -364,12 +372,15 @@ 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 $project = 'project-309310695'; @@ -484,12 +495,15 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $instantSnapshotResource = new InstantSnapshot(); @@ -533,9 +547,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new InstantSnapshot(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new InstantSnapshotList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -546,9 +558,7 @@ public function listTest() // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListRegionInstantSnapshotsRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListRegionInstantSnapshotsRequest())->setProject($project)->setRegion($region); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -577,19 +587,20 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListRegionInstantSnapshotsRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListRegionInstantSnapshotsRequest())->setProject($project)->setRegion($region); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -659,12 +670,15 @@ 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 $project = 'project-309310695'; @@ -785,12 +799,15 @@ public function setLabelsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -872,12 +889,15 @@ 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 $project = 'project-309310695'; diff --git a/Compute/tests/Unit/V1/Client/RegionNetworkEndpointGroupsClientTest.php b/Compute/tests/Unit/V1/Client/RegionNetworkEndpointGroupsClientTest.php index 43c634b14948..95cf774acbc8 100644 --- a/Compute/tests/Unit/V1/Client/RegionNetworkEndpointGroupsClientTest.php +++ b/Compute/tests/Unit/V1/Client/RegionNetworkEndpointGroupsClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return RegionNetworkEndpointGroupsClient */ @@ -109,7 +111,9 @@ public function attachNetworkEndpointsTest() ->setNetworkEndpointGroup($networkEndpointGroup) ->setProject($project) ->setRegion($region) - ->setRegionNetworkEndpointGroupsAttachEndpointsRequestResource($regionNetworkEndpointGroupsAttachEndpointsRequestResource); + ->setRegionNetworkEndpointGroupsAttachEndpointsRequestResource( + $regionNetworkEndpointGroupsAttachEndpointsRequestResource + ); $response = $gapicClient->attachNetworkEndpoints($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); @@ -118,7 +122,10 @@ public function attachNetworkEndpointsTest() $this->assertSame(0, count($operationsRequestsEmpty)); $actualApiFuncCall = $apiRequests[0]->getFuncCall(); $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionNetworkEndpointGroups/AttachNetworkEndpoints', $actualApiFuncCall); + $this->assertSame( + '/google.cloud.compute.v1.RegionNetworkEndpointGroups/AttachNetworkEndpoints', + $actualApiFuncCall + ); $actualValue = $actualApiRequestObject->getNetworkEndpointGroup(); $this->assertProtobufEquals($networkEndpointGroup, $actualValue); $actualValue = $actualApiRequestObject->getProject(); @@ -171,12 +178,15 @@ public function attachNetworkEndpointsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $networkEndpointGroup = 'networkEndpointGroup-639834746'; @@ -187,7 +197,9 @@ public function attachNetworkEndpointsExceptionTest() ->setNetworkEndpointGroup($networkEndpointGroup) ->setProject($project) ->setRegion($region) - ->setRegionNetworkEndpointGroupsAttachEndpointsRequestResource($regionNetworkEndpointGroupsAttachEndpointsRequestResource); + ->setRegionNetworkEndpointGroupsAttachEndpointsRequestResource( + $regionNetworkEndpointGroupsAttachEndpointsRequestResource + ); $response = $gapicClient->attachNetworkEndpoints($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -300,12 +312,15 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $networkEndpointGroup = 'networkEndpointGroup-639834746'; @@ -369,7 +384,9 @@ public function detachNetworkEndpointsTest() ->setNetworkEndpointGroup($networkEndpointGroup) ->setProject($project) ->setRegion($region) - ->setRegionNetworkEndpointGroupsDetachEndpointsRequestResource($regionNetworkEndpointGroupsDetachEndpointsRequestResource); + ->setRegionNetworkEndpointGroupsDetachEndpointsRequestResource( + $regionNetworkEndpointGroupsDetachEndpointsRequestResource + ); $response = $gapicClient->detachNetworkEndpoints($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); @@ -378,7 +395,10 @@ public function detachNetworkEndpointsTest() $this->assertSame(0, count($operationsRequestsEmpty)); $actualApiFuncCall = $apiRequests[0]->getFuncCall(); $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionNetworkEndpointGroups/DetachNetworkEndpoints', $actualApiFuncCall); + $this->assertSame( + '/google.cloud.compute.v1.RegionNetworkEndpointGroups/DetachNetworkEndpoints', + $actualApiFuncCall + ); $actualValue = $actualApiRequestObject->getNetworkEndpointGroup(); $this->assertProtobufEquals($networkEndpointGroup, $actualValue); $actualValue = $actualApiRequestObject->getProject(); @@ -431,12 +451,15 @@ public function detachNetworkEndpointsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $networkEndpointGroup = 'networkEndpointGroup-639834746'; @@ -447,7 +470,9 @@ public function detachNetworkEndpointsExceptionTest() ->setNetworkEndpointGroup($networkEndpointGroup) ->setProject($project) ->setRegion($region) - ->setRegionNetworkEndpointGroupsDetachEndpointsRequestResource($regionNetworkEndpointGroupsDetachEndpointsRequestResource); + ->setRegionNetworkEndpointGroupsDetachEndpointsRequestResource( + $regionNetworkEndpointGroupsDetachEndpointsRequestResource + ); $response = $gapicClient->detachNetworkEndpoints($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -542,12 +567,15 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $networkEndpointGroup = 'networkEndpointGroup-639834746'; @@ -662,12 +690,15 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $networkEndpointGroupResource = new NetworkEndpointGroup(); @@ -711,9 +742,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new NetworkEndpointGroup(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new NetworkEndpointGroupList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -724,9 +753,7 @@ public function listTest() // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListRegionNetworkEndpointGroupsRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListRegionNetworkEndpointGroupsRequest())->setProject($project)->setRegion($region); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -755,19 +782,20 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListRegionNetworkEndpointGroupsRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListRegionNetworkEndpointGroupsRequest())->setProject($project)->setRegion($region); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -794,9 +822,7 @@ public function listNetworkEndpointsTest() $kind = 'kind3292052'; $nextPageToken = ''; $itemsElement = new NetworkEndpointWithHealthStatus(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new NetworkEndpointGroupsListNetworkEndpoints(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -841,12 +867,15 @@ public function listNetworkEndpointsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $networkEndpointGroup = 'networkEndpointGroup-639834746'; @@ -903,7 +932,9 @@ public function attachNetworkEndpointsAsyncTest() ->setNetworkEndpointGroup($networkEndpointGroup) ->setProject($project) ->setRegion($region) - ->setRegionNetworkEndpointGroupsAttachEndpointsRequestResource($regionNetworkEndpointGroupsAttachEndpointsRequestResource); + ->setRegionNetworkEndpointGroupsAttachEndpointsRequestResource( + $regionNetworkEndpointGroupsAttachEndpointsRequestResource + ); $response = $gapicClient->attachNetworkEndpoints($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); @@ -912,7 +943,10 @@ public function attachNetworkEndpointsAsyncTest() $this->assertSame(0, count($operationsRequestsEmpty)); $actualApiFuncCall = $apiRequests[0]->getFuncCall(); $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionNetworkEndpointGroups/AttachNetworkEndpoints', $actualApiFuncCall); + $this->assertSame( + '/google.cloud.compute.v1.RegionNetworkEndpointGroups/AttachNetworkEndpoints', + $actualApiFuncCall + ); $actualValue = $actualApiRequestObject->getNetworkEndpointGroup(); $this->assertProtobufEquals($networkEndpointGroup, $actualValue); $actualValue = $actualApiRequestObject->getProject(); diff --git a/Compute/tests/Unit/V1/Client/RegionNetworkFirewallPoliciesClientTest.php b/Compute/tests/Unit/V1/Client/RegionNetworkFirewallPoliciesClientTest.php index afde8f2db423..548c2eecad4f 100644 --- a/Compute/tests/Unit/V1/Client/RegionNetworkFirewallPoliciesClientTest.php +++ b/Compute/tests/Unit/V1/Client/RegionNetworkFirewallPoliciesClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return RegionNetworkFirewallPoliciesClient */ @@ -184,12 +186,15 @@ public function addAssociationExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $firewallPolicy = 'firewallPolicy1035044177'; @@ -317,12 +322,15 @@ public function addRuleExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $firewallPolicy = 'firewallPolicy1035044177'; @@ -446,12 +454,15 @@ public function cloneRulesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $firewallPolicy = 'firewallPolicy1035044177'; @@ -573,12 +584,15 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $firewallPolicy = 'firewallPolicy1035044177'; @@ -680,12 +694,15 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $firewallPolicy = 'firewallPolicy1035044177'; @@ -764,12 +781,15 @@ public function getAssociationExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $firewallPolicy = 'firewallPolicy1035044177'; @@ -817,7 +837,10 @@ public function getEffectiveFirewallsTest() $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionNetworkFirewallPolicies/GetEffectiveFirewalls', $actualFuncCall); + $this->assertSame( + '/google.cloud.compute.v1.RegionNetworkFirewallPolicies/GetEffectiveFirewalls', + $actualFuncCall + ); $actualValue = $actualRequestObject->getNetwork(); $this->assertProtobufEquals($network, $actualValue); $actualValue = $actualRequestObject->getProject(); @@ -838,12 +861,15 @@ public function getEffectiveFirewallsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $network = 'network1843485230'; @@ -918,12 +944,15 @@ 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 $project = 'project-309310695'; @@ -1014,12 +1043,15 @@ public function getRuleExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $firewallPolicy = 'firewallPolicy1035044177'; @@ -1134,12 +1166,15 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $firewallPolicyResource = new FirewallPolicy(); @@ -1182,9 +1217,7 @@ public function listTest() $kind = 'kind3292052'; $nextPageToken = ''; $itemsElement = new FirewallPolicy(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new FirewallPolicyList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -1194,9 +1227,7 @@ public function listTest() // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListRegionNetworkFirewallPoliciesRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListRegionNetworkFirewallPoliciesRequest())->setProject($project)->setRegion($region); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -1225,19 +1256,20 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListRegionNetworkFirewallPoliciesRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListRegionNetworkFirewallPoliciesRequest())->setProject($project)->setRegion($region); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -1347,12 +1379,15 @@ public function patchExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $firewallPolicy = 'firewallPolicy1035044177'; @@ -1480,12 +1515,15 @@ public function patchRuleExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $firewallPolicy = 'firewallPolicy1035044177'; @@ -1558,7 +1596,10 @@ public function removeAssociationTest() $this->assertSame(0, count($operationsRequestsEmpty)); $actualApiFuncCall = $apiRequests[0]->getFuncCall(); $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionNetworkFirewallPolicies/RemoveAssociation', $actualApiFuncCall); + $this->assertSame( + '/google.cloud.compute.v1.RegionNetworkFirewallPolicies/RemoveAssociation', + $actualApiFuncCall + ); $actualValue = $actualApiRequestObject->getFirewallPolicy(); $this->assertProtobufEquals($firewallPolicy, $actualValue); $actualValue = $actualApiRequestObject->getProject(); @@ -1609,12 +1650,15 @@ public function removeAssociationExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $firewallPolicy = 'firewallPolicy1035044177'; @@ -1736,12 +1780,15 @@ public function removeRuleExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $firewallPolicy = 'firewallPolicy1035044177'; @@ -1827,12 +1874,15 @@ 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 $project = 'project-309310695'; @@ -1907,12 +1957,15 @@ 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 $project = 'project-309310695'; diff --git a/Compute/tests/Unit/V1/Client/RegionNotificationEndpointsClientTest.php b/Compute/tests/Unit/V1/Client/RegionNotificationEndpointsClientTest.php index a3d89b904d26..bf519814b6e3 100644 --- a/Compute/tests/Unit/V1/Client/RegionNotificationEndpointsClientTest.php +++ b/Compute/tests/Unit/V1/Client/RegionNotificationEndpointsClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return RegionNotificationEndpointsClient */ @@ -160,12 +162,15 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $notificationEndpoint = 'notificationEndpoint-696934807'; @@ -255,12 +260,15 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $notificationEndpoint = 'notificationEndpoint-696934807'; @@ -375,12 +383,15 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $notificationEndpointResource = new NotificationEndpoint(); @@ -424,9 +435,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new NotificationEndpoint(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new NotificationEndpointList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -437,9 +446,7 @@ public function listTest() // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListRegionNotificationEndpointsRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListRegionNotificationEndpointsRequest())->setProject($project)->setRegion($region); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -468,19 +475,20 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListRegionNotificationEndpointsRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListRegionNotificationEndpointsRequest())->setProject($project)->setRegion($region); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test diff --git a/Compute/tests/Unit/V1/Client/RegionOperationsClientTest.php b/Compute/tests/Unit/V1/Client/RegionOperationsClientTest.php index a9d8b6d8e7bb..580b194ed867 100644 --- a/Compute/tests/Unit/V1/Client/RegionOperationsClientTest.php +++ b/Compute/tests/Unit/V1/Client/RegionOperationsClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return RegionOperationsClient */ @@ -111,12 +113,15 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $operation = 'operation1662702951'; @@ -227,12 +232,15 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $operation = 'operation1662702951'; @@ -269,9 +277,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new Operation(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new OperationList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -282,9 +288,7 @@ public function listTest() // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListRegionOperationsRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListRegionOperationsRequest())->setProject($project)->setRegion($region); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -313,19 +317,20 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListRegionOperationsRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListRegionOperationsRequest())->setProject($project)->setRegion($region); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -427,12 +432,15 @@ public function waitExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $operation = 'operation1662702951'; diff --git a/Compute/tests/Unit/V1/Client/RegionSecurityPoliciesClientTest.php b/Compute/tests/Unit/V1/Client/RegionSecurityPoliciesClientTest.php index ca94f6d651d4..7b734e61fcce 100644 --- a/Compute/tests/Unit/V1/Client/RegionSecurityPoliciesClientTest.php +++ b/Compute/tests/Unit/V1/Client/RegionSecurityPoliciesClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return RegionSecurityPoliciesClient */ @@ -172,12 +174,15 @@ public function addRuleExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -301,12 +306,15 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -402,12 +410,15 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; @@ -486,12 +497,15 @@ public function getRuleExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; @@ -606,12 +620,15 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -654,9 +671,7 @@ public function listTest() $kind = 'kind3292052'; $nextPageToken = ''; $itemsElement = new SecurityPolicy(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new SecurityPolicyList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -666,9 +681,7 @@ public function listTest() // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListRegionSecurityPoliciesRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListRegionSecurityPoliciesRequest())->setProject($project)->setRegion($region); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -697,19 +710,20 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListRegionSecurityPoliciesRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListRegionSecurityPoliciesRequest())->setProject($project)->setRegion($region); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -819,12 +833,15 @@ public function patchExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -952,12 +969,15 @@ public function patchRuleExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -1081,12 +1101,15 @@ public function removeRuleExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -1212,12 +1235,15 @@ public function setLabelsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; diff --git a/Compute/tests/Unit/V1/Client/RegionSslCertificatesClientTest.php b/Compute/tests/Unit/V1/Client/RegionSslCertificatesClientTest.php index 0bdfdfe1fc48..95abf26b921c 100644 --- a/Compute/tests/Unit/V1/Client/RegionSslCertificatesClientTest.php +++ b/Compute/tests/Unit/V1/Client/RegionSslCertificatesClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return RegionSslCertificatesClient */ @@ -160,12 +162,15 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -263,12 +268,15 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; @@ -383,12 +391,15 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -432,9 +443,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new SslCertificate(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new SslCertificateList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -445,9 +454,7 @@ public function listTest() // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListRegionSslCertificatesRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListRegionSslCertificatesRequest())->setProject($project)->setRegion($region); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -476,19 +483,20 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListRegionSslCertificatesRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListRegionSslCertificatesRequest())->setProject($project)->setRegion($region); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test diff --git a/Compute/tests/Unit/V1/Client/RegionSslPoliciesClientTest.php b/Compute/tests/Unit/V1/Client/RegionSslPoliciesClientTest.php index 621ce9e79de5..8f52812a86a5 100644 --- a/Compute/tests/Unit/V1/Client/RegionSslPoliciesClientTest.php +++ b/Compute/tests/Unit/V1/Client/RegionSslPoliciesClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return RegionSslPoliciesClient */ @@ -163,12 +165,15 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -264,12 +269,15 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; @@ -384,12 +392,15 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -433,9 +444,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new SslPolicy(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new SslPoliciesList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -446,9 +455,7 @@ public function listTest() // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListRegionSslPoliciesRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListRegionSslPoliciesRequest())->setProject($project)->setRegion($region); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -477,19 +484,20 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListRegionSslPoliciesRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListRegionSslPoliciesRequest())->setProject($project)->setRegion($region); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -517,9 +525,7 @@ public function listAvailableFeaturesTest() // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListAvailableFeaturesRegionSslPoliciesRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListAvailableFeaturesRegionSslPoliciesRequest())->setProject($project)->setRegion($region); $response = $gapicClient->listAvailableFeatures($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -545,19 +551,20 @@ public function listAvailableFeaturesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListAvailableFeaturesRegionSslPoliciesRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListAvailableFeaturesRegionSslPoliciesRequest())->setProject($project)->setRegion($region); try { $gapicClient->listAvailableFeatures($request); // If the $gapicClient method call did not throw, fail the test @@ -667,12 +674,15 @@ public function patchExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; diff --git a/Compute/tests/Unit/V1/Client/RegionTargetHttpProxiesClientTest.php b/Compute/tests/Unit/V1/Client/RegionTargetHttpProxiesClientTest.php index 9a7ac76de3b6..b325fd6524a8 100644 --- a/Compute/tests/Unit/V1/Client/RegionTargetHttpProxiesClientTest.php +++ b/Compute/tests/Unit/V1/Client/RegionTargetHttpProxiesClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return RegionTargetHttpProxiesClient */ @@ -162,12 +164,15 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -265,12 +270,15 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; @@ -385,12 +393,15 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -434,9 +445,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new TargetHttpProxy(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new TargetHttpProxyList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -447,9 +456,7 @@ public function listTest() // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListRegionTargetHttpProxiesRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListRegionTargetHttpProxiesRequest())->setProject($project)->setRegion($region); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -478,19 +485,20 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListRegionTargetHttpProxiesRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListRegionTargetHttpProxiesRequest())->setProject($project)->setRegion($region); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -600,12 +608,15 @@ public function setUrlMapExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; diff --git a/Compute/tests/Unit/V1/Client/RegionTargetHttpsProxiesClientTest.php b/Compute/tests/Unit/V1/Client/RegionTargetHttpsProxiesClientTest.php index 834ce229f901..52689b002422 100644 --- a/Compute/tests/Unit/V1/Client/RegionTargetHttpsProxiesClientTest.php +++ b/Compute/tests/Unit/V1/Client/RegionTargetHttpsProxiesClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return RegionTargetHttpsProxiesClient */ @@ -165,12 +167,15 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -280,12 +285,15 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; @@ -400,12 +408,15 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -449,9 +460,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new TargetHttpsProxy(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new TargetHttpsProxyList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -462,9 +471,7 @@ public function listTest() // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListRegionTargetHttpsProxiesRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListRegionTargetHttpsProxiesRequest())->setProject($project)->setRegion($region); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -493,19 +500,20 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListRegionTargetHttpsProxiesRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListRegionTargetHttpsProxiesRequest())->setProject($project)->setRegion($region); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -615,12 +623,15 @@ public function patchExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -685,7 +696,9 @@ public function setSslCertificatesTest() $request = (new SetSslCertificatesRegionTargetHttpsProxyRequest()) ->setProject($project) ->setRegion($region) - ->setRegionTargetHttpsProxiesSetSslCertificatesRequestResource($regionTargetHttpsProxiesSetSslCertificatesRequestResource) + ->setRegionTargetHttpsProxiesSetSslCertificatesRequestResource( + $regionTargetHttpsProxiesSetSslCertificatesRequestResource + ) ->setTargetHttpsProxy($targetHttpsProxy); $response = $gapicClient->setSslCertificates($request); $this->assertFalse($response->isDone()); @@ -748,12 +761,15 @@ public function setSslCertificatesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -763,7 +779,9 @@ public function setSslCertificatesExceptionTest() $request = (new SetSslCertificatesRegionTargetHttpsProxyRequest()) ->setProject($project) ->setRegion($region) - ->setRegionTargetHttpsProxiesSetSslCertificatesRequestResource($regionTargetHttpsProxiesSetSslCertificatesRequestResource) + ->setRegionTargetHttpsProxiesSetSslCertificatesRequestResource( + $regionTargetHttpsProxiesSetSslCertificatesRequestResource + ) ->setTargetHttpsProxy($targetHttpsProxy); $response = $gapicClient->setSslCertificates($request); $this->assertFalse($response->isDone()); @@ -881,12 +899,15 @@ public function setUrlMapExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; diff --git a/Compute/tests/Unit/V1/Client/RegionTargetTcpProxiesClientTest.php b/Compute/tests/Unit/V1/Client/RegionTargetTcpProxiesClientTest.php index 23c4166c3852..9442d5db74f2 100644 --- a/Compute/tests/Unit/V1/Client/RegionTargetTcpProxiesClientTest.php +++ b/Compute/tests/Unit/V1/Client/RegionTargetTcpProxiesClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return RegionTargetTcpProxiesClient */ @@ -160,12 +162,15 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -261,12 +266,15 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; @@ -381,12 +389,15 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -430,9 +441,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new TargetTcpProxy(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new TargetTcpProxyList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -443,9 +452,7 @@ public function listTest() // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListRegionTargetTcpProxiesRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListRegionTargetTcpProxiesRequest())->setProject($project)->setRegion($region); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -474,19 +481,20 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListRegionTargetTcpProxiesRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListRegionTargetTcpProxiesRequest())->setProject($project)->setRegion($region); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test diff --git a/Compute/tests/Unit/V1/Client/RegionUrlMapsClientTest.php b/Compute/tests/Unit/V1/Client/RegionUrlMapsClientTest.php index 640948c06918..40496226f8cb 100644 --- a/Compute/tests/Unit/V1/Client/RegionUrlMapsClientTest.php +++ b/Compute/tests/Unit/V1/Client/RegionUrlMapsClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return RegionUrlMapsClient */ @@ -165,12 +167,15 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -264,12 +269,15 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; @@ -384,12 +392,15 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -433,9 +444,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new UrlMap(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new UrlMapList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -446,9 +455,7 @@ public function listTest() // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListRegionUrlMapsRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListRegionUrlMapsRequest())->setProject($project)->setRegion($region); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -477,19 +484,20 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListRegionUrlMapsRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListRegionUrlMapsRequest())->setProject($project)->setRegion($region); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -599,12 +607,15 @@ public function patchExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -732,12 +743,15 @@ public function updateExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -819,12 +833,15 @@ public function validateExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; diff --git a/Compute/tests/Unit/V1/Client/RegionZonesClientTest.php b/Compute/tests/Unit/V1/Client/RegionZonesClientTest.php index 34a45156b7ec..1d2e6f21ef8e 100644 --- a/Compute/tests/Unit/V1/Client/RegionZonesClientTest.php +++ b/Compute/tests/Unit/V1/Client/RegionZonesClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return RegionZonesClient */ @@ -75,9 +77,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new Zone(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new ZoneList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -88,9 +88,7 @@ public function listTest() // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListRegionZonesRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListRegionZonesRequest())->setProject($project)->setRegion($region); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -119,19 +117,20 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListRegionZonesRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListRegionZonesRequest())->setProject($project)->setRegion($region); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -159,9 +158,7 @@ public function listAsyncTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new Zone(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new ZoneList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -172,9 +169,7 @@ public function listAsyncTest() // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListRegionZonesRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListRegionZonesRequest())->setProject($project)->setRegion($region); $response = $gapicClient->listAsync($request)->wait(); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); diff --git a/Compute/tests/Unit/V1/Client/RegionsClientTest.php b/Compute/tests/Unit/V1/Client/RegionsClientTest.php index 8798b0d01457..a574d8285400 100644 --- a/Compute/tests/Unit/V1/Client/RegionsClientTest.php +++ b/Compute/tests/Unit/V1/Client/RegionsClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return RegionsClient */ @@ -92,9 +94,7 @@ public function getTest() // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new GetRegionRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new GetRegionRequest())->setProject($project)->setRegion($region); $response = $gapicClient->get($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -120,19 +120,20 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new GetRegionRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new GetRegionRequest())->setProject($project)->setRegion($region); try { $gapicClient->get($request); // If the $gapicClient method call did not throw, fail the test @@ -160,9 +161,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new Region(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new RegionList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -172,8 +171,7 @@ public function listTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new ListRegionsRequest()) - ->setProject($project); + $request = (new ListRegionsRequest())->setProject($project); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -200,17 +198,19 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new ListRegionsRequest()) - ->setProject($project); + $request = (new ListRegionsRequest())->setProject($project); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -254,9 +254,7 @@ public function getAsyncTest() // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new GetRegionRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new GetRegionRequest())->setProject($project)->setRegion($region); $response = $gapicClient->getAsync($request)->wait(); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); diff --git a/Compute/tests/Unit/V1/Client/ReservationBlocksClientTest.php b/Compute/tests/Unit/V1/Client/ReservationBlocksClientTest.php index fd221c374850..1e81ced5c234 100644 --- a/Compute/tests/Unit/V1/Client/ReservationBlocksClientTest.php +++ b/Compute/tests/Unit/V1/Client/ReservationBlocksClientTest.php @@ -27,6 +27,7 @@ use Google\ApiCore\Testing\GeneratedTest; use Google\ApiCore\Testing\MockTransport; use Google\Cloud\Compute\V1\Client\ReservationBlocksClient; +use Google\Cloud\Compute\V1\Client\ZoneOperationsClient; use Google\Cloud\Compute\V1\GetReservationBlockRequest; use Google\Cloud\Compute\V1\GetZoneOperationRequest; use Google\Cloud\Compute\V1\ListReservationBlocksRequest; @@ -37,7 +38,6 @@ use Google\Cloud\Compute\V1\ReservationBlocksGetResponse; use Google\Cloud\Compute\V1\ReservationBlocksListResponse; use Google\Cloud\Compute\V1\ReservationsBlocksPerformMaintenanceRequest; -use Google\Cloud\Compute\V1\ZoneOperationsClient; use Google\Rpc\Code; use stdClass; @@ -57,7 +57,9 @@ private function createTransport($deserialize = null) /** @return CredentialsWrapper */ private function createCredentials() { - return $this->getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return ReservationBlocksClient */ @@ -119,12 +121,15 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; @@ -163,9 +168,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new ReservationBlock(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new ReservationBlocksListResponse(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -211,12 +214,15 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; @@ -274,7 +280,9 @@ public function performMaintenanceTest() ->setProject($project) ->setReservation($reservation) ->setReservationBlock($reservationBlock) - ->setReservationsBlocksPerformMaintenanceRequestResource($reservationsBlocksPerformMaintenanceRequestResource) + ->setReservationsBlocksPerformMaintenanceRequestResource( + $reservationsBlocksPerformMaintenanceRequestResource + ) ->setZone($zone); $response = $gapicClient->performMaintenance($request); $this->assertFalse($response->isDone()); @@ -339,12 +347,15 @@ public function performMaintenanceExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -356,7 +367,9 @@ public function performMaintenanceExceptionTest() ->setProject($project) ->setReservation($reservation) ->setReservationBlock($reservationBlock) - ->setReservationsBlocksPerformMaintenanceRequestResource($reservationsBlocksPerformMaintenanceRequestResource) + ->setReservationsBlocksPerformMaintenanceRequestResource( + $reservationsBlocksPerformMaintenanceRequestResource + ) ->setZone($zone); $response = $gapicClient->performMaintenance($request); $this->assertFalse($response->isDone()); diff --git a/Compute/tests/Unit/V1/Client/ReservationSubBlocksClientTest.php b/Compute/tests/Unit/V1/Client/ReservationSubBlocksClientTest.php index f9163934bcf7..25973fdb26d4 100644 --- a/Compute/tests/Unit/V1/Client/ReservationSubBlocksClientTest.php +++ b/Compute/tests/Unit/V1/Client/ReservationSubBlocksClientTest.php @@ -27,6 +27,7 @@ use Google\ApiCore\Testing\GeneratedTest; use Google\ApiCore\Testing\MockTransport; use Google\Cloud\Compute\V1\Client\ReservationSubBlocksClient; +use Google\Cloud\Compute\V1\Client\ZoneOperationsClient; use Google\Cloud\Compute\V1\GetReservationSubBlockRequest; use Google\Cloud\Compute\V1\GetZoneOperationRequest; use Google\Cloud\Compute\V1\ListReservationSubBlocksRequest; @@ -36,7 +37,6 @@ use Google\Cloud\Compute\V1\ReservationSubBlock; use Google\Cloud\Compute\V1\ReservationSubBlocksGetResponse; use Google\Cloud\Compute\V1\ReservationSubBlocksListResponse; -use Google\Cloud\Compute\V1\ZoneOperationsClient; use Google\Rpc\Code; use stdClass; @@ -56,7 +56,9 @@ private function createTransport($deserialize = null) /** @return CredentialsWrapper */ private function createCredentials() { - return $this->getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return ReservationSubBlocksClient */ @@ -118,12 +120,15 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $parentName = 'parentName1015022848'; @@ -162,9 +167,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new ReservationSubBlock(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new ReservationSubBlocksListResponse(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -210,12 +213,15 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $parentName = 'parentName1015022848'; @@ -334,12 +340,15 @@ public function performMaintenanceExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $parentName = 'parentName1015022848'; diff --git a/Compute/tests/Unit/V1/Client/ReservationsClientTest.php b/Compute/tests/Unit/V1/Client/ReservationsClientTest.php index 34530bb023dc..847e13d3479d 100644 --- a/Compute/tests/Unit/V1/Client/ReservationsClientTest.php +++ b/Compute/tests/Unit/V1/Client/ReservationsClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return ReservationsClient */ @@ -108,8 +110,7 @@ public function aggregatedListTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListReservationsRequest()) - ->setProject($project); + $request = (new AggregatedListReservationsRequest())->setProject($project); $response = $gapicClient->aggregatedList($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -138,17 +139,19 @@ public function aggregatedListExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListReservationsRequest()) - ->setProject($project); + $request = (new AggregatedListReservationsRequest())->setProject($project); try { $gapicClient->aggregatedList($request); // If the $gapicClient method call did not throw, fail the test @@ -254,12 +257,15 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -365,12 +371,15 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; @@ -445,12 +454,15 @@ 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 $project = 'project-309310695'; @@ -565,12 +577,15 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -614,9 +629,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new Reservation(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new ReservationList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -627,9 +640,7 @@ public function listTest() // Mock request $project = 'project-309310695'; $zone = 'zone3744684'; - $request = (new ListReservationsRequest()) - ->setProject($project) - ->setZone($zone); + $request = (new ListReservationsRequest())->setProject($project)->setZone($zone); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -658,19 +669,20 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $zone = 'zone3744684'; - $request = (new ListReservationsRequest()) - ->setProject($project) - ->setZone($zone); + $request = (new ListReservationsRequest())->setProject($project)->setZone($zone); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -780,12 +792,15 @@ public function performMaintenanceExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -913,12 +928,15 @@ public function resizeExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -1006,12 +1024,15 @@ 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 $project = 'project-309310695'; @@ -1086,12 +1107,15 @@ 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 $project = 'project-309310695'; @@ -1212,12 +1236,15 @@ public function updateExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -1274,8 +1301,7 @@ public function aggregatedListAsyncTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListReservationsRequest()) - ->setProject($project); + $request = (new AggregatedListReservationsRequest())->setProject($project); $response = $gapicClient->aggregatedListAsync($request)->wait(); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); diff --git a/Compute/tests/Unit/V1/Client/ResourcePoliciesClientTest.php b/Compute/tests/Unit/V1/Client/ResourcePoliciesClientTest.php index 1342cfeabf58..f593a3bfce7f 100644 --- a/Compute/tests/Unit/V1/Client/ResourcePoliciesClientTest.php +++ b/Compute/tests/Unit/V1/Client/ResourcePoliciesClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return ResourcePoliciesClient */ @@ -106,8 +108,7 @@ public function aggregatedListTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListResourcePoliciesRequest()) - ->setProject($project); + $request = (new AggregatedListResourcePoliciesRequest())->setProject($project); $response = $gapicClient->aggregatedList($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -136,17 +137,19 @@ public function aggregatedListExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListResourcePoliciesRequest()) - ->setProject($project); + $request = (new AggregatedListResourcePoliciesRequest())->setProject($project); try { $gapicClient->aggregatedList($request); // If the $gapicClient method call did not throw, fail the test @@ -252,12 +255,15 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -349,12 +355,15 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; @@ -429,12 +438,15 @@ 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 $project = 'project-309310695'; @@ -549,12 +561,15 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -599,9 +614,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new ResourcePolicy(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new ResourcePolicyList(); $expectedResponse->setEtag($etag); $expectedResponse->setId($id); @@ -613,9 +626,7 @@ public function listTest() // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListResourcePoliciesRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListResourcePoliciesRequest())->setProject($project)->setRegion($region); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -644,19 +655,20 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListResourcePoliciesRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListResourcePoliciesRequest())->setProject($project)->setRegion($region); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -766,12 +778,15 @@ public function patchExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -859,12 +874,15 @@ 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 $project = 'project-309310695'; @@ -939,12 +957,15 @@ 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 $project = 'project-309310695'; @@ -996,8 +1017,7 @@ public function aggregatedListAsyncTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListResourcePoliciesRequest()) - ->setProject($project); + $request = (new AggregatedListResourcePoliciesRequest())->setProject($project); $response = $gapicClient->aggregatedListAsync($request)->wait(); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); diff --git a/Compute/tests/Unit/V1/Client/RoutersClientTest.php b/Compute/tests/Unit/V1/Client/RoutersClientTest.php index c8a2995126eb..527644194e89 100644 --- a/Compute/tests/Unit/V1/Client/RoutersClientTest.php +++ b/Compute/tests/Unit/V1/Client/RoutersClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return RoutersClient */ @@ -117,8 +119,7 @@ public function aggregatedListTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListRoutersRequest()) - ->setProject($project); + $request = (new AggregatedListRoutersRequest())->setProject($project); $response = $gapicClient->aggregatedList($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -147,17 +148,19 @@ public function aggregatedListExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListRoutersRequest()) - ->setProject($project); + $request = (new AggregatedListRoutersRequest())->setProject($project); try { $gapicClient->aggregatedList($request); // If the $gapicClient method call did not throw, fail the test @@ -263,12 +266,15 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -390,12 +396,15 @@ public function deleteRoutePolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -489,12 +498,15 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; @@ -563,12 +575,15 @@ public function getNatIpInfoExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; @@ -605,9 +620,7 @@ public function getNatMappingInfoTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $resultElement = new VmEndpointNatMappings(); - $result = [ - $resultElement, - ]; + $result = [$resultElement]; $expectedResponse = new VmEndpointNatMappingsList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -653,12 +666,15 @@ public function getNatMappingInfoExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; @@ -727,12 +743,15 @@ public function getRoutePolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; @@ -803,12 +822,15 @@ public function getRouterStatusExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; @@ -923,12 +945,15 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -972,9 +997,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new Router(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new RouterList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -985,9 +1008,7 @@ public function listTest() // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListRoutersRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListRoutersRequest())->setProject($project)->setRegion($region); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -1016,19 +1037,20 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListRoutersRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListRoutersRequest())->setProject($project)->setRegion($region); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -1098,12 +1120,15 @@ public function listBgpRoutesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; @@ -1182,12 +1207,15 @@ public function listRoutePoliciesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; @@ -1306,12 +1334,15 @@ public function patchExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -1439,12 +1470,15 @@ public function patchRoutePolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -1526,12 +1560,15 @@ public function previewExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; @@ -1652,12 +1689,15 @@ public function updateExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -1785,12 +1825,15 @@ public function updateRoutePolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -1847,8 +1890,7 @@ public function aggregatedListAsyncTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListRoutersRequest()) - ->setProject($project); + $request = (new AggregatedListRoutersRequest())->setProject($project); $response = $gapicClient->aggregatedListAsync($request)->wait(); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); diff --git a/Compute/tests/Unit/V1/Client/RoutesClientTest.php b/Compute/tests/Unit/V1/Client/RoutesClientTest.php index e8261e0174af..d32ccce0394e 100644 --- a/Compute/tests/Unit/V1/Client/RoutesClientTest.php +++ b/Compute/tests/Unit/V1/Client/RoutesClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return RoutesClient */ @@ -96,9 +98,7 @@ public function deleteTest() // Mock request $project = 'project-309310695'; $route = 'route108704329'; - $request = (new DeleteRouteRequest()) - ->setProject($project) - ->setRoute($route); + $request = (new DeleteRouteRequest())->setProject($project)->setRoute($route); $response = $gapicClient->delete($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); @@ -155,19 +155,20 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; $route = 'route108704329'; - $request = (new DeleteRouteRequest()) - ->setProject($project) - ->setRoute($route); + $request = (new DeleteRouteRequest())->setProject($project)->setRoute($route); $response = $gapicClient->delete($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -246,9 +247,7 @@ public function getTest() // Mock request $project = 'project-309310695'; $route = 'route108704329'; - $request = (new GetRouteRequest()) - ->setProject($project) - ->setRoute($route); + $request = (new GetRouteRequest())->setProject($project)->setRoute($route); $response = $gapicClient->get($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -274,19 +273,20 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $route = 'route108704329'; - $request = (new GetRouteRequest()) - ->setProject($project) - ->setRoute($route); + $request = (new GetRouteRequest())->setProject($project)->setRoute($route); try { $gapicClient->get($request); // If the $gapicClient method call did not throw, fail the test @@ -328,9 +328,7 @@ public function insertTest() // Mock request $project = 'project-309310695'; $routeResource = new Route(); - $request = (new InsertRouteRequest()) - ->setProject($project) - ->setRouteResource($routeResource); + $request = (new InsertRouteRequest())->setProject($project)->setRouteResource($routeResource); $response = $gapicClient->insert($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); @@ -387,19 +385,20 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; $routeResource = new Route(); - $request = (new InsertRouteRequest()) - ->setProject($project) - ->setRouteResource($routeResource); + $request = (new InsertRouteRequest())->setProject($project)->setRouteResource($routeResource); $response = $gapicClient->insert($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -434,9 +433,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new Route(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new RouteList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -446,8 +443,7 @@ public function listTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new ListRoutesRequest()) - ->setProject($project); + $request = (new ListRoutesRequest())->setProject($project); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -474,17 +470,19 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new ListRoutesRequest()) - ->setProject($project); + $request = (new ListRoutesRequest())->setProject($project); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -526,9 +524,7 @@ public function deleteAsyncTest() // Mock request $project = 'project-309310695'; $route = 'route108704329'; - $request = (new DeleteRouteRequest()) - ->setProject($project) - ->setRoute($route); + $request = (new DeleteRouteRequest())->setProject($project)->setRoute($route); $response = $gapicClient->delete($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); diff --git a/Compute/tests/Unit/V1/Client/SecurityPoliciesClientTest.php b/Compute/tests/Unit/V1/Client/SecurityPoliciesClientTest.php index 24bf10f543ff..693c349744af 100644 --- a/Compute/tests/Unit/V1/Client/SecurityPoliciesClientTest.php +++ b/Compute/tests/Unit/V1/Client/SecurityPoliciesClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return SecurityPoliciesClient */ @@ -172,12 +174,15 @@ public function addRuleExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -234,8 +239,7 @@ public function aggregatedListTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListSecurityPoliciesRequest()) - ->setProject($project); + $request = (new AggregatedListSecurityPoliciesRequest())->setProject($project); $response = $gapicClient->aggregatedList($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -264,17 +268,19 @@ public function aggregatedListExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListSecurityPoliciesRequest()) - ->setProject($project); + $request = (new AggregatedListSecurityPoliciesRequest())->setProject($project); try { $gapicClient->aggregatedList($request); // If the $gapicClient method call did not throw, fail the test @@ -316,9 +322,7 @@ public function deleteTest() // Mock request $project = 'project-309310695'; $securityPolicy = 'securityPolicy1781695249'; - $request = (new DeleteSecurityPolicyRequest()) - ->setProject($project) - ->setSecurityPolicy($securityPolicy); + $request = (new DeleteSecurityPolicyRequest())->setProject($project)->setSecurityPolicy($securityPolicy); $response = $gapicClient->delete($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); @@ -375,19 +379,20 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; $securityPolicy = 'securityPolicy1781695249'; - $request = (new DeleteSecurityPolicyRequest()) - ->setProject($project) - ->setSecurityPolicy($securityPolicy); + $request = (new DeleteSecurityPolicyRequest())->setProject($project)->setSecurityPolicy($securityPolicy); $response = $gapicClient->delete($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -442,9 +447,7 @@ public function getTest() // Mock request $project = 'project-309310695'; $securityPolicy = 'securityPolicy1781695249'; - $request = (new GetSecurityPolicyRequest()) - ->setProject($project) - ->setSecurityPolicy($securityPolicy); + $request = (new GetSecurityPolicyRequest())->setProject($project)->setSecurityPolicy($securityPolicy); $response = $gapicClient->get($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -470,19 +473,20 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $securityPolicy = 'securityPolicy1781695249'; - $request = (new GetSecurityPolicyRequest()) - ->setProject($project) - ->setSecurityPolicy($securityPolicy); + $request = (new GetSecurityPolicyRequest())->setProject($project)->setSecurityPolicy($securityPolicy); try { $gapicClient->get($request); // If the $gapicClient method call did not throw, fail the test @@ -520,9 +524,7 @@ public function getRuleTest() // Mock request $project = 'project-309310695'; $securityPolicy = 'securityPolicy1781695249'; - $request = (new GetRuleSecurityPolicyRequest()) - ->setProject($project) - ->setSecurityPolicy($securityPolicy); + $request = (new GetRuleSecurityPolicyRequest())->setProject($project)->setSecurityPolicy($securityPolicy); $response = $gapicClient->getRule($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -548,19 +550,20 @@ public function getRuleExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $securityPolicy = 'securityPolicy1781695249'; - $request = (new GetRuleSecurityPolicyRequest()) - ->setProject($project) - ->setSecurityPolicy($securityPolicy); + $request = (new GetRuleSecurityPolicyRequest())->setProject($project)->setSecurityPolicy($securityPolicy); try { $gapicClient->getRule($request); // If the $gapicClient method call did not throw, fail the test @@ -661,12 +664,15 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -707,9 +713,7 @@ public function listTest() $kind = 'kind3292052'; $nextPageToken = ''; $itemsElement = new SecurityPolicy(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new SecurityPolicyList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -718,8 +722,7 @@ public function listTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new ListSecurityPoliciesRequest()) - ->setProject($project); + $request = (new ListSecurityPoliciesRequest())->setProject($project); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -746,17 +749,19 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new ListSecurityPoliciesRequest()) - ->setProject($project); + $request = (new ListSecurityPoliciesRequest())->setProject($project); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -783,8 +788,7 @@ public function listPreconfiguredExpressionSetsTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new ListPreconfiguredExpressionSetsSecurityPoliciesRequest()) - ->setProject($project); + $request = (new ListPreconfiguredExpressionSetsSecurityPoliciesRequest())->setProject($project); $response = $gapicClient->listPreconfiguredExpressionSets($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -808,17 +812,19 @@ public function listPreconfiguredExpressionSetsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new ListPreconfiguredExpressionSetsSecurityPoliciesRequest()) - ->setProject($project); + $request = (new ListPreconfiguredExpressionSetsSecurityPoliciesRequest())->setProject($project); try { $gapicClient->listPreconfiguredExpressionSets($request); // If the $gapicClient method call did not throw, fail the test @@ -923,12 +929,15 @@ public function patchExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -1049,12 +1058,15 @@ public function patchRuleExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -1112,9 +1124,7 @@ public function removeRuleTest() // Mock request $project = 'project-309310695'; $securityPolicy = 'securityPolicy1781695249'; - $request = (new RemoveRuleSecurityPolicyRequest()) - ->setProject($project) - ->setSecurityPolicy($securityPolicy); + $request = (new RemoveRuleSecurityPolicyRequest())->setProject($project)->setSecurityPolicy($securityPolicy); $response = $gapicClient->removeRule($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); @@ -1171,19 +1181,20 @@ public function removeRuleExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; $securityPolicy = 'securityPolicy1781695249'; - $request = (new RemoveRuleSecurityPolicyRequest()) - ->setProject($project) - ->setSecurityPolicy($securityPolicy); + $request = (new RemoveRuleSecurityPolicyRequest())->setProject($project)->setSecurityPolicy($securityPolicy); $response = $gapicClient->removeRule($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1295,12 +1306,15 @@ public function setLabelsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $globalSetLabelsRequestResource = new GlobalSetLabelsRequest(); diff --git a/Compute/tests/Unit/V1/Client/ServiceAttachmentsClientTest.php b/Compute/tests/Unit/V1/Client/ServiceAttachmentsClientTest.php index 87aa08bcb619..bbe9a7392667 100644 --- a/Compute/tests/Unit/V1/Client/ServiceAttachmentsClientTest.php +++ b/Compute/tests/Unit/V1/Client/ServiceAttachmentsClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return ServiceAttachmentsClient */ @@ -104,8 +106,7 @@ public function aggregatedListTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListServiceAttachmentsRequest()) - ->setProject($project); + $request = (new AggregatedListServiceAttachmentsRequest())->setProject($project); $response = $gapicClient->aggregatedList($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -134,17 +135,19 @@ public function aggregatedListExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListServiceAttachmentsRequest()) - ->setProject($project); + $request = (new AggregatedListServiceAttachmentsRequest())->setProject($project); try { $gapicClient->aggregatedList($request); // If the $gapicClient method call did not throw, fail the test @@ -250,12 +253,15 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -359,12 +365,15 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; @@ -439,12 +448,15 @@ 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 $project = 'project-309310695'; @@ -559,12 +571,15 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -608,9 +623,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new ServiceAttachment(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new ServiceAttachmentList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -621,9 +634,7 @@ public function listTest() // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListServiceAttachmentsRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListServiceAttachmentsRequest())->setProject($project)->setRegion($region); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -652,19 +663,20 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListServiceAttachmentsRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListServiceAttachmentsRequest())->setProject($project)->setRegion($region); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -774,12 +786,15 @@ public function patchExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -867,12 +882,15 @@ 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 $project = 'project-309310695'; @@ -947,12 +965,15 @@ 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 $project = 'project-309310695'; @@ -1002,8 +1023,7 @@ public function aggregatedListAsyncTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListServiceAttachmentsRequest()) - ->setProject($project); + $request = (new AggregatedListServiceAttachmentsRequest())->setProject($project); $response = $gapicClient->aggregatedListAsync($request)->wait(); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); diff --git a/Compute/tests/Unit/V1/Client/SnapshotSettingsServiceClientTest.php b/Compute/tests/Unit/V1/Client/SnapshotSettingsServiceClientTest.php index 349772f54e46..d59d83595605 100644 --- a/Compute/tests/Unit/V1/Client/SnapshotSettingsServiceClientTest.php +++ b/Compute/tests/Unit/V1/Client/SnapshotSettingsServiceClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return SnapshotSettingsServiceClient */ @@ -78,8 +80,7 @@ public function getTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new GetSnapshotSettingRequest()) - ->setProject($project); + $request = (new GetSnapshotSettingRequest())->setProject($project); $response = $gapicClient->get($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -103,17 +104,19 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new GetSnapshotSettingRequest()) - ->setProject($project); + $request = (new GetSnapshotSettingRequest())->setProject($project); try { $gapicClient->get($request); // If the $gapicClient method call did not throw, fail the test @@ -214,12 +217,15 @@ public function patchExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -260,8 +266,7 @@ public function getAsyncTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new GetSnapshotSettingRequest()) - ->setProject($project); + $request = (new GetSnapshotSettingRequest())->setProject($project); $response = $gapicClient->getAsync($request)->wait(); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); diff --git a/Compute/tests/Unit/V1/Client/SnapshotsClientTest.php b/Compute/tests/Unit/V1/Client/SnapshotsClientTest.php index b29ff2186157..cc6c91ffd313 100644 --- a/Compute/tests/Unit/V1/Client/SnapshotsClientTest.php +++ b/Compute/tests/Unit/V1/Client/SnapshotsClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return SnapshotsClient */ @@ -105,9 +107,7 @@ public function deleteTest() // Mock request $project = 'project-309310695'; $snapshot = 'snapshot284874180'; - $request = (new DeleteSnapshotRequest()) - ->setProject($project) - ->setSnapshot($snapshot); + $request = (new DeleteSnapshotRequest())->setProject($project)->setSnapshot($snapshot); $response = $gapicClient->delete($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); @@ -164,19 +164,20 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; $snapshot = 'snapshot284874180'; - $request = (new DeleteSnapshotRequest()) - ->setProject($project) - ->setSnapshot($snapshot); + $request = (new DeleteSnapshotRequest())->setProject($project)->setSnapshot($snapshot); $response = $gapicClient->delete($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -269,9 +270,7 @@ public function getTest() // Mock request $project = 'project-309310695'; $snapshot = 'snapshot284874180'; - $request = (new GetSnapshotRequest()) - ->setProject($project) - ->setSnapshot($snapshot); + $request = (new GetSnapshotRequest())->setProject($project)->setSnapshot($snapshot); $response = $gapicClient->get($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -297,19 +296,20 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $snapshot = 'snapshot284874180'; - $request = (new GetSnapshotRequest()) - ->setProject($project) - ->setSnapshot($snapshot); + $request = (new GetSnapshotRequest())->setProject($project)->setSnapshot($snapshot); try { $gapicClient->get($request); // If the $gapicClient method call did not throw, fail the test @@ -343,9 +343,7 @@ public function getIamPolicyTest() // Mock request $project = 'project-309310695'; $resource = 'resource-341064690'; - $request = (new GetIamPolicySnapshotRequest()) - ->setProject($project) - ->setResource($resource); + $request = (new GetIamPolicySnapshotRequest())->setProject($project)->setResource($resource); $response = $gapicClient->getIamPolicy($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -371,19 +369,20 @@ 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 $project = 'project-309310695'; $resource = 'resource-341064690'; - $request = (new GetIamPolicySnapshotRequest()) - ->setProject($project) - ->setResource($resource); + $request = (new GetIamPolicySnapshotRequest())->setProject($project)->setResource($resource); try { $gapicClient->getIamPolicy($request); // If the $gapicClient method call did not throw, fail the test @@ -425,9 +424,7 @@ public function insertTest() // Mock request $project = 'project-309310695'; $snapshotResource = new Snapshot(); - $request = (new InsertSnapshotRequest()) - ->setProject($project) - ->setSnapshotResource($snapshotResource); + $request = (new InsertSnapshotRequest())->setProject($project)->setSnapshotResource($snapshotResource); $response = $gapicClient->insert($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); @@ -484,19 +481,20 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; $snapshotResource = new Snapshot(); - $request = (new InsertSnapshotRequest()) - ->setProject($project) - ->setSnapshotResource($snapshotResource); + $request = (new InsertSnapshotRequest())->setProject($project)->setSnapshotResource($snapshotResource); $response = $gapicClient->insert($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -531,9 +529,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new Snapshot(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new SnapshotList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -543,8 +539,7 @@ public function listTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new ListSnapshotsRequest()) - ->setProject($project); + $request = (new ListSnapshotsRequest())->setProject($project); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -571,17 +566,19 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new ListSnapshotsRequest()) - ->setProject($project); + $request = (new ListSnapshotsRequest())->setProject($project); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -647,12 +644,15 @@ 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 $globalSetPolicyRequestResource = new GlobalSetPolicyRequest(); @@ -766,12 +766,15 @@ public function setLabelsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $globalSetLabelsRequestResource = new GlobalSetLabelsRequest(); @@ -847,12 +850,15 @@ 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 $project = 'project-309310695'; @@ -903,9 +909,7 @@ public function deleteAsyncTest() // Mock request $project = 'project-309310695'; $snapshot = 'snapshot284874180'; - $request = (new DeleteSnapshotRequest()) - ->setProject($project) - ->setSnapshot($snapshot); + $request = (new DeleteSnapshotRequest())->setProject($project)->setSnapshot($snapshot); $response = $gapicClient->delete($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); diff --git a/Compute/tests/Unit/V1/Client/SslCertificatesClientTest.php b/Compute/tests/Unit/V1/Client/SslCertificatesClientTest.php index 4cef9a6693b9..d4e4e5b04fe4 100644 --- a/Compute/tests/Unit/V1/Client/SslCertificatesClientTest.php +++ b/Compute/tests/Unit/V1/Client/SslCertificatesClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return SslCertificatesClient */ @@ -96,8 +98,7 @@ public function aggregatedListTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListSslCertificatesRequest()) - ->setProject($project); + $request = (new AggregatedListSslCertificatesRequest())->setProject($project); $response = $gapicClient->aggregatedList($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -126,17 +127,19 @@ public function aggregatedListExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListSslCertificatesRequest()) - ->setProject($project); + $request = (new AggregatedListSslCertificatesRequest())->setProject($project); try { $gapicClient->aggregatedList($request); // If the $gapicClient method call did not throw, fail the test @@ -178,9 +181,7 @@ public function deleteTest() // Mock request $project = 'project-309310695'; $sslCertificate = 'sslCertificate-1027298332'; - $request = (new DeleteSslCertificateRequest()) - ->setProject($project) - ->setSslCertificate($sslCertificate); + $request = (new DeleteSslCertificateRequest())->setProject($project)->setSslCertificate($sslCertificate); $response = $gapicClient->delete($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); @@ -237,19 +238,20 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; $sslCertificate = 'sslCertificate-1027298332'; - $request = (new DeleteSslCertificateRequest()) - ->setProject($project) - ->setSslCertificate($sslCertificate); + $request = (new DeleteSslCertificateRequest())->setProject($project)->setSslCertificate($sslCertificate); $response = $gapicClient->delete($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -306,9 +308,7 @@ public function getTest() // Mock request $project = 'project-309310695'; $sslCertificate = 'sslCertificate-1027298332'; - $request = (new GetSslCertificateRequest()) - ->setProject($project) - ->setSslCertificate($sslCertificate); + $request = (new GetSslCertificateRequest())->setProject($project)->setSslCertificate($sslCertificate); $response = $gapicClient->get($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -334,19 +334,20 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $sslCertificate = 'sslCertificate-1027298332'; - $request = (new GetSslCertificateRequest()) - ->setProject($project) - ->setSslCertificate($sslCertificate); + $request = (new GetSslCertificateRequest())->setProject($project)->setSslCertificate($sslCertificate); try { $gapicClient->get($request); // If the $gapicClient method call did not throw, fail the test @@ -447,12 +448,15 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -494,9 +498,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new SslCertificate(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new SslCertificateList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -506,8 +508,7 @@ public function listTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new ListSslCertificatesRequest()) - ->setProject($project); + $request = (new ListSslCertificatesRequest())->setProject($project); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -534,17 +535,19 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new ListSslCertificatesRequest()) - ->setProject($project); + $request = (new ListSslCertificatesRequest())->setProject($project); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -583,8 +586,7 @@ public function aggregatedListAsyncTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListSslCertificatesRequest()) - ->setProject($project); + $request = (new AggregatedListSslCertificatesRequest())->setProject($project); $response = $gapicClient->aggregatedListAsync($request)->wait(); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); diff --git a/Compute/tests/Unit/V1/Client/SslPoliciesClientTest.php b/Compute/tests/Unit/V1/Client/SslPoliciesClientTest.php index 886f7f5b8527..8ed667964531 100644 --- a/Compute/tests/Unit/V1/Client/SslPoliciesClientTest.php +++ b/Compute/tests/Unit/V1/Client/SslPoliciesClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return SslPoliciesClient */ @@ -101,8 +103,7 @@ public function aggregatedListTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListSslPoliciesRequest()) - ->setProject($project); + $request = (new AggregatedListSslPoliciesRequest())->setProject($project); $response = $gapicClient->aggregatedList($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -131,17 +132,19 @@ public function aggregatedListExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListSslPoliciesRequest()) - ->setProject($project); + $request = (new AggregatedListSslPoliciesRequest())->setProject($project); try { $gapicClient->aggregatedList($request); // If the $gapicClient method call did not throw, fail the test @@ -183,9 +186,7 @@ public function deleteTest() // Mock request $project = 'project-309310695'; $sslPolicy = 'sslPolicy-1852293435'; - $request = (new DeleteSslPolicyRequest()) - ->setProject($project) - ->setSslPolicy($sslPolicy); + $request = (new DeleteSslPolicyRequest())->setProject($project)->setSslPolicy($sslPolicy); $response = $gapicClient->delete($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); @@ -242,19 +243,20 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; $sslPolicy = 'sslPolicy-1852293435'; - $request = (new DeleteSslPolicyRequest()) - ->setProject($project) - ->setSslPolicy($sslPolicy); + $request = (new DeleteSslPolicyRequest())->setProject($project)->setSslPolicy($sslPolicy); $response = $gapicClient->delete($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -309,9 +311,7 @@ public function getTest() // Mock request $project = 'project-309310695'; $sslPolicy = 'sslPolicy-1852293435'; - $request = (new GetSslPolicyRequest()) - ->setProject($project) - ->setSslPolicy($sslPolicy); + $request = (new GetSslPolicyRequest())->setProject($project)->setSslPolicy($sslPolicy); $response = $gapicClient->get($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -337,19 +337,20 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $sslPolicy = 'sslPolicy-1852293435'; - $request = (new GetSslPolicyRequest()) - ->setProject($project) - ->setSslPolicy($sslPolicy); + $request = (new GetSslPolicyRequest())->setProject($project)->setSslPolicy($sslPolicy); try { $gapicClient->get($request); // If the $gapicClient method call did not throw, fail the test @@ -391,9 +392,7 @@ public function insertTest() // Mock request $project = 'project-309310695'; $sslPolicyResource = new SslPolicy(); - $request = (new InsertSslPolicyRequest()) - ->setProject($project) - ->setSslPolicyResource($sslPolicyResource); + $request = (new InsertSslPolicyRequest())->setProject($project)->setSslPolicyResource($sslPolicyResource); $response = $gapicClient->insert($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); @@ -450,19 +449,20 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; $sslPolicyResource = new SslPolicy(); - $request = (new InsertSslPolicyRequest()) - ->setProject($project) - ->setSslPolicyResource($sslPolicyResource); + $request = (new InsertSslPolicyRequest())->setProject($project)->setSslPolicyResource($sslPolicyResource); $response = $gapicClient->insert($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -497,9 +497,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new SslPolicy(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new SslPoliciesList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -509,8 +507,7 @@ public function listTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new ListSslPoliciesRequest()) - ->setProject($project); + $request = (new ListSslPoliciesRequest())->setProject($project); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -537,17 +534,19 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new ListSslPoliciesRequest()) - ->setProject($project); + $request = (new ListSslPoliciesRequest())->setProject($project); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -574,8 +573,7 @@ public function listAvailableFeaturesTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new ListAvailableFeaturesSslPoliciesRequest()) - ->setProject($project); + $request = (new ListAvailableFeaturesSslPoliciesRequest())->setProject($project); $response = $gapicClient->listAvailableFeatures($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -599,17 +597,19 @@ public function listAvailableFeaturesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new ListAvailableFeaturesSslPoliciesRequest()) - ->setProject($project); + $request = (new ListAvailableFeaturesSslPoliciesRequest())->setProject($project); try { $gapicClient->listAvailableFeatures($request); // If the $gapicClient method call did not throw, fail the test @@ -714,12 +714,15 @@ public function patchExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -776,8 +779,7 @@ public function aggregatedListAsyncTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListSslPoliciesRequest()) - ->setProject($project); + $request = (new AggregatedListSslPoliciesRequest())->setProject($project); $response = $gapicClient->aggregatedListAsync($request)->wait(); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); diff --git a/Compute/tests/Unit/V1/Client/StoragePoolTypesClientTest.php b/Compute/tests/Unit/V1/Client/StoragePoolTypesClientTest.php index e7cbf948e063..d2ebfa21ffb3 100644 --- a/Compute/tests/Unit/V1/Client/StoragePoolTypesClientTest.php +++ b/Compute/tests/Unit/V1/Client/StoragePoolTypesClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return StoragePoolTypesClient */ @@ -90,8 +92,7 @@ public function aggregatedListTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListStoragePoolTypesRequest()) - ->setProject($project); + $request = (new AggregatedListStoragePoolTypesRequest())->setProject($project); $response = $gapicClient->aggregatedList($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -120,17 +121,19 @@ public function aggregatedListExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListStoragePoolTypesRequest()) - ->setProject($project); + $request = (new AggregatedListStoragePoolTypesRequest())->setProject($project); try { $gapicClient->aggregatedList($request); // If the $gapicClient method call did not throw, fail the test @@ -220,12 +223,15 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; @@ -262,9 +268,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new StoragePoolType(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new StoragePoolTypeList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -275,9 +279,7 @@ public function listTest() // Mock request $project = 'project-309310695'; $zone = 'zone3744684'; - $request = (new ListStoragePoolTypesRequest()) - ->setProject($project) - ->setZone($zone); + $request = (new ListStoragePoolTypesRequest())->setProject($project)->setZone($zone); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -306,19 +308,20 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $zone = 'zone3744684'; - $request = (new ListStoragePoolTypesRequest()) - ->setProject($project) - ->setZone($zone); + $request = (new ListStoragePoolTypesRequest())->setProject($project)->setZone($zone); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -357,8 +360,7 @@ public function aggregatedListAsyncTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListStoragePoolTypesRequest()) - ->setProject($project); + $request = (new AggregatedListStoragePoolTypesRequest())->setProject($project); $response = $gapicClient->aggregatedListAsync($request)->wait(); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); diff --git a/Compute/tests/Unit/V1/Client/StoragePoolsClientTest.php b/Compute/tests/Unit/V1/Client/StoragePoolsClientTest.php index dab8524a3603..83966d25bd36 100644 --- a/Compute/tests/Unit/V1/Client/StoragePoolsClientTest.php +++ b/Compute/tests/Unit/V1/Client/StoragePoolsClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return StoragePoolsClient */ @@ -108,8 +110,7 @@ public function aggregatedListTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListStoragePoolsRequest()) - ->setProject($project); + $request = (new AggregatedListStoragePoolsRequest())->setProject($project); $response = $gapicClient->aggregatedList($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -138,17 +139,19 @@ public function aggregatedListExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListStoragePoolsRequest()) - ->setProject($project); + $request = (new AggregatedListStoragePoolsRequest())->setProject($project); try { $gapicClient->aggregatedList($request); // If the $gapicClient method call did not throw, fail the test @@ -254,12 +257,15 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -367,12 +373,15 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; @@ -447,12 +456,15 @@ 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 $project = 'project-309310695'; @@ -567,12 +579,15 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -626,9 +641,7 @@ public function listTest() // Mock request $project = 'project-309310695'; $zone = 'zone3744684'; - $request = (new ListStoragePoolsRequest()) - ->setProject($project) - ->setZone($zone); + $request = (new ListStoragePoolsRequest())->setProject($project)->setZone($zone); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -654,19 +667,20 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $zone = 'zone3744684'; - $request = (new ListStoragePoolsRequest()) - ->setProject($project) - ->setZone($zone); + $request = (new ListStoragePoolsRequest())->setProject($project)->setZone($zone); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -736,12 +750,15 @@ public function listDisksExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; @@ -820,12 +837,15 @@ 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 $project = 'project-309310695'; @@ -900,12 +920,15 @@ 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 $project = 'project-309310695'; @@ -1026,12 +1049,15 @@ public function updateExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -1090,8 +1116,7 @@ public function aggregatedListAsyncTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListStoragePoolsRequest()) - ->setProject($project); + $request = (new AggregatedListStoragePoolsRequest())->setProject($project); $response = $gapicClient->aggregatedListAsync($request)->wait(); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); diff --git a/Compute/tests/Unit/V1/Client/SubnetworksClientTest.php b/Compute/tests/Unit/V1/Client/SubnetworksClientTest.php index 1b389e8b9fe9..ea85ab546f31 100644 --- a/Compute/tests/Unit/V1/Client/SubnetworksClientTest.php +++ b/Compute/tests/Unit/V1/Client/SubnetworksClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return SubnetworksClient */ @@ -111,8 +113,7 @@ public function aggregatedListTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListSubnetworksRequest()) - ->setProject($project); + $request = (new AggregatedListSubnetworksRequest())->setProject($project); $response = $gapicClient->aggregatedList($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -141,17 +142,19 @@ public function aggregatedListExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListSubnetworksRequest()) - ->setProject($project); + $request = (new AggregatedListSubnetworksRequest())->setProject($project); try { $gapicClient->aggregatedList($request); // If the $gapicClient method call did not throw, fail the test @@ -257,12 +260,15 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -388,12 +394,15 @@ public function expandIpCidrRangeExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -521,12 +530,15 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; @@ -601,12 +613,15 @@ 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 $project = 'project-309310695'; @@ -721,12 +736,15 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -770,9 +788,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new Subnetwork(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new SubnetworkList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -783,9 +799,7 @@ public function listTest() // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListSubnetworksRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListSubnetworksRequest())->setProject($project)->setRegion($region); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -814,19 +828,20 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListSubnetworksRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListSubnetworksRequest())->setProject($project)->setRegion($region); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -854,9 +869,7 @@ public function listUsableTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new UsableSubnetwork(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new UsableSubnetworksAggregatedList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -866,8 +879,7 @@ public function listUsableTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new ListUsableSubnetworksRequest()) - ->setProject($project); + $request = (new ListUsableSubnetworksRequest())->setProject($project); $response = $gapicClient->listUsable($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -894,17 +906,19 @@ public function listUsableExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new ListUsableSubnetworksRequest()) - ->setProject($project); + $request = (new ListUsableSubnetworksRequest())->setProject($project); try { $gapicClient->listUsable($request); // If the $gapicClient method call did not throw, fail the test @@ -1014,12 +1028,15 @@ public function patchExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -1107,12 +1124,15 @@ 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 $project = 'project-309310695'; @@ -1171,7 +1191,9 @@ public function setPrivateIpGoogleAccessTest() ->setProject($project) ->setRegion($region) ->setSubnetwork($subnetwork) - ->setSubnetworksSetPrivateIpGoogleAccessRequestResource($subnetworksSetPrivateIpGoogleAccessRequestResource); + ->setSubnetworksSetPrivateIpGoogleAccessRequestResource( + $subnetworksSetPrivateIpGoogleAccessRequestResource + ); $response = $gapicClient->setPrivateIpGoogleAccess($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); @@ -1233,12 +1255,15 @@ public function setPrivateIpGoogleAccessExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -1249,7 +1274,9 @@ public function setPrivateIpGoogleAccessExceptionTest() ->setProject($project) ->setRegion($region) ->setSubnetwork($subnetwork) - ->setSubnetworksSetPrivateIpGoogleAccessRequestResource($subnetworksSetPrivateIpGoogleAccessRequestResource); + ->setSubnetworksSetPrivateIpGoogleAccessRequestResource( + $subnetworksSetPrivateIpGoogleAccessRequestResource + ); $response = $gapicClient->setPrivateIpGoogleAccess($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -1320,12 +1347,15 @@ 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 $project = 'project-309310695'; @@ -1375,8 +1405,7 @@ public function aggregatedListAsyncTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListSubnetworksRequest()) - ->setProject($project); + $request = (new AggregatedListSubnetworksRequest())->setProject($project); $response = $gapicClient->aggregatedListAsync($request)->wait(); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); diff --git a/Compute/tests/Unit/V1/Client/TargetGrpcProxiesClientTest.php b/Compute/tests/Unit/V1/Client/TargetGrpcProxiesClientTest.php index 466d17aa1c23..ebefff381b41 100644 --- a/Compute/tests/Unit/V1/Client/TargetGrpcProxiesClientTest.php +++ b/Compute/tests/Unit/V1/Client/TargetGrpcProxiesClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return TargetGrpcProxiesClient */ @@ -97,9 +99,7 @@ public function deleteTest() // Mock request $project = 'project-309310695'; $targetGrpcProxy = 'targetGrpcProxy-1605592453'; - $request = (new DeleteTargetGrpcProxyRequest()) - ->setProject($project) - ->setTargetGrpcProxy($targetGrpcProxy); + $request = (new DeleteTargetGrpcProxyRequest())->setProject($project)->setTargetGrpcProxy($targetGrpcProxy); $response = $gapicClient->delete($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); @@ -156,19 +156,20 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; $targetGrpcProxy = 'targetGrpcProxy-1605592453'; - $request = (new DeleteTargetGrpcProxyRequest()) - ->setProject($project) - ->setTargetGrpcProxy($targetGrpcProxy); + $request = (new DeleteTargetGrpcProxyRequest())->setProject($project)->setTargetGrpcProxy($targetGrpcProxy); $response = $gapicClient->delete($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -223,9 +224,7 @@ public function getTest() // Mock request $project = 'project-309310695'; $targetGrpcProxy = 'targetGrpcProxy-1605592453'; - $request = (new GetTargetGrpcProxyRequest()) - ->setProject($project) - ->setTargetGrpcProxy($targetGrpcProxy); + $request = (new GetTargetGrpcProxyRequest())->setProject($project)->setTargetGrpcProxy($targetGrpcProxy); $response = $gapicClient->get($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -251,19 +250,20 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $targetGrpcProxy = 'targetGrpcProxy-1605592453'; - $request = (new GetTargetGrpcProxyRequest()) - ->setProject($project) - ->setTargetGrpcProxy($targetGrpcProxy); + $request = (new GetTargetGrpcProxyRequest())->setProject($project)->setTargetGrpcProxy($targetGrpcProxy); try { $gapicClient->get($request); // If the $gapicClient method call did not throw, fail the test @@ -364,12 +364,15 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -411,9 +414,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new TargetGrpcProxy(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new TargetGrpcProxyList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -423,8 +424,7 @@ public function listTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new ListTargetGrpcProxiesRequest()) - ->setProject($project); + $request = (new ListTargetGrpcProxiesRequest())->setProject($project); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -451,17 +451,19 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new ListTargetGrpcProxiesRequest()) - ->setProject($project); + $request = (new ListTargetGrpcProxiesRequest())->setProject($project); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -566,12 +568,15 @@ public function patchExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -629,9 +634,7 @@ public function deleteAsyncTest() // Mock request $project = 'project-309310695'; $targetGrpcProxy = 'targetGrpcProxy-1605592453'; - $request = (new DeleteTargetGrpcProxyRequest()) - ->setProject($project) - ->setTargetGrpcProxy($targetGrpcProxy); + $request = (new DeleteTargetGrpcProxyRequest())->setProject($project)->setTargetGrpcProxy($targetGrpcProxy); $response = $gapicClient->delete($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); diff --git a/Compute/tests/Unit/V1/Client/TargetHttpProxiesClientTest.php b/Compute/tests/Unit/V1/Client/TargetHttpProxiesClientTest.php index 440d4e7c4923..e5baa59dae41 100644 --- a/Compute/tests/Unit/V1/Client/TargetHttpProxiesClientTest.php +++ b/Compute/tests/Unit/V1/Client/TargetHttpProxiesClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return TargetHttpProxiesClient */ @@ -99,8 +101,7 @@ public function aggregatedListTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListTargetHttpProxiesRequest()) - ->setProject($project); + $request = (new AggregatedListTargetHttpProxiesRequest())->setProject($project); $response = $gapicClient->aggregatedList($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -129,17 +130,19 @@ public function aggregatedListExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListTargetHttpProxiesRequest()) - ->setProject($project); + $request = (new AggregatedListTargetHttpProxiesRequest())->setProject($project); try { $gapicClient->aggregatedList($request); // If the $gapicClient method call did not throw, fail the test @@ -181,9 +184,7 @@ public function deleteTest() // Mock request $project = 'project-309310695'; $targetHttpProxy = 'targetHttpProxy206872421'; - $request = (new DeleteTargetHttpProxyRequest()) - ->setProject($project) - ->setTargetHttpProxy($targetHttpProxy); + $request = (new DeleteTargetHttpProxyRequest())->setProject($project)->setTargetHttpProxy($targetHttpProxy); $response = $gapicClient->delete($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); @@ -240,19 +241,20 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; $targetHttpProxy = 'targetHttpProxy206872421'; - $request = (new DeleteTargetHttpProxyRequest()) - ->setProject($project) - ->setTargetHttpProxy($targetHttpProxy); + $request = (new DeleteTargetHttpProxyRequest())->setProject($project)->setTargetHttpProxy($targetHttpProxy); $response = $gapicClient->delete($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -309,9 +311,7 @@ public function getTest() // Mock request $project = 'project-309310695'; $targetHttpProxy = 'targetHttpProxy206872421'; - $request = (new GetTargetHttpProxyRequest()) - ->setProject($project) - ->setTargetHttpProxy($targetHttpProxy); + $request = (new GetTargetHttpProxyRequest())->setProject($project)->setTargetHttpProxy($targetHttpProxy); $response = $gapicClient->get($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -337,19 +337,20 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $targetHttpProxy = 'targetHttpProxy206872421'; - $request = (new GetTargetHttpProxyRequest()) - ->setProject($project) - ->setTargetHttpProxy($targetHttpProxy); + $request = (new GetTargetHttpProxyRequest())->setProject($project)->setTargetHttpProxy($targetHttpProxy); try { $gapicClient->get($request); // If the $gapicClient method call did not throw, fail the test @@ -450,12 +451,15 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -497,9 +501,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new TargetHttpProxy(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new TargetHttpProxyList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -509,8 +511,7 @@ public function listTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new ListTargetHttpProxiesRequest()) - ->setProject($project); + $request = (new ListTargetHttpProxiesRequest())->setProject($project); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -537,17 +538,19 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new ListTargetHttpProxiesRequest()) - ->setProject($project); + $request = (new ListTargetHttpProxiesRequest())->setProject($project); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -652,12 +655,15 @@ public function patchExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -778,12 +784,15 @@ public function setUrlMapExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -838,8 +847,7 @@ public function aggregatedListAsyncTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListTargetHttpProxiesRequest()) - ->setProject($project); + $request = (new AggregatedListTargetHttpProxiesRequest())->setProject($project); $response = $gapicClient->aggregatedListAsync($request)->wait(); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); diff --git a/Compute/tests/Unit/V1/Client/TargetHttpsProxiesClientTest.php b/Compute/tests/Unit/V1/Client/TargetHttpsProxiesClientTest.php index 6eeee417a314..78d27c9d5e62 100644 --- a/Compute/tests/Unit/V1/Client/TargetHttpsProxiesClientTest.php +++ b/Compute/tests/Unit/V1/Client/TargetHttpsProxiesClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return TargetHttpsProxiesClient */ @@ -107,8 +109,7 @@ public function aggregatedListTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListTargetHttpsProxiesRequest()) - ->setProject($project); + $request = (new AggregatedListTargetHttpsProxiesRequest())->setProject($project); $response = $gapicClient->aggregatedList($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -137,17 +138,19 @@ public function aggregatedListExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListTargetHttpsProxiesRequest()) - ->setProject($project); + $request = (new AggregatedListTargetHttpsProxiesRequest())->setProject($project); try { $gapicClient->aggregatedList($request); // If the $gapicClient method call did not throw, fail the test @@ -189,9 +192,7 @@ public function deleteTest() // Mock request $project = 'project-309310695'; $targetHttpsProxy = 'targetHttpsProxy-2095146900'; - $request = (new DeleteTargetHttpsProxyRequest()) - ->setProject($project) - ->setTargetHttpsProxy($targetHttpsProxy); + $request = (new DeleteTargetHttpsProxyRequest())->setProject($project)->setTargetHttpsProxy($targetHttpsProxy); $response = $gapicClient->delete($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); @@ -248,19 +249,20 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; $targetHttpsProxy = 'targetHttpsProxy-2095146900'; - $request = (new DeleteTargetHttpsProxyRequest()) - ->setProject($project) - ->setTargetHttpsProxy($targetHttpsProxy); + $request = (new DeleteTargetHttpsProxyRequest())->setProject($project)->setTargetHttpsProxy($targetHttpsProxy); $response = $gapicClient->delete($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -329,9 +331,7 @@ public function getTest() // Mock request $project = 'project-309310695'; $targetHttpsProxy = 'targetHttpsProxy-2095146900'; - $request = (new GetTargetHttpsProxyRequest()) - ->setProject($project) - ->setTargetHttpsProxy($targetHttpsProxy); + $request = (new GetTargetHttpsProxyRequest())->setProject($project)->setTargetHttpsProxy($targetHttpsProxy); $response = $gapicClient->get($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -357,19 +357,20 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $targetHttpsProxy = 'targetHttpsProxy-2095146900'; - $request = (new GetTargetHttpsProxyRequest()) - ->setProject($project) - ->setTargetHttpsProxy($targetHttpsProxy); + $request = (new GetTargetHttpsProxyRequest())->setProject($project)->setTargetHttpsProxy($targetHttpsProxy); try { $gapicClient->get($request); // If the $gapicClient method call did not throw, fail the test @@ -470,12 +471,15 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -517,9 +521,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new TargetHttpsProxy(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new TargetHttpsProxyList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -529,8 +531,7 @@ public function listTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new ListTargetHttpsProxiesRequest()) - ->setProject($project); + $request = (new ListTargetHttpsProxiesRequest())->setProject($project); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -557,17 +558,19 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new ListTargetHttpsProxiesRequest()) - ->setProject($project); + $request = (new ListTargetHttpsProxiesRequest())->setProject($project); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -672,12 +675,15 @@ public function patchExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -798,12 +804,15 @@ public function setCertificateMapExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -924,12 +933,15 @@ public function setQuicOverrideExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -990,7 +1002,9 @@ public function setSslCertificatesTest() $targetHttpsProxy = 'targetHttpsProxy-2095146900'; $request = (new SetSslCertificatesTargetHttpsProxyRequest()) ->setProject($project) - ->setTargetHttpsProxiesSetSslCertificatesRequestResource($targetHttpsProxiesSetSslCertificatesRequestResource) + ->setTargetHttpsProxiesSetSslCertificatesRequestResource( + $targetHttpsProxiesSetSslCertificatesRequestResource + ) ->setTargetHttpsProxy($targetHttpsProxy); $response = $gapicClient->setSslCertificates($request); $this->assertFalse($response->isDone()); @@ -1050,12 +1064,15 @@ public function setSslCertificatesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -1063,7 +1080,9 @@ public function setSslCertificatesExceptionTest() $targetHttpsProxy = 'targetHttpsProxy-2095146900'; $request = (new SetSslCertificatesTargetHttpsProxyRequest()) ->setProject($project) - ->setTargetHttpsProxiesSetSslCertificatesRequestResource($targetHttpsProxiesSetSslCertificatesRequestResource) + ->setTargetHttpsProxiesSetSslCertificatesRequestResource( + $targetHttpsProxiesSetSslCertificatesRequestResource + ) ->setTargetHttpsProxy($targetHttpsProxy); $response = $gapicClient->setSslCertificates($request); $this->assertFalse($response->isDone()); @@ -1176,12 +1195,15 @@ public function setSslPolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -1302,12 +1324,15 @@ public function setUrlMapExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -1362,8 +1387,7 @@ public function aggregatedListAsyncTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListTargetHttpsProxiesRequest()) - ->setProject($project); + $request = (new AggregatedListTargetHttpsProxiesRequest())->setProject($project); $response = $gapicClient->aggregatedListAsync($request)->wait(); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); diff --git a/Compute/tests/Unit/V1/Client/TargetInstancesClientTest.php b/Compute/tests/Unit/V1/Client/TargetInstancesClientTest.php index 264ffc3a21d5..2b0a093786dd 100644 --- a/Compute/tests/Unit/V1/Client/TargetInstancesClientTest.php +++ b/Compute/tests/Unit/V1/Client/TargetInstancesClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return TargetInstancesClient */ @@ -98,8 +100,7 @@ public function aggregatedListTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListTargetInstancesRequest()) - ->setProject($project); + $request = (new AggregatedListTargetInstancesRequest())->setProject($project); $response = $gapicClient->aggregatedList($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -128,17 +129,19 @@ public function aggregatedListExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListTargetInstancesRequest()) - ->setProject($project); + $request = (new AggregatedListTargetInstancesRequest())->setProject($project); try { $gapicClient->aggregatedList($request); // If the $gapicClient method call did not throw, fail the test @@ -244,12 +247,15 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -347,12 +353,15 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; @@ -467,12 +476,15 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -516,9 +528,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new TargetInstance(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new TargetInstanceList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -529,9 +539,7 @@ public function listTest() // Mock request $project = 'project-309310695'; $zone = 'zone3744684'; - $request = (new ListTargetInstancesRequest()) - ->setProject($project) - ->setZone($zone); + $request = (new ListTargetInstancesRequest())->setProject($project)->setZone($zone); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -560,19 +568,20 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $zone = 'zone3744684'; - $request = (new ListTargetInstancesRequest()) - ->setProject($project) - ->setZone($zone); + $request = (new ListTargetInstancesRequest())->setProject($project)->setZone($zone); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -682,12 +691,15 @@ public function setSecurityPolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -744,8 +756,7 @@ public function aggregatedListAsyncTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListTargetInstancesRequest()) - ->setProject($project); + $request = (new AggregatedListTargetInstancesRequest())->setProject($project); $response = $gapicClient->aggregatedListAsync($request)->wait(); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); diff --git a/Compute/tests/Unit/V1/Client/TargetPoolsClientTest.php b/Compute/tests/Unit/V1/Client/TargetPoolsClientTest.php index 5b070e922cb9..07239e8343b9 100644 --- a/Compute/tests/Unit/V1/Client/TargetPoolsClientTest.php +++ b/Compute/tests/Unit/V1/Client/TargetPoolsClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return TargetPoolsClient */ @@ -182,12 +184,15 @@ public function addHealthCheckExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -315,12 +320,15 @@ public function addInstanceExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -377,8 +385,7 @@ public function aggregatedListTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListTargetPoolsRequest()) - ->setProject($project); + $request = (new AggregatedListTargetPoolsRequest())->setProject($project); $response = $gapicClient->aggregatedList($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -407,17 +414,19 @@ public function aggregatedListExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListTargetPoolsRequest()) - ->setProject($project); + $request = (new AggregatedListTargetPoolsRequest())->setProject($project); try { $gapicClient->aggregatedList($request); // If the $gapicClient method call did not throw, fail the test @@ -523,12 +532,15 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -626,12 +638,15 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; @@ -706,12 +721,15 @@ public function getHealthExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $instanceReferenceResource = new InstanceReference(); @@ -828,12 +846,15 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -877,9 +898,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new TargetPool(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new TargetPoolList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -890,9 +909,7 @@ public function listTest() // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListTargetPoolsRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListTargetPoolsRequest())->setProject($project)->setRegion($region); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -921,19 +938,20 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListTargetPoolsRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListTargetPoolsRequest())->setProject($project)->setRegion($region); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -1043,12 +1061,15 @@ public function removeHealthCheckExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -1176,12 +1197,15 @@ public function removeInstanceExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -1309,12 +1333,15 @@ public function setBackupExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -1442,12 +1469,15 @@ public function setSecurityPolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; diff --git a/Compute/tests/Unit/V1/Client/TargetSslProxiesClientTest.php b/Compute/tests/Unit/V1/Client/TargetSslProxiesClientTest.php index 261d87fb2b87..75a6d6fdb3b8 100644 --- a/Compute/tests/Unit/V1/Client/TargetSslProxiesClientTest.php +++ b/Compute/tests/Unit/V1/Client/TargetSslProxiesClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return TargetSslProxiesClient */ @@ -106,9 +108,7 @@ public function deleteTest() // Mock request $project = 'project-309310695'; $targetSslProxy = 'targetSslProxy875666765'; - $request = (new DeleteTargetSslProxyRequest()) - ->setProject($project) - ->setTargetSslProxy($targetSslProxy); + $request = (new DeleteTargetSslProxyRequest())->setProject($project)->setTargetSslProxy($targetSslProxy); $response = $gapicClient->delete($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); @@ -165,19 +165,20 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; $targetSslProxy = 'targetSslProxy875666765'; - $request = (new DeleteTargetSslProxyRequest()) - ->setProject($project) - ->setTargetSslProxy($targetSslProxy); + $request = (new DeleteTargetSslProxyRequest())->setProject($project)->setTargetSslProxy($targetSslProxy); $response = $gapicClient->delete($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -232,9 +233,7 @@ public function getTest() // Mock request $project = 'project-309310695'; $targetSslProxy = 'targetSslProxy875666765'; - $request = (new GetTargetSslProxyRequest()) - ->setProject($project) - ->setTargetSslProxy($targetSslProxy); + $request = (new GetTargetSslProxyRequest())->setProject($project)->setTargetSslProxy($targetSslProxy); $response = $gapicClient->get($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -260,19 +259,20 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $targetSslProxy = 'targetSslProxy875666765'; - $request = (new GetTargetSslProxyRequest()) - ->setProject($project) - ->setTargetSslProxy($targetSslProxy); + $request = (new GetTargetSslProxyRequest())->setProject($project)->setTargetSslProxy($targetSslProxy); try { $gapicClient->get($request); // If the $gapicClient method call did not throw, fail the test @@ -373,12 +373,15 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -420,9 +423,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new TargetSslProxy(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new TargetSslProxyList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -432,8 +433,7 @@ public function listTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new ListTargetSslProxiesRequest()) - ->setProject($project); + $request = (new ListTargetSslProxiesRequest())->setProject($project); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -460,17 +460,19 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new ListTargetSslProxiesRequest()) - ->setProject($project); + $request = (new ListTargetSslProxiesRequest())->setProject($project); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -575,12 +577,15 @@ public function setBackendServiceExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -701,12 +706,15 @@ public function setCertificateMapExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -827,12 +835,15 @@ public function setProxyHeaderExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -953,12 +964,15 @@ public function setSslCertificatesExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -1079,12 +1093,15 @@ public function setSslPolicyExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -1142,9 +1159,7 @@ public function deleteAsyncTest() // Mock request $project = 'project-309310695'; $targetSslProxy = 'targetSslProxy875666765'; - $request = (new DeleteTargetSslProxyRequest()) - ->setProject($project) - ->setTargetSslProxy($targetSslProxy); + $request = (new DeleteTargetSslProxyRequest())->setProject($project)->setTargetSslProxy($targetSslProxy); $response = $gapicClient->delete($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); diff --git a/Compute/tests/Unit/V1/Client/TargetTcpProxiesClientTest.php b/Compute/tests/Unit/V1/Client/TargetTcpProxiesClientTest.php index c084f1d0783a..5d61ddc821a4 100644 --- a/Compute/tests/Unit/V1/Client/TargetTcpProxiesClientTest.php +++ b/Compute/tests/Unit/V1/Client/TargetTcpProxiesClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return TargetTcpProxiesClient */ @@ -100,8 +102,7 @@ public function aggregatedListTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListTargetTcpProxiesRequest()) - ->setProject($project); + $request = (new AggregatedListTargetTcpProxiesRequest())->setProject($project); $response = $gapicClient->aggregatedList($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -130,17 +131,19 @@ public function aggregatedListExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListTargetTcpProxiesRequest()) - ->setProject($project); + $request = (new AggregatedListTargetTcpProxiesRequest())->setProject($project); try { $gapicClient->aggregatedList($request); // If the $gapicClient method call did not throw, fail the test @@ -182,9 +185,7 @@ public function deleteTest() // Mock request $project = 'project-309310695'; $targetTcpProxy = 'targetTcpProxy503065442'; - $request = (new DeleteTargetTcpProxyRequest()) - ->setProject($project) - ->setTargetTcpProxy($targetTcpProxy); + $request = (new DeleteTargetTcpProxyRequest())->setProject($project)->setTargetTcpProxy($targetTcpProxy); $response = $gapicClient->delete($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); @@ -241,19 +242,20 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; $targetTcpProxy = 'targetTcpProxy503065442'; - $request = (new DeleteTargetTcpProxyRequest()) - ->setProject($project) - ->setTargetTcpProxy($targetTcpProxy); + $request = (new DeleteTargetTcpProxyRequest())->setProject($project)->setTargetTcpProxy($targetTcpProxy); $response = $gapicClient->delete($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -308,9 +310,7 @@ public function getTest() // Mock request $project = 'project-309310695'; $targetTcpProxy = 'targetTcpProxy503065442'; - $request = (new GetTargetTcpProxyRequest()) - ->setProject($project) - ->setTargetTcpProxy($targetTcpProxy); + $request = (new GetTargetTcpProxyRequest())->setProject($project)->setTargetTcpProxy($targetTcpProxy); $response = $gapicClient->get($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -336,19 +336,20 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $targetTcpProxy = 'targetTcpProxy503065442'; - $request = (new GetTargetTcpProxyRequest()) - ->setProject($project) - ->setTargetTcpProxy($targetTcpProxy); + $request = (new GetTargetTcpProxyRequest())->setProject($project)->setTargetTcpProxy($targetTcpProxy); try { $gapicClient->get($request); // If the $gapicClient method call did not throw, fail the test @@ -449,12 +450,15 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -496,9 +500,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new TargetTcpProxy(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new TargetTcpProxyList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -508,8 +510,7 @@ public function listTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new ListTargetTcpProxiesRequest()) - ->setProject($project); + $request = (new ListTargetTcpProxiesRequest())->setProject($project); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -536,17 +537,19 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new ListTargetTcpProxiesRequest()) - ->setProject($project); + $request = (new ListTargetTcpProxiesRequest())->setProject($project); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -651,12 +654,15 @@ public function setBackendServiceExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -777,12 +783,15 @@ public function setProxyHeaderExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -837,8 +846,7 @@ public function aggregatedListAsyncTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListTargetTcpProxiesRequest()) - ->setProject($project); + $request = (new AggregatedListTargetTcpProxiesRequest())->setProject($project); $response = $gapicClient->aggregatedListAsync($request)->wait(); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); diff --git a/Compute/tests/Unit/V1/Client/TargetVpnGatewaysClientTest.php b/Compute/tests/Unit/V1/Client/TargetVpnGatewaysClientTest.php index bb1d0db9901e..db2c1e03c3a5 100644 --- a/Compute/tests/Unit/V1/Client/TargetVpnGatewaysClientTest.php +++ b/Compute/tests/Unit/V1/Client/TargetVpnGatewaysClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return TargetVpnGatewaysClient */ @@ -98,8 +100,7 @@ public function aggregatedListTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListTargetVpnGatewaysRequest()) - ->setProject($project); + $request = (new AggregatedListTargetVpnGatewaysRequest())->setProject($project); $response = $gapicClient->aggregatedList($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -128,17 +129,19 @@ public function aggregatedListExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListTargetVpnGatewaysRequest()) - ->setProject($project); + $request = (new AggregatedListTargetVpnGatewaysRequest())->setProject($project); try { $gapicClient->aggregatedList($request); // If the $gapicClient method call did not throw, fail the test @@ -244,12 +247,15 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -345,12 +351,15 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; @@ -465,12 +474,15 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -514,9 +526,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new TargetVpnGateway(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new TargetVpnGatewayList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -527,9 +537,7 @@ public function listTest() // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListTargetVpnGatewaysRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListTargetVpnGatewaysRequest())->setProject($project)->setRegion($region); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -558,19 +566,20 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListTargetVpnGatewaysRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListTargetVpnGatewaysRequest())->setProject($project)->setRegion($region); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -680,12 +689,15 @@ public function setLabelsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -742,8 +754,7 @@ public function aggregatedListAsyncTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListTargetVpnGatewaysRequest()) - ->setProject($project); + $request = (new AggregatedListTargetVpnGatewaysRequest())->setProject($project); $response = $gapicClient->aggregatedListAsync($request)->wait(); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); diff --git a/Compute/tests/Unit/V1/Client/UrlMapsClientTest.php b/Compute/tests/Unit/V1/Client/UrlMapsClientTest.php index 9a9381d46b9c..bac46ea7f43f 100644 --- a/Compute/tests/Unit/V1/Client/UrlMapsClientTest.php +++ b/Compute/tests/Unit/V1/Client/UrlMapsClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return UrlMapsClient */ @@ -103,8 +105,7 @@ public function aggregatedListTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListUrlMapsRequest()) - ->setProject($project); + $request = (new AggregatedListUrlMapsRequest())->setProject($project); $response = $gapicClient->aggregatedList($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -133,17 +134,19 @@ public function aggregatedListExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListUrlMapsRequest()) - ->setProject($project); + $request = (new AggregatedListUrlMapsRequest())->setProject($project); try { $gapicClient->aggregatedList($request); // If the $gapicClient method call did not throw, fail the test @@ -185,9 +188,7 @@ public function deleteTest() // Mock request $project = 'project-309310695'; $urlMap = 'urlMap-169850228'; - $request = (new DeleteUrlMapRequest()) - ->setProject($project) - ->setUrlMap($urlMap); + $request = (new DeleteUrlMapRequest())->setProject($project)->setUrlMap($urlMap); $response = $gapicClient->delete($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); @@ -244,19 +245,20 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; $urlMap = 'urlMap-169850228'; - $request = (new DeleteUrlMapRequest()) - ->setProject($project) - ->setUrlMap($urlMap); + $request = (new DeleteUrlMapRequest())->setProject($project)->setUrlMap($urlMap); $response = $gapicClient->delete($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -309,9 +311,7 @@ public function getTest() // Mock request $project = 'project-309310695'; $urlMap = 'urlMap-169850228'; - $request = (new GetUrlMapRequest()) - ->setProject($project) - ->setUrlMap($urlMap); + $request = (new GetUrlMapRequest())->setProject($project)->setUrlMap($urlMap); $response = $gapicClient->get($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -337,19 +337,20 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $urlMap = 'urlMap-169850228'; - $request = (new GetUrlMapRequest()) - ->setProject($project) - ->setUrlMap($urlMap); + $request = (new GetUrlMapRequest())->setProject($project)->setUrlMap($urlMap); try { $gapicClient->get($request); // If the $gapicClient method call did not throw, fail the test @@ -391,9 +392,7 @@ public function insertTest() // Mock request $project = 'project-309310695'; $urlMapResource = new UrlMap(); - $request = (new InsertUrlMapRequest()) - ->setProject($project) - ->setUrlMapResource($urlMapResource); + $request = (new InsertUrlMapRequest())->setProject($project)->setUrlMapResource($urlMapResource); $response = $gapicClient->insert($request); $this->assertFalse($response->isDone()); $apiRequests = $transport->popReceivedCalls(); @@ -450,19 +449,20 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; $urlMapResource = new UrlMap(); - $request = (new InsertUrlMapRequest()) - ->setProject($project) - ->setUrlMapResource($urlMapResource); + $request = (new InsertUrlMapRequest())->setProject($project)->setUrlMapResource($urlMapResource); $response = $gapicClient->insert($request); $this->assertFalse($response->isDone()); $this->assertNull($response->getResult()); @@ -574,12 +574,15 @@ public function invalidateCacheExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $cacheInvalidationRuleResource = new CacheInvalidationRule(); @@ -623,9 +626,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new UrlMap(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new UrlMapList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -635,8 +636,7 @@ public function listTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new ListUrlMapsRequest()) - ->setProject($project); + $request = (new ListUrlMapsRequest())->setProject($project); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -663,17 +663,19 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new ListUrlMapsRequest()) - ->setProject($project); + $request = (new ListUrlMapsRequest())->setProject($project); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -778,12 +780,15 @@ public function patchExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -904,12 +909,15 @@ public function updateExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -985,12 +993,15 @@ public function validateExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; @@ -1038,8 +1049,7 @@ public function aggregatedListAsyncTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListUrlMapsRequest()) - ->setProject($project); + $request = (new AggregatedListUrlMapsRequest())->setProject($project); $response = $gapicClient->aggregatedListAsync($request)->wait(); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); diff --git a/Compute/tests/Unit/V1/Client/VpnGatewaysClientTest.php b/Compute/tests/Unit/V1/Client/VpnGatewaysClientTest.php index e432c8911e49..5548bc23d816 100644 --- a/Compute/tests/Unit/V1/Client/VpnGatewaysClientTest.php +++ b/Compute/tests/Unit/V1/Client/VpnGatewaysClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return VpnGatewaysClient */ @@ -103,8 +105,7 @@ public function aggregatedListTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListVpnGatewaysRequest()) - ->setProject($project); + $request = (new AggregatedListVpnGatewaysRequest())->setProject($project); $response = $gapicClient->aggregatedList($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -133,17 +134,19 @@ public function aggregatedListExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListVpnGatewaysRequest()) - ->setProject($project); + $request = (new AggregatedListVpnGatewaysRequest())->setProject($project); try { $gapicClient->aggregatedList($request); // If the $gapicClient method call did not throw, fail the test @@ -249,12 +252,15 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -352,12 +358,15 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; @@ -426,12 +435,15 @@ public function getStatusExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; @@ -546,12 +558,15 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -595,9 +610,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new VpnGateway(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new VpnGatewayList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -608,9 +621,7 @@ public function listTest() // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListVpnGatewaysRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListVpnGatewaysRequest())->setProject($project)->setRegion($region); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -639,19 +650,20 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListVpnGatewaysRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListVpnGatewaysRequest())->setProject($project)->setRegion($region); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -761,12 +773,15 @@ public function setLabelsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -848,12 +863,15 @@ 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 $project = 'project-309310695'; @@ -903,8 +921,7 @@ public function aggregatedListAsyncTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListVpnGatewaysRequest()) - ->setProject($project); + $request = (new AggregatedListVpnGatewaysRequest())->setProject($project); $response = $gapicClient->aggregatedListAsync($request)->wait(); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); diff --git a/Compute/tests/Unit/V1/Client/VpnTunnelsClientTest.php b/Compute/tests/Unit/V1/Client/VpnTunnelsClientTest.php index ece3fae0fb2f..e1681462d7fa 100644 --- a/Compute/tests/Unit/V1/Client/VpnTunnelsClientTest.php +++ b/Compute/tests/Unit/V1/Client/VpnTunnelsClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return VpnTunnelsClient */ @@ -98,8 +100,7 @@ public function aggregatedListTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListVpnTunnelsRequest()) - ->setProject($project); + $request = (new AggregatedListVpnTunnelsRequest())->setProject($project); $response = $gapicClient->aggregatedList($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -128,17 +129,19 @@ public function aggregatedListExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListVpnTunnelsRequest()) - ->setProject($project); + $request = (new AggregatedListVpnTunnelsRequest())->setProject($project); try { $gapicClient->aggregatedList($request); // If the $gapicClient method call did not throw, fail the test @@ -244,12 +247,15 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -367,12 +373,15 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; @@ -487,12 +496,15 @@ public function insertExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -536,9 +548,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new VpnTunnel(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new VpnTunnelList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -549,9 +559,7 @@ public function listTest() // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListVpnTunnelsRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListVpnTunnelsRequest())->setProject($project)->setRegion($region); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -580,19 +588,20 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $region = 'region-934795532'; - $request = (new ListVpnTunnelsRequest()) - ->setProject($project) - ->setRegion($region); + $request = (new ListVpnTunnelsRequest())->setProject($project)->setRegion($region); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -702,12 +711,15 @@ public function setLabelsExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - '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 $project = 'project-309310695'; @@ -764,8 +776,7 @@ public function aggregatedListAsyncTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new AggregatedListVpnTunnelsRequest()) - ->setProject($project); + $request = (new AggregatedListVpnTunnelsRequest())->setProject($project); $response = $gapicClient->aggregatedListAsync($request)->wait(); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); diff --git a/Compute/tests/Unit/V1/Client/ZoneOperationsClientTest.php b/Compute/tests/Unit/V1/Client/ZoneOperationsClientTest.php index b2d8aa11801c..d65aa1948893 100644 --- a/Compute/tests/Unit/V1/Client/ZoneOperationsClientTest.php +++ b/Compute/tests/Unit/V1/Client/ZoneOperationsClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return ZoneOperationsClient */ @@ -111,12 +113,15 @@ public function deleteExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $operation = 'operation1662702951'; @@ -227,12 +232,15 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $operation = 'operation1662702951'; @@ -269,9 +277,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new Operation(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new OperationList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -282,9 +288,7 @@ public function listTest() // Mock request $project = 'project-309310695'; $zone = 'zone3744684'; - $request = (new ListZoneOperationsRequest()) - ->setProject($project) - ->setZone($zone); + $request = (new ListZoneOperationsRequest())->setProject($project)->setZone($zone); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -313,19 +317,20 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $zone = 'zone3744684'; - $request = (new ListZoneOperationsRequest()) - ->setProject($project) - ->setZone($zone); + $request = (new ListZoneOperationsRequest())->setProject($project)->setZone($zone); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -427,12 +432,15 @@ public function waitExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $operation = 'operation1662702951'; diff --git a/Compute/tests/Unit/V1/Client/ZonesClientTest.php b/Compute/tests/Unit/V1/Client/ZonesClientTest.php index c054c4148760..fd206893b0a1 100644 --- a/Compute/tests/Unit/V1/Client/ZonesClientTest.php +++ b/Compute/tests/Unit/V1/Client/ZonesClientTest.php @@ -1,6 +1,6 @@ getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); + return $this->getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); } /** @return ZonesClient */ @@ -94,9 +96,7 @@ public function getTest() // Mock request $project = 'project-309310695'; $zone = 'zone3744684'; - $request = (new GetZoneRequest()) - ->setProject($project) - ->setZone($zone); + $request = (new GetZoneRequest())->setProject($project)->setZone($zone); $response = $gapicClient->get($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); @@ -122,19 +122,20 @@ public function getExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; $zone = 'zone3744684'; - $request = (new GetZoneRequest()) - ->setProject($project) - ->setZone($zone); + $request = (new GetZoneRequest())->setProject($project)->setZone($zone); try { $gapicClient->get($request); // If the $gapicClient method call did not throw, fail the test @@ -162,9 +163,7 @@ public function listTest() $nextPageToken = ''; $selfLink = 'selfLink-1691268851'; $itemsElement = new Zone(); - $items = [ - $itemsElement, - ]; + $items = [$itemsElement]; $expectedResponse = new ZoneList(); $expectedResponse->setId($id); $expectedResponse->setKind($kind); @@ -174,8 +173,7 @@ public function listTest() $transport->addResponse($expectedResponse); // Mock request $project = 'project-309310695'; - $request = (new ListZonesRequest()) - ->setProject($project); + $request = (new ListZonesRequest())->setProject($project); $response = $gapicClient->list($request); $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); $resources = iterator_to_array($response->iterateAllElements()); @@ -202,17 +200,19 @@ public function listExceptionTest() $status = new stdClass(); $status->code = Code::DATA_LOSS; $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); $transport->addResponse(null, $status); // Mock request $project = 'project-309310695'; - $request = (new ListZonesRequest()) - ->setProject($project); + $request = (new ListZonesRequest())->setProject($project); try { $gapicClient->list($request); // If the $gapicClient method call did not throw, fail the test @@ -258,9 +258,7 @@ public function getAsyncTest() // Mock request $project = 'project-309310695'; $zone = 'zone3744684'; - $request = (new GetZoneRequest()) - ->setProject($project) - ->setZone($zone); + $request = (new GetZoneRequest())->setProject($project)->setZone($zone); $response = $gapicClient->getAsync($request)->wait(); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); diff --git a/Compute/tests/Unit/V1/DiskTypesClientTest.php b/Compute/tests/Unit/V1/DiskTypesClientTest.php deleted file mode 100644 index 488f42f66f58..000000000000 --- a/Compute/tests/Unit/V1/DiskTypesClientTest.php +++ /dev/null @@ -1,303 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return DiskTypesClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new DiskTypesClient($options); - } - - /** @test */ - public function aggregatedListTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $items = [ - 'itemsKey' => new DiskTypesScopedList(), - ]; - $expectedResponse = new DiskTypeAggregatedList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->aggregatedList($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertArrayHasKey('itemsKey', $expectedResponse->getItems()); - $this->assertArrayHasKey('itemsKey', $resources); - $this->assertEquals($expectedResponse->getItems()['itemsKey'], $resources['itemsKey']); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.DiskTypes/AggregatedList', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function aggregatedListExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->aggregatedList($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $creationTimestamp = 'creationTimestamp567396278'; - $defaultDiskSizeGb = 807490165; - $description = 'description-1724546052'; - $id = 3355; - $kind = 'kind3292052'; - $name = 'name3373707'; - $region = 'region-934795532'; - $selfLink = 'selfLink-1691268851'; - $validDiskSize = 'validDiskSize-1653521184'; - $zone2 = 'zone2-696322977'; - $expectedResponse = new DiskType(); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDefaultDiskSizeGb($defaultDiskSizeGb); - $expectedResponse->setDescription($description); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setName($name); - $expectedResponse->setRegion($region); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setValidDiskSize($validDiskSize); - $expectedResponse->setZone($zone2); - $transport->addResponse($expectedResponse); - // Mock request - $diskType = 'diskType93009052'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->get($diskType, $project, $zone); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.DiskTypes/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getDiskType(); - $this->assertProtobufEquals($diskType, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $diskType = 'diskType93009052'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - try { - $gapicClient->get($diskType, $project, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new DiskType(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new DiskTypeList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->list($project, $zone); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.DiskTypes/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $zone = 'zone3744684'; - try { - $gapicClient->list($project, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->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/Compute/tests/Unit/V1/DisksClientTest.php b/Compute/tests/Unit/V1/DisksClientTest.php deleted file mode 100644 index b2521f7d23f5..000000000000 --- a/Compute/tests/Unit/V1/DisksClientTest.php +++ /dev/null @@ -1,2165 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return DisksClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new DisksClient($options); - } - - /** @test */ - public function addResourcePoliciesTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/addResourcePoliciesTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/addResourcePoliciesTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $disk = 'disk3083677'; - $disksAddResourcePoliciesRequestResource = new DisksAddResourcePoliciesRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->addResourcePolicies($disk, $disksAddResourcePoliciesRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.Disks/AddResourcePolicies', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getDisk(); - $this->assertProtobufEquals($disk, $actualValue); - $actualValue = $actualApiRequestObject->getDisksAddResourcePoliciesRequestResource(); - $this->assertProtobufEquals($disksAddResourcePoliciesRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function addResourcePoliciesExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/addResourcePoliciesExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $disk = 'disk3083677'; - $disksAddResourcePoliciesRequestResource = new DisksAddResourcePoliciesRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->addResourcePolicies($disk, $disksAddResourcePoliciesRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 aggregatedListTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $items = [ - 'itemsKey' => new DisksScopedList(), - ]; - $expectedResponse = new DiskAggregatedList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->aggregatedList($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertArrayHasKey('itemsKey', $expectedResponse->getItems()); - $this->assertArrayHasKey('itemsKey', $resources); - $this->assertEquals($expectedResponse->getItems()['itemsKey'], $resources['itemsKey']); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Disks/AggregatedList', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function aggregatedListExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->aggregatedList($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function bulkInsertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/bulkInsertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/bulkInsertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $bulkInsertDiskResourceResource = new BulkInsertDiskResource(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->bulkInsert($bulkInsertDiskResourceResource, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.Disks/BulkInsert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getBulkInsertDiskResourceResource(); - $this->assertProtobufEquals($bulkInsertDiskResourceResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function bulkInsertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/bulkInsertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $bulkInsertDiskResourceResource = new BulkInsertDiskResource(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->bulkInsert($bulkInsertDiskResourceResource, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 bulkSetLabelsTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/bulkSetLabelsTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/bulkSetLabelsTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $bulkZoneSetLabelsRequestResource = new BulkZoneSetLabelsRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->bulkSetLabels($bulkZoneSetLabelsRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.Disks/BulkSetLabels', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getBulkZoneSetLabelsRequestResource(); - $this->assertProtobufEquals($bulkZoneSetLabelsRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function bulkSetLabelsExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/bulkSetLabelsExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $bulkZoneSetLabelsRequestResource = new BulkZoneSetLabelsRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->bulkSetLabels($bulkZoneSetLabelsRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 createSnapshotTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/createSnapshotTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/createSnapshotTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $disk = 'disk3083677'; - $project = 'project-309310695'; - $snapshotResource = new Snapshot(); - $zone = 'zone3744684'; - $response = $gapicClient->createSnapshot($disk, $project, $snapshotResource, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.Disks/CreateSnapshot', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getDisk(); - $this->assertProtobufEquals($disk, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getSnapshotResource(); - $this->assertProtobufEquals($snapshotResource, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function createSnapshotExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/createSnapshotExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $disk = 'disk3083677'; - $project = 'project-309310695'; - $snapshotResource = new Snapshot(); - $zone = 'zone3744684'; - $response = $gapicClient->createSnapshot($disk, $project, $snapshotResource, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $disk = 'disk3083677'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->delete($disk, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.Disks/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getDisk(); - $this->assertProtobufEquals($disk, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $disk = 'disk3083677'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->delete($disk, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $accessMode = 'accessMode-1032586338'; - $architecture = 'architecture839674195'; - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $enableConfidentialCompute = true; - $id = 3355; - $kind = 'kind3292052'; - $labelFingerprint = 'labelFingerprint714995737'; - $lastAttachTimestamp = 'lastAttachTimestamp-2105323995'; - $lastDetachTimestamp = 'lastDetachTimestamp-480399885'; - $locationHint = 'locationHint-1796964143'; - $name = 'name3373707'; - $options = 'options-1249474914'; - $physicalBlockSizeBytes = 1190604793; - $provisionedIops = 1260510932; - $provisionedThroughput = 1600266005; - $region = 'region-934795532'; - $satisfiesPzi = false; - $satisfiesPzs = false; - $selfLink = 'selfLink-1691268851'; - $sizeGb = 2105542105; - $sourceConsistencyGroupPolicy = 'sourceConsistencyGroupPolicy19616093'; - $sourceConsistencyGroupPolicyId = 'sourceConsistencyGroupPolicyId267568957'; - $sourceDisk = 'sourceDisk-85117119'; - $sourceDiskId = 'sourceDiskId-1693292839'; - $sourceImage = 'sourceImage1661056055'; - $sourceImageId = 'sourceImageId-2092155357'; - $sourceInstantSnapshot = 'sourceInstantSnapshot-317668858'; - $sourceInstantSnapshotId = 'sourceInstantSnapshotId-1859900940'; - $sourceSnapshot = 'sourceSnapshot-947679896'; - $sourceSnapshotId = 'sourceSnapshotId-1511650478'; - $sourceStorageObject = 'sourceStorageObject-303818201'; - $status = 'status-892481550'; - $storagePool = 'storagePool897344352'; - $type = 'type3575610'; - $zone2 = 'zone2-696322977'; - $expectedResponse = new Disk(); - $expectedResponse->setAccessMode($accessMode); - $expectedResponse->setArchitecture($architecture); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setEnableConfidentialCompute($enableConfidentialCompute); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setLabelFingerprint($labelFingerprint); - $expectedResponse->setLastAttachTimestamp($lastAttachTimestamp); - $expectedResponse->setLastDetachTimestamp($lastDetachTimestamp); - $expectedResponse->setLocationHint($locationHint); - $expectedResponse->setName($name); - $expectedResponse->setOptions($options); - $expectedResponse->setPhysicalBlockSizeBytes($physicalBlockSizeBytes); - $expectedResponse->setProvisionedIops($provisionedIops); - $expectedResponse->setProvisionedThroughput($provisionedThroughput); - $expectedResponse->setRegion($region); - $expectedResponse->setSatisfiesPzi($satisfiesPzi); - $expectedResponse->setSatisfiesPzs($satisfiesPzs); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setSizeGb($sizeGb); - $expectedResponse->setSourceConsistencyGroupPolicy($sourceConsistencyGroupPolicy); - $expectedResponse->setSourceConsistencyGroupPolicyId($sourceConsistencyGroupPolicyId); - $expectedResponse->setSourceDisk($sourceDisk); - $expectedResponse->setSourceDiskId($sourceDiskId); - $expectedResponse->setSourceImage($sourceImage); - $expectedResponse->setSourceImageId($sourceImageId); - $expectedResponse->setSourceInstantSnapshot($sourceInstantSnapshot); - $expectedResponse->setSourceInstantSnapshotId($sourceInstantSnapshotId); - $expectedResponse->setSourceSnapshot($sourceSnapshot); - $expectedResponse->setSourceSnapshotId($sourceSnapshotId); - $expectedResponse->setSourceStorageObject($sourceStorageObject); - $expectedResponse->setStatus($status); - $expectedResponse->setStoragePool($storagePool); - $expectedResponse->setType($type); - $expectedResponse->setZone($zone2); - $transport->addResponse($expectedResponse); - // Mock request - $disk = 'disk3083677'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->get($disk, $project, $zone); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Disks/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getDisk(); - $this->assertProtobufEquals($disk, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $disk = 'disk3083677'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - try { - $gapicClient->get($disk, $project, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $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 - $etag = 'etag3123477'; - $iamOwned = false; - $version = 351608024; - $expectedResponse = new Policy(); - $expectedResponse->setEtag($etag); - $expectedResponse->setIamOwned($iamOwned); - $expectedResponse->setVersion($version); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $zone = 'zone3744684'; - $response = $gapicClient->getIamPolicy($project, $resource, $zone); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Disks/GetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $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 - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $zone = 'zone3744684'; - try { - $gapicClient->getIamPolicy($project, $resource, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $diskResource = new Disk(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->insert($diskResource, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.Disks/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getDiskResource(); - $this->assertProtobufEquals($diskResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $diskResource = new Disk(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->insert($diskResource, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new Disk(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new DiskList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->list($project, $zone); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Disks/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $zone = 'zone3744684'; - try { - $gapicClient->list($project, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function removeResourcePoliciesTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/removeResourcePoliciesTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/removeResourcePoliciesTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $disk = 'disk3083677'; - $disksRemoveResourcePoliciesRequestResource = new DisksRemoveResourcePoliciesRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->removeResourcePolicies($disk, $disksRemoveResourcePoliciesRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.Disks/RemoveResourcePolicies', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getDisk(); - $this->assertProtobufEquals($disk, $actualValue); - $actualValue = $actualApiRequestObject->getDisksRemoveResourcePoliciesRequestResource(); - $this->assertProtobufEquals($disksRemoveResourcePoliciesRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function removeResourcePoliciesExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/removeResourcePoliciesExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $disk = 'disk3083677'; - $disksRemoveResourcePoliciesRequestResource = new DisksRemoveResourcePoliciesRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->removeResourcePolicies($disk, $disksRemoveResourcePoliciesRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 resizeTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/resizeTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/resizeTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $disk = 'disk3083677'; - $disksResizeRequestResource = new DisksResizeRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->resize($disk, $disksResizeRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.Disks/Resize', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getDisk(); - $this->assertProtobufEquals($disk, $actualValue); - $actualValue = $actualApiRequestObject->getDisksResizeRequestResource(); - $this->assertProtobufEquals($disksResizeRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function resizeExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/resizeExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $disk = 'disk3083677'; - $disksResizeRequestResource = new DisksResizeRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->resize($disk, $disksResizeRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 - $etag = 'etag3123477'; - $iamOwned = false; - $version = 351608024; - $expectedResponse = new Policy(); - $expectedResponse->setEtag($etag); - $expectedResponse->setIamOwned($iamOwned); - $expectedResponse->setVersion($version); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $zone = 'zone3744684'; - $zoneSetPolicyRequestResource = new ZoneSetPolicyRequest(); - $response = $gapicClient->setIamPolicy($project, $resource, $zone, $zoneSetPolicyRequestResource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Disks/SetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $actualValue = $actualRequestObject->getZoneSetPolicyRequestResource(); - $this->assertProtobufEquals($zoneSetPolicyRequestResource, $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 - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $zone = 'zone3744684'; - $zoneSetPolicyRequestResource = new ZoneSetPolicyRequest(); - try { - $gapicClient->setIamPolicy($project, $resource, $zone, $zoneSetPolicyRequestResource); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setLabelsTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setLabelsTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/setLabelsTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $zone = 'zone3744684'; - $zoneSetLabelsRequestResource = new ZoneSetLabelsRequest(); - $response = $gapicClient->setLabels($project, $resource, $zone, $zoneSetLabelsRequestResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.Disks/SetLabels', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $actualValue = $actualApiRequestObject->getZoneSetLabelsRequestResource(); - $this->assertProtobufEquals($zoneSetLabelsRequestResource, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setLabelsExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setLabelsExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $zone = 'zone3744684'; - $zoneSetLabelsRequestResource = new ZoneSetLabelsRequest(); - $response = $gapicClient->setLabels($project, $resource, $zone, $zoneSetLabelsRequestResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 startAsyncReplicationTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/startAsyncReplicationTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/startAsyncReplicationTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $disk = 'disk3083677'; - $disksStartAsyncReplicationRequestResource = new DisksStartAsyncReplicationRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->startAsyncReplication($disk, $disksStartAsyncReplicationRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.Disks/StartAsyncReplication', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getDisk(); - $this->assertProtobufEquals($disk, $actualValue); - $actualValue = $actualApiRequestObject->getDisksStartAsyncReplicationRequestResource(); - $this->assertProtobufEquals($disksStartAsyncReplicationRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function startAsyncReplicationExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/startAsyncReplicationExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $disk = 'disk3083677'; - $disksStartAsyncReplicationRequestResource = new DisksStartAsyncReplicationRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->startAsyncReplication($disk, $disksStartAsyncReplicationRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 stopAsyncReplicationTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/stopAsyncReplicationTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/stopAsyncReplicationTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $disk = 'disk3083677'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->stopAsyncReplication($disk, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.Disks/StopAsyncReplication', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getDisk(); - $this->assertProtobufEquals($disk, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function stopAsyncReplicationExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/stopAsyncReplicationExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $disk = 'disk3083677'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->stopAsyncReplication($disk, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 stopGroupAsyncReplicationTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/stopGroupAsyncReplicationTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/stopGroupAsyncReplicationTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $disksStopGroupAsyncReplicationResourceResource = new DisksStopGroupAsyncReplicationResource(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->stopGroupAsyncReplication($disksStopGroupAsyncReplicationResourceResource, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.Disks/StopGroupAsyncReplication', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getDisksStopGroupAsyncReplicationResourceResource(); - $this->assertProtobufEquals($disksStopGroupAsyncReplicationResourceResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function stopGroupAsyncReplicationExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/stopGroupAsyncReplicationExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $disksStopGroupAsyncReplicationResourceResource = new DisksStopGroupAsyncReplicationResource(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->stopGroupAsyncReplication($disksStopGroupAsyncReplicationResourceResource, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 testIamPermissionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new TestPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $testPermissionsRequestResource = new TestPermissionsRequest(); - $zone = 'zone3744684'; - $response = $gapicClient->testIamPermissions($project, $resource, $testPermissionsRequestResource, $zone); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Disks/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getTestPermissionsRequestResource(); - $this->assertProtobufEquals($testPermissionsRequestResource, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $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 - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $testPermissionsRequestResource = new TestPermissionsRequest(); - $zone = 'zone3744684'; - try { - $gapicClient->testIamPermissions($project, $resource, $testPermissionsRequestResource, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/updateTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/updateTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $disk = 'disk3083677'; - $diskResource = new Disk(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->update($disk, $diskResource, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.Disks/Update', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getDisk(); - $this->assertProtobufEquals($disk, $actualValue); - $actualValue = $actualApiRequestObject->getDiskResource(); - $this->assertProtobufEquals($diskResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function updateExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/updateExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $disk = 'disk3083677'; - $diskResource = new Disk(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->update($disk, $diskResource, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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/Compute/tests/Unit/V1/ExternalVpnGatewaysClientTest.php b/Compute/tests/Unit/V1/ExternalVpnGatewaysClientTest.php deleted file mode 100644 index e6275b00147d..000000000000 --- a/Compute/tests/Unit/V1/ExternalVpnGatewaysClientTest.php +++ /dev/null @@ -1,635 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return ExternalVpnGatewaysClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new ExternalVpnGatewaysClient($options); - } - - /** @test */ - public function deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $externalVpnGateway = 'externalVpnGateway-2037585019'; - $project = 'project-309310695'; - $response = $gapicClient->delete($externalVpnGateway, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.ExternalVpnGateways/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getExternalVpnGateway(); - $this->assertProtobufEquals($externalVpnGateway, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $externalVpnGateway = 'externalVpnGateway-2037585019'; - $project = 'project-309310695'; - $response = $gapicClient->delete($externalVpnGateway, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $id = 3355; - $kind = 'kind3292052'; - $labelFingerprint = 'labelFingerprint714995737'; - $name = 'name3373707'; - $redundancyType = 'redundancyType1345185564'; - $selfLink = 'selfLink-1691268851'; - $expectedResponse = new ExternalVpnGateway(); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setLabelFingerprint($labelFingerprint); - $expectedResponse->setName($name); - $expectedResponse->setRedundancyType($redundancyType); - $expectedResponse->setSelfLink($selfLink); - $transport->addResponse($expectedResponse); - // Mock request - $externalVpnGateway = 'externalVpnGateway-2037585019'; - $project = 'project-309310695'; - $response = $gapicClient->get($externalVpnGateway, $project); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.ExternalVpnGateways/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getExternalVpnGateway(); - $this->assertProtobufEquals($externalVpnGateway, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $externalVpnGateway = 'externalVpnGateway-2037585019'; - $project = 'project-309310695'; - try { - $gapicClient->get($externalVpnGateway, $project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $externalVpnGatewayResource = new ExternalVpnGateway(); - $project = 'project-309310695'; - $response = $gapicClient->insert($externalVpnGatewayResource, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.ExternalVpnGateways/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getExternalVpnGatewayResource(); - $this->assertProtobufEquals($externalVpnGatewayResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $externalVpnGatewayResource = new ExternalVpnGateway(); - $project = 'project-309310695'; - $response = $gapicClient->insert($externalVpnGatewayResource, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $etag = 'etag3123477'; - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new ExternalVpnGateway(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new ExternalVpnGatewayList(); - $expectedResponse->setEtag($etag); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->list($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.ExternalVpnGateways/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->list($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setLabelsTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setLabelsTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/setLabelsTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $globalSetLabelsRequestResource = new GlobalSetLabelsRequest(); - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $response = $gapicClient->setLabels($globalSetLabelsRequestResource, $project, $resource); - $this->assertFalse($response->isDone()); - $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.compute.v1.ExternalVpnGateways/SetLabels', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getGlobalSetLabelsRequestResource(); - $this->assertProtobufEquals($globalSetLabelsRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setLabelsExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setLabelsExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $globalSetLabelsRequestResource = new GlobalSetLabelsRequest(); - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $response = $gapicClient->setLabels($globalSetLabelsRequestResource, $project, $resource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 testIamPermissionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new TestPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $testPermissionsRequestResource = new TestPermissionsRequest(); - $response = $gapicClient->testIamPermissions($project, $resource, $testPermissionsRequestResource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.ExternalVpnGateways/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getTestPermissionsRequestResource(); - $this->assertProtobufEquals($testPermissionsRequestResource, $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 - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $testPermissionsRequestResource = new TestPermissionsRequest(); - try { - $gapicClient->testIamPermissions($project, $resource, $testPermissionsRequestResource); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->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/Compute/tests/Unit/V1/FirewallPoliciesClientTest.php b/Compute/tests/Unit/V1/FirewallPoliciesClientTest.php deleted file mode 100644 index 6bc33f8395b4..000000000000 --- a/Compute/tests/Unit/V1/FirewallPoliciesClientTest.php +++ /dev/null @@ -1,1733 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return FirewallPoliciesClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new FirewallPoliciesClient($options); - } - - /** @test */ - public function addAssociationTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOrganizationOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/addAssociationTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/addAssociationTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $firewallPolicy = 'firewallPolicy1035044177'; - $firewallPolicyAssociationResource = new FirewallPolicyAssociation(); - $response = $gapicClient->addAssociation($firewallPolicy, $firewallPolicyAssociationResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.FirewallPolicies/AddAssociation', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getFirewallPolicy(); - $this->assertProtobufEquals($firewallPolicy, $actualValue); - $actualValue = $actualApiRequestObject->getFirewallPolicyAssociationResource(); - $this->assertProtobufEquals($firewallPolicyAssociationResource, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOrganizationOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOrganizationOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function addAssociationExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOrganizationOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/addAssociationExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $firewallPolicy = 'firewallPolicy1035044177'; - $firewallPolicyAssociationResource = new FirewallPolicyAssociation(); - $response = $gapicClient->addAssociation($firewallPolicy, $firewallPolicyAssociationResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 addRuleTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOrganizationOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/addRuleTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/addRuleTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $firewallPolicy = 'firewallPolicy1035044177'; - $firewallPolicyRuleResource = new FirewallPolicyRule(); - $response = $gapicClient->addRule($firewallPolicy, $firewallPolicyRuleResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.FirewallPolicies/AddRule', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getFirewallPolicy(); - $this->assertProtobufEquals($firewallPolicy, $actualValue); - $actualValue = $actualApiRequestObject->getFirewallPolicyRuleResource(); - $this->assertProtobufEquals($firewallPolicyRuleResource, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOrganizationOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOrganizationOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function addRuleExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOrganizationOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/addRuleExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $firewallPolicy = 'firewallPolicy1035044177'; - $firewallPolicyRuleResource = new FirewallPolicyRule(); - $response = $gapicClient->addRule($firewallPolicy, $firewallPolicyRuleResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 cloneRulesTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOrganizationOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/cloneRulesTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/cloneRulesTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $firewallPolicy = 'firewallPolicy1035044177'; - $response = $gapicClient->cloneRules($firewallPolicy); - $this->assertFalse($response->isDone()); - $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.compute.v1.FirewallPolicies/CloneRules', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getFirewallPolicy(); - $this->assertProtobufEquals($firewallPolicy, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOrganizationOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOrganizationOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function cloneRulesExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOrganizationOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/cloneRulesExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $firewallPolicy = 'firewallPolicy1035044177'; - $response = $gapicClient->cloneRules($firewallPolicy); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOrganizationOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $firewallPolicy = 'firewallPolicy1035044177'; - $response = $gapicClient->delete($firewallPolicy); - $this->assertFalse($response->isDone()); - $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.compute.v1.FirewallPolicies/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getFirewallPolicy(); - $this->assertProtobufEquals($firewallPolicy, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOrganizationOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOrganizationOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOrganizationOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $firewallPolicy = 'firewallPolicy1035044177'; - $response = $gapicClient->delete($firewallPolicy); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $displayName = 'displayName1615086568'; - $fingerprint = 'fingerprint-1375934236'; - $id = 3355; - $kind = 'kind3292052'; - $name = 'name3373707'; - $parent = 'parent-995424086'; - $region = 'region-934795532'; - $ruleTupleCount = 388342037; - $selfLink = 'selfLink-1691268851'; - $selfLinkWithId = 'selfLinkWithId-1029220862'; - $shortName = 'shortName1565793390'; - $expectedResponse = new FirewallPolicy(); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setFingerprint($fingerprint); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setName($name); - $expectedResponse->setParent($parent); - $expectedResponse->setRegion($region); - $expectedResponse->setRuleTupleCount($ruleTupleCount); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setSelfLinkWithId($selfLinkWithId); - $expectedResponse->setShortName($shortName); - $transport->addResponse($expectedResponse); - // Mock request - $firewallPolicy = 'firewallPolicy1035044177'; - $response = $gapicClient->get($firewallPolicy); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.FirewallPolicies/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getFirewallPolicy(); - $this->assertProtobufEquals($firewallPolicy, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $firewallPolicy = 'firewallPolicy1035044177'; - try { - $gapicClient->get($firewallPolicy); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getAssociationTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $attachmentTarget = 'attachmentTarget1786386477'; - $displayName = 'displayName1615086568'; - $firewallPolicyId = 'firewallPolicyId1430953673'; - $name2 = 'name2-1052831874'; - $shortName = 'shortName1565793390'; - $expectedResponse = new FirewallPolicyAssociation(); - $expectedResponse->setAttachmentTarget($attachmentTarget); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setFirewallPolicyId($firewallPolicyId); - $expectedResponse->setName($name2); - $expectedResponse->setShortName($shortName); - $transport->addResponse($expectedResponse); - // Mock request - $firewallPolicy = 'firewallPolicy1035044177'; - $response = $gapicClient->getAssociation($firewallPolicy); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.FirewallPolicies/GetAssociation', $actualFuncCall); - $actualValue = $actualRequestObject->getFirewallPolicy(); - $this->assertProtobufEquals($firewallPolicy, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getAssociationExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $firewallPolicy = 'firewallPolicy1035044177'; - try { - $gapicClient->getAssociation($firewallPolicy); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $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 - $etag = 'etag3123477'; - $iamOwned = false; - $version = 351608024; - $expectedResponse = new Policy(); - $expectedResponse->setEtag($etag); - $expectedResponse->setIamOwned($iamOwned); - $expectedResponse->setVersion($version); - $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.compute.v1.FirewallPolicies/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 getRuleTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $action = 'action-1422950858'; - $description = 'description-1724546052'; - $direction = 'direction-962590849'; - $disabled = true; - $enableLogging = false; - $kind = 'kind3292052'; - $priority2 = 978365527; - $ruleName = 'ruleName-2092197394'; - $ruleTupleCount = 388342037; - $securityProfileGroup = 'securityProfileGroup-329459286'; - $tlsInspect = true; - $expectedResponse = new FirewallPolicyRule(); - $expectedResponse->setAction($action); - $expectedResponse->setDescription($description); - $expectedResponse->setDirection($direction); - $expectedResponse->setDisabled($disabled); - $expectedResponse->setEnableLogging($enableLogging); - $expectedResponse->setKind($kind); - $expectedResponse->setPriority($priority2); - $expectedResponse->setRuleName($ruleName); - $expectedResponse->setRuleTupleCount($ruleTupleCount); - $expectedResponse->setSecurityProfileGroup($securityProfileGroup); - $expectedResponse->setTlsInspect($tlsInspect); - $transport->addResponse($expectedResponse); - // Mock request - $firewallPolicy = 'firewallPolicy1035044177'; - $response = $gapicClient->getRule($firewallPolicy); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.FirewallPolicies/GetRule', $actualFuncCall); - $actualValue = $actualRequestObject->getFirewallPolicy(); - $this->assertProtobufEquals($firewallPolicy, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getRuleExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $firewallPolicy = 'firewallPolicy1035044177'; - try { - $gapicClient->getRule($firewallPolicy); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOrganizationOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $firewallPolicyResource = new FirewallPolicy(); - $parentId = 'parentId2070327504'; - $response = $gapicClient->insert($firewallPolicyResource, $parentId); - $this->assertFalse($response->isDone()); - $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.compute.v1.FirewallPolicies/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getFirewallPolicyResource(); - $this->assertProtobufEquals($firewallPolicyResource, $actualValue); - $actualValue = $actualApiRequestObject->getParentId(); - $this->assertProtobufEquals($parentId, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOrganizationOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOrganizationOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOrganizationOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $firewallPolicyResource = new FirewallPolicy(); - $parentId = 'parentId2070327504'; - $response = $gapicClient->insert($firewallPolicyResource, $parentId); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $itemsElement = new FirewallPolicy(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new FirewallPolicyList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - $response = $gapicClient->list(); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.FirewallPolicies/List', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->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->list(); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listAssociationsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $kind = 'kind3292052'; - $expectedResponse = new FirewallPoliciesListAssociationsResponse(); - $expectedResponse->setKind($kind); - $transport->addResponse($expectedResponse); - $response = $gapicClient->listAssociations(); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.FirewallPolicies/ListAssociations', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listAssociationsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->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->listAssociations(); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function moveTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOrganizationOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/moveTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/moveTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $firewallPolicy = 'firewallPolicy1035044177'; - $parentId = 'parentId2070327504'; - $response = $gapicClient->move($firewallPolicy, $parentId); - $this->assertFalse($response->isDone()); - $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.compute.v1.FirewallPolicies/Move', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getFirewallPolicy(); - $this->assertProtobufEquals($firewallPolicy, $actualValue); - $actualValue = $actualApiRequestObject->getParentId(); - $this->assertProtobufEquals($parentId, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOrganizationOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOrganizationOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function moveExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOrganizationOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/moveExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $firewallPolicy = 'firewallPolicy1035044177'; - $parentId = 'parentId2070327504'; - $response = $gapicClient->move($firewallPolicy, $parentId); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 patchTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOrganizationOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/patchTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $firewallPolicy = 'firewallPolicy1035044177'; - $firewallPolicyResource = new FirewallPolicy(); - $response = $gapicClient->patch($firewallPolicy, $firewallPolicyResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.FirewallPolicies/Patch', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getFirewallPolicy(); - $this->assertProtobufEquals($firewallPolicy, $actualValue); - $actualValue = $actualApiRequestObject->getFirewallPolicyResource(); - $this->assertProtobufEquals($firewallPolicyResource, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOrganizationOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOrganizationOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function patchExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOrganizationOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $firewallPolicy = 'firewallPolicy1035044177'; - $firewallPolicyResource = new FirewallPolicy(); - $response = $gapicClient->patch($firewallPolicy, $firewallPolicyResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 patchRuleTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOrganizationOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchRuleTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/patchRuleTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $firewallPolicy = 'firewallPolicy1035044177'; - $firewallPolicyRuleResource = new FirewallPolicyRule(); - $response = $gapicClient->patchRule($firewallPolicy, $firewallPolicyRuleResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.FirewallPolicies/PatchRule', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getFirewallPolicy(); - $this->assertProtobufEquals($firewallPolicy, $actualValue); - $actualValue = $actualApiRequestObject->getFirewallPolicyRuleResource(); - $this->assertProtobufEquals($firewallPolicyRuleResource, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOrganizationOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOrganizationOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function patchRuleExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOrganizationOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchRuleExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $firewallPolicy = 'firewallPolicy1035044177'; - $firewallPolicyRuleResource = new FirewallPolicyRule(); - $response = $gapicClient->patchRule($firewallPolicy, $firewallPolicyRuleResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 removeAssociationTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOrganizationOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/removeAssociationTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/removeAssociationTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $firewallPolicy = 'firewallPolicy1035044177'; - $response = $gapicClient->removeAssociation($firewallPolicy); - $this->assertFalse($response->isDone()); - $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.compute.v1.FirewallPolicies/RemoveAssociation', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getFirewallPolicy(); - $this->assertProtobufEquals($firewallPolicy, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOrganizationOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOrganizationOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function removeAssociationExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOrganizationOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/removeAssociationExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $firewallPolicy = 'firewallPolicy1035044177'; - $response = $gapicClient->removeAssociation($firewallPolicy); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 removeRuleTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOrganizationOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/removeRuleTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/removeRuleTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $firewallPolicy = 'firewallPolicy1035044177'; - $response = $gapicClient->removeRule($firewallPolicy); - $this->assertFalse($response->isDone()); - $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.compute.v1.FirewallPolicies/RemoveRule', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getFirewallPolicy(); - $this->assertProtobufEquals($firewallPolicy, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOrganizationOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOrganizationOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function removeRuleExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOrganizationOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/removeRuleExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $firewallPolicy = 'firewallPolicy1035044177'; - $response = $gapicClient->removeRule($firewallPolicy); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 - $etag = 'etag3123477'; - $iamOwned = false; - $version = 351608024; - $expectedResponse = new Policy(); - $expectedResponse->setEtag($etag); - $expectedResponse->setIamOwned($iamOwned); - $expectedResponse->setVersion($version); - $transport->addResponse($expectedResponse); - // Mock request - $globalOrganizationSetPolicyRequestResource = new GlobalOrganizationSetPolicyRequest(); - $resource = 'resource-341064690'; - $response = $gapicClient->setIamPolicy($globalOrganizationSetPolicyRequestResource, $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.compute.v1.FirewallPolicies/SetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getGlobalOrganizationSetPolicyRequestResource(); - $this->assertProtobufEquals($globalOrganizationSetPolicyRequestResource, $actualValue); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $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 - $globalOrganizationSetPolicyRequestResource = new GlobalOrganizationSetPolicyRequest(); - $resource = 'resource-341064690'; - try { - $gapicClient->setIamPolicy($globalOrganizationSetPolicyRequestResource, $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 testIamPermissionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new TestPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $resource = 'resource-341064690'; - $testPermissionsRequestResource = new TestPermissionsRequest(); - $response = $gapicClient->testIamPermissions($resource, $testPermissionsRequestResource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.FirewallPolicies/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getTestPermissionsRequestResource(); - $this->assertProtobufEquals($testPermissionsRequestResource, $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'; - $testPermissionsRequestResource = new TestPermissionsRequest(); - try { - $gapicClient->testIamPermissions($resource, $testPermissionsRequestResource); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->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/Compute/tests/Unit/V1/FirewallsClientTest.php b/Compute/tests/Unit/V1/FirewallsClientTest.php deleted file mode 100644 index ee9d1bb922d3..000000000000 --- a/Compute/tests/Unit/V1/FirewallsClientTest.php +++ /dev/null @@ -1,686 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return FirewallsClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new FirewallsClient($options); - } - - /** @test */ - public function deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $firewall = 'firewall-562725632'; - $project = 'project-309310695'; - $response = $gapicClient->delete($firewall, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.Firewalls/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getFirewall(); - $this->assertProtobufEquals($firewall, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $firewall = 'firewall-562725632'; - $project = 'project-309310695'; - $response = $gapicClient->delete($firewall, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $direction = 'direction-962590849'; - $disabled = true; - $id = 3355; - $kind = 'kind3292052'; - $name = 'name3373707'; - $network = 'network1843485230'; - $priority = 1165461084; - $selfLink = 'selfLink-1691268851'; - $expectedResponse = new Firewall(); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setDirection($direction); - $expectedResponse->setDisabled($disabled); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setName($name); - $expectedResponse->setNetwork($network); - $expectedResponse->setPriority($priority); - $expectedResponse->setSelfLink($selfLink); - $transport->addResponse($expectedResponse); - // Mock request - $firewall = 'firewall-562725632'; - $project = 'project-309310695'; - $response = $gapicClient->get($firewall, $project); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Firewalls/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getFirewall(); - $this->assertProtobufEquals($firewall, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $firewall = 'firewall-562725632'; - $project = 'project-309310695'; - try { - $gapicClient->get($firewall, $project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $firewallResource = new Firewall(); - $project = 'project-309310695'; - $response = $gapicClient->insert($firewallResource, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.Firewalls/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getFirewallResource(); - $this->assertProtobufEquals($firewallResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $firewallResource = new Firewall(); - $project = 'project-309310695'; - $response = $gapicClient->insert($firewallResource, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new Firewall(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new FirewallList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->list($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Firewalls/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->list($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function patchTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/patchTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $firewall = 'firewall-562725632'; - $firewallResource = new Firewall(); - $project = 'project-309310695'; - $response = $gapicClient->patch($firewall, $firewallResource, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.Firewalls/Patch', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getFirewall(); - $this->assertProtobufEquals($firewall, $actualValue); - $actualValue = $actualApiRequestObject->getFirewallResource(); - $this->assertProtobufEquals($firewallResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function patchExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $firewall = 'firewall-562725632'; - $firewallResource = new Firewall(); - $project = 'project-309310695'; - $response = $gapicClient->patch($firewall, $firewallResource, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 updateTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/updateTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/updateTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $firewall = 'firewall-562725632'; - $firewallResource = new Firewall(); - $project = 'project-309310695'; - $response = $gapicClient->update($firewall, $firewallResource, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.Firewalls/Update', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getFirewall(); - $this->assertProtobufEquals($firewall, $actualValue); - $actualValue = $actualApiRequestObject->getFirewallResource(); - $this->assertProtobufEquals($firewallResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function updateExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/updateExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $firewall = 'firewall-562725632'; - $firewallResource = new Firewall(); - $project = 'project-309310695'; - $response = $gapicClient->update($firewall, $firewallResource, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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/Compute/tests/Unit/V1/ForwardingRulesClientTest.php b/Compute/tests/Unit/V1/ForwardingRulesClientTest.php deleted file mode 100644 index 6ced44264688..000000000000 --- a/Compute/tests/Unit/V1/ForwardingRulesClientTest.php +++ /dev/null @@ -1,962 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return ForwardingRulesClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new ForwardingRulesClient($options); - } - - /** @test */ - public function aggregatedListTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $items = [ - 'itemsKey' => new ForwardingRulesScopedList(), - ]; - $expectedResponse = new ForwardingRuleAggregatedList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->aggregatedList($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertArrayHasKey('itemsKey', $expectedResponse->getItems()); - $this->assertArrayHasKey('itemsKey', $resources); - $this->assertEquals($expectedResponse->getItems()['itemsKey'], $resources['itemsKey']); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.ForwardingRules/AggregatedList', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function aggregatedListExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->aggregatedList($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $forwardingRule = 'forwardingRule-1340648706'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->delete($forwardingRule, $project, $region); - $this->assertFalse($response->isDone()); - $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.compute.v1.ForwardingRules/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getForwardingRule(); - $this->assertProtobufEquals($forwardingRule, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $forwardingRule = 'forwardingRule-1340648706'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->delete($forwardingRule, $project, $region); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $iPAddress = 'iPAddress1116718767'; - $iPProtocol = 'iPProtocol488094525'; - $allPorts = true; - $allowGlobalAccess = true; - $allowPscGlobalAccess = false; - $backendService = 'backendService306946058'; - $baseForwardingRule = 'baseForwardingRule524873104'; - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $externalManagedBackendBucketMigrationState = 'externalManagedBackendBucketMigrationState-429059542'; - $externalManagedBackendBucketMigrationTestingPercentage = 3856772; - $fingerprint = 'fingerprint-1375934236'; - $id = 3355; - $ipCollection = 'ipCollection176818358'; - $ipVersion = 'ipVersion-1315653184'; - $isMirroringCollector = true; - $kind = 'kind3292052'; - $labelFingerprint = 'labelFingerprint714995737'; - $loadBalancingScheme = 'loadBalancingScheme1974502980'; - $name = 'name3373707'; - $network = 'network1843485230'; - $networkTier = 'networkTier-19473069'; - $noAutomateDnsZone = false; - $portRange = 'portRange217518079'; - $pscConnectionId = 292082397; - $pscConnectionStatus = 'pscConnectionStatus-889592652'; - $region2 = 'region2-690338393'; - $selfLink = 'selfLink-1691268851'; - $selfLinkWithId = 'selfLinkWithId-1029220862'; - $serviceLabel = 'serviceLabel-1730474774'; - $serviceName = 'serviceName359880149'; - $subnetwork = 'subnetwork-1302785042'; - $target = 'target-880905839'; - $expectedResponse = new ForwardingRule(); - $expectedResponse->setIPAddress($iPAddress); - $expectedResponse->setIPProtocol($iPProtocol); - $expectedResponse->setAllPorts($allPorts); - $expectedResponse->setAllowGlobalAccess($allowGlobalAccess); - $expectedResponse->setAllowPscGlobalAccess($allowPscGlobalAccess); - $expectedResponse->setBackendService($backendService); - $expectedResponse->setBaseForwardingRule($baseForwardingRule); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setExternalManagedBackendBucketMigrationState($externalManagedBackendBucketMigrationState); - $expectedResponse->setExternalManagedBackendBucketMigrationTestingPercentage($externalManagedBackendBucketMigrationTestingPercentage); - $expectedResponse->setFingerprint($fingerprint); - $expectedResponse->setId($id); - $expectedResponse->setIpCollection($ipCollection); - $expectedResponse->setIpVersion($ipVersion); - $expectedResponse->setIsMirroringCollector($isMirroringCollector); - $expectedResponse->setKind($kind); - $expectedResponse->setLabelFingerprint($labelFingerprint); - $expectedResponse->setLoadBalancingScheme($loadBalancingScheme); - $expectedResponse->setName($name); - $expectedResponse->setNetwork($network); - $expectedResponse->setNetworkTier($networkTier); - $expectedResponse->setNoAutomateDnsZone($noAutomateDnsZone); - $expectedResponse->setPortRange($portRange); - $expectedResponse->setPscConnectionId($pscConnectionId); - $expectedResponse->setPscConnectionStatus($pscConnectionStatus); - $expectedResponse->setRegion($region2); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setSelfLinkWithId($selfLinkWithId); - $expectedResponse->setServiceLabel($serviceLabel); - $expectedResponse->setServiceName($serviceName); - $expectedResponse->setSubnetwork($subnetwork); - $expectedResponse->setTarget($target); - $transport->addResponse($expectedResponse); - // Mock request - $forwardingRule = 'forwardingRule-1340648706'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->get($forwardingRule, $project, $region); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.ForwardingRules/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getForwardingRule(); - $this->assertProtobufEquals($forwardingRule, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $forwardingRule = 'forwardingRule-1340648706'; - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->get($forwardingRule, $project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $forwardingRuleResource = new ForwardingRule(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->insert($forwardingRuleResource, $project, $region); - $this->assertFalse($response->isDone()); - $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.compute.v1.ForwardingRules/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getForwardingRuleResource(); - $this->assertProtobufEquals($forwardingRuleResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $forwardingRuleResource = new ForwardingRule(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->insert($forwardingRuleResource, $project, $region); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new ForwardingRule(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new ForwardingRuleList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->list($project, $region); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.ForwardingRules/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->list($project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function patchTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/patchTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $forwardingRule = 'forwardingRule-1340648706'; - $forwardingRuleResource = new ForwardingRule(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->patch($forwardingRule, $forwardingRuleResource, $project, $region); - $this->assertFalse($response->isDone()); - $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.compute.v1.ForwardingRules/Patch', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getForwardingRule(); - $this->assertProtobufEquals($forwardingRule, $actualValue); - $actualValue = $actualApiRequestObject->getForwardingRuleResource(); - $this->assertProtobufEquals($forwardingRuleResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function patchExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $forwardingRule = 'forwardingRule-1340648706'; - $forwardingRuleResource = new ForwardingRule(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->patch($forwardingRule, $forwardingRuleResource, $project, $region); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 setLabelsTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setLabelsTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/setLabelsTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionSetLabelsRequestResource = new RegionSetLabelsRequest(); - $resource = 'resource-341064690'; - $response = $gapicClient->setLabels($project, $region, $regionSetLabelsRequestResource, $resource); - $this->assertFalse($response->isDone()); - $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.compute.v1.ForwardingRules/SetLabels', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getRegionSetLabelsRequestResource(); - $this->assertProtobufEquals($regionSetLabelsRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setLabelsExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setLabelsExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionSetLabelsRequestResource = new RegionSetLabelsRequest(); - $resource = 'resource-341064690'; - $response = $gapicClient->setLabels($project, $region, $regionSetLabelsRequestResource, $resource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 setTargetTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setTargetTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/setTargetTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $forwardingRule = 'forwardingRule-1340648706'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $targetReferenceResource = new TargetReference(); - $response = $gapicClient->setTarget($forwardingRule, $project, $region, $targetReferenceResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.ForwardingRules/SetTarget', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getForwardingRule(); - $this->assertProtobufEquals($forwardingRule, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getTargetReferenceResource(); - $this->assertProtobufEquals($targetReferenceResource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setTargetExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setTargetExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $forwardingRule = 'forwardingRule-1340648706'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $targetReferenceResource = new TargetReference(); - $response = $gapicClient->setTarget($forwardingRule, $project, $region, $targetReferenceResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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/Compute/tests/Unit/V1/GlobalAddressesClientTest.php b/Compute/tests/Unit/V1/GlobalAddressesClientTest.php deleted file mode 100644 index 4b6cd7d01c91..000000000000 --- a/Compute/tests/Unit/V1/GlobalAddressesClientTest.php +++ /dev/null @@ -1,704 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return GlobalAddressesClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new GlobalAddressesClient($options); - } - - /** @test */ - public function deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $address = 'address-1147692044'; - $project = 'project-309310695'; - $response = $gapicClient->delete($address, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.GlobalAddresses/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getAddress(); - $this->assertProtobufEquals($address, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $address = 'address-1147692044'; - $project = 'project-309310695'; - $response = $gapicClient->delete($address, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $address2 = 'address2874543783'; - $addressType = 'addressType264307877'; - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $id = 3355; - $ipVersion = 'ipVersion-1315653184'; - $ipv6EndpointType = 'ipv6EndpointType-2049982644'; - $kind = 'kind3292052'; - $labelFingerprint = 'labelFingerprint714995737'; - $name = 'name3373707'; - $network = 'network1843485230'; - $networkTier = 'networkTier-19473069'; - $prefixLength = 1157046989; - $purpose = 'purpose-220463842'; - $region = 'region-934795532'; - $selfLink = 'selfLink-1691268851'; - $status = 'status-892481550'; - $subnetwork = 'subnetwork-1302785042'; - $expectedResponse = new Address(); - $expectedResponse->setAddress($address2); - $expectedResponse->setAddressType($addressType); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setId($id); - $expectedResponse->setIpVersion($ipVersion); - $expectedResponse->setIpv6EndpointType($ipv6EndpointType); - $expectedResponse->setKind($kind); - $expectedResponse->setLabelFingerprint($labelFingerprint); - $expectedResponse->setName($name); - $expectedResponse->setNetwork($network); - $expectedResponse->setNetworkTier($networkTier); - $expectedResponse->setPrefixLength($prefixLength); - $expectedResponse->setPurpose($purpose); - $expectedResponse->setRegion($region); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setStatus($status); - $expectedResponse->setSubnetwork($subnetwork); - $transport->addResponse($expectedResponse); - // Mock request - $address = 'address-1147692044'; - $project = 'project-309310695'; - $response = $gapicClient->get($address, $project); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.GlobalAddresses/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getAddress(); - $this->assertProtobufEquals($address, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $address = 'address-1147692044'; - $project = 'project-309310695'; - try { - $gapicClient->get($address, $project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $addressResource = new Address(); - $project = 'project-309310695'; - $response = $gapicClient->insert($addressResource, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.GlobalAddresses/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getAddressResource(); - $this->assertProtobufEquals($addressResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $addressResource = new Address(); - $project = 'project-309310695'; - $response = $gapicClient->insert($addressResource, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new Address(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new AddressList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->list($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.GlobalAddresses/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->list($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function moveTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/moveTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/moveTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $address = 'address-1147692044'; - $globalAddressesMoveRequestResource = new GlobalAddressesMoveRequest(); - $project = 'project-309310695'; - $response = $gapicClient->move($address, $globalAddressesMoveRequestResource, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.GlobalAddresses/Move', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getAddress(); - $this->assertProtobufEquals($address, $actualValue); - $actualValue = $actualApiRequestObject->getGlobalAddressesMoveRequestResource(); - $this->assertProtobufEquals($globalAddressesMoveRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function moveExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/moveExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $address = 'address-1147692044'; - $globalAddressesMoveRequestResource = new GlobalAddressesMoveRequest(); - $project = 'project-309310695'; - $response = $gapicClient->move($address, $globalAddressesMoveRequestResource, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 setLabelsTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setLabelsTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/setLabelsTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $globalSetLabelsRequestResource = new GlobalSetLabelsRequest(); - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $response = $gapicClient->setLabels($globalSetLabelsRequestResource, $project, $resource); - $this->assertFalse($response->isDone()); - $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.compute.v1.GlobalAddresses/SetLabels', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getGlobalSetLabelsRequestResource(); - $this->assertProtobufEquals($globalSetLabelsRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setLabelsExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setLabelsExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $globalSetLabelsRequestResource = new GlobalSetLabelsRequest(); - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $response = $gapicClient->setLabels($globalSetLabelsRequestResource, $project, $resource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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/Compute/tests/Unit/V1/GlobalForwardingRulesClientTest.php b/Compute/tests/Unit/V1/GlobalForwardingRulesClientTest.php deleted file mode 100644 index 7d582aed8f71..000000000000 --- a/Compute/tests/Unit/V1/GlobalForwardingRulesClientTest.php +++ /dev/null @@ -1,852 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return GlobalForwardingRulesClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new GlobalForwardingRulesClient($options); - } - - /** @test */ - public function deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $forwardingRule = 'forwardingRule-1340648706'; - $project = 'project-309310695'; - $response = $gapicClient->delete($forwardingRule, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.GlobalForwardingRules/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getForwardingRule(); - $this->assertProtobufEquals($forwardingRule, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $forwardingRule = 'forwardingRule-1340648706'; - $project = 'project-309310695'; - $response = $gapicClient->delete($forwardingRule, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $iPAddress = 'iPAddress1116718767'; - $iPProtocol = 'iPProtocol488094525'; - $allPorts = true; - $allowGlobalAccess = true; - $allowPscGlobalAccess = false; - $backendService = 'backendService306946058'; - $baseForwardingRule = 'baseForwardingRule524873104'; - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $externalManagedBackendBucketMigrationState = 'externalManagedBackendBucketMigrationState-429059542'; - $externalManagedBackendBucketMigrationTestingPercentage = 3856772; - $fingerprint = 'fingerprint-1375934236'; - $id = 3355; - $ipCollection = 'ipCollection176818358'; - $ipVersion = 'ipVersion-1315653184'; - $isMirroringCollector = true; - $kind = 'kind3292052'; - $labelFingerprint = 'labelFingerprint714995737'; - $loadBalancingScheme = 'loadBalancingScheme1974502980'; - $name = 'name3373707'; - $network = 'network1843485230'; - $networkTier = 'networkTier-19473069'; - $noAutomateDnsZone = false; - $portRange = 'portRange217518079'; - $pscConnectionId = 292082397; - $pscConnectionStatus = 'pscConnectionStatus-889592652'; - $region = 'region-934795532'; - $selfLink = 'selfLink-1691268851'; - $selfLinkWithId = 'selfLinkWithId-1029220862'; - $serviceLabel = 'serviceLabel-1730474774'; - $serviceName = 'serviceName359880149'; - $subnetwork = 'subnetwork-1302785042'; - $target = 'target-880905839'; - $expectedResponse = new ForwardingRule(); - $expectedResponse->setIPAddress($iPAddress); - $expectedResponse->setIPProtocol($iPProtocol); - $expectedResponse->setAllPorts($allPorts); - $expectedResponse->setAllowGlobalAccess($allowGlobalAccess); - $expectedResponse->setAllowPscGlobalAccess($allowPscGlobalAccess); - $expectedResponse->setBackendService($backendService); - $expectedResponse->setBaseForwardingRule($baseForwardingRule); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setExternalManagedBackendBucketMigrationState($externalManagedBackendBucketMigrationState); - $expectedResponse->setExternalManagedBackendBucketMigrationTestingPercentage($externalManagedBackendBucketMigrationTestingPercentage); - $expectedResponse->setFingerprint($fingerprint); - $expectedResponse->setId($id); - $expectedResponse->setIpCollection($ipCollection); - $expectedResponse->setIpVersion($ipVersion); - $expectedResponse->setIsMirroringCollector($isMirroringCollector); - $expectedResponse->setKind($kind); - $expectedResponse->setLabelFingerprint($labelFingerprint); - $expectedResponse->setLoadBalancingScheme($loadBalancingScheme); - $expectedResponse->setName($name); - $expectedResponse->setNetwork($network); - $expectedResponse->setNetworkTier($networkTier); - $expectedResponse->setNoAutomateDnsZone($noAutomateDnsZone); - $expectedResponse->setPortRange($portRange); - $expectedResponse->setPscConnectionId($pscConnectionId); - $expectedResponse->setPscConnectionStatus($pscConnectionStatus); - $expectedResponse->setRegion($region); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setSelfLinkWithId($selfLinkWithId); - $expectedResponse->setServiceLabel($serviceLabel); - $expectedResponse->setServiceName($serviceName); - $expectedResponse->setSubnetwork($subnetwork); - $expectedResponse->setTarget($target); - $transport->addResponse($expectedResponse); - // Mock request - $forwardingRule = 'forwardingRule-1340648706'; - $project = 'project-309310695'; - $response = $gapicClient->get($forwardingRule, $project); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.GlobalForwardingRules/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getForwardingRule(); - $this->assertProtobufEquals($forwardingRule, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $forwardingRule = 'forwardingRule-1340648706'; - $project = 'project-309310695'; - try { - $gapicClient->get($forwardingRule, $project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $forwardingRuleResource = new ForwardingRule(); - $project = 'project-309310695'; - $response = $gapicClient->insert($forwardingRuleResource, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.GlobalForwardingRules/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getForwardingRuleResource(); - $this->assertProtobufEquals($forwardingRuleResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $forwardingRuleResource = new ForwardingRule(); - $project = 'project-309310695'; - $response = $gapicClient->insert($forwardingRuleResource, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new ForwardingRule(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new ForwardingRuleList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->list($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.GlobalForwardingRules/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->list($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function patchTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/patchTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $forwardingRule = 'forwardingRule-1340648706'; - $forwardingRuleResource = new ForwardingRule(); - $project = 'project-309310695'; - $response = $gapicClient->patch($forwardingRule, $forwardingRuleResource, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.GlobalForwardingRules/Patch', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getForwardingRule(); - $this->assertProtobufEquals($forwardingRule, $actualValue); - $actualValue = $actualApiRequestObject->getForwardingRuleResource(); - $this->assertProtobufEquals($forwardingRuleResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function patchExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $forwardingRule = 'forwardingRule-1340648706'; - $forwardingRuleResource = new ForwardingRule(); - $project = 'project-309310695'; - $response = $gapicClient->patch($forwardingRule, $forwardingRuleResource, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 setLabelsTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setLabelsTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/setLabelsTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $globalSetLabelsRequestResource = new GlobalSetLabelsRequest(); - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $response = $gapicClient->setLabels($globalSetLabelsRequestResource, $project, $resource); - $this->assertFalse($response->isDone()); - $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.compute.v1.GlobalForwardingRules/SetLabels', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getGlobalSetLabelsRequestResource(); - $this->assertProtobufEquals($globalSetLabelsRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setLabelsExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setLabelsExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $globalSetLabelsRequestResource = new GlobalSetLabelsRequest(); - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $response = $gapicClient->setLabels($globalSetLabelsRequestResource, $project, $resource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 setTargetTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setTargetTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/setTargetTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $forwardingRule = 'forwardingRule-1340648706'; - $project = 'project-309310695'; - $targetReferenceResource = new TargetReference(); - $response = $gapicClient->setTarget($forwardingRule, $project, $targetReferenceResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.GlobalForwardingRules/SetTarget', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getForwardingRule(); - $this->assertProtobufEquals($forwardingRule, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getTargetReferenceResource(); - $this->assertProtobufEquals($targetReferenceResource, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setTargetExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setTargetExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $forwardingRule = 'forwardingRule-1340648706'; - $project = 'project-309310695'; - $targetReferenceResource = new TargetReference(); - $response = $gapicClient->setTarget($forwardingRule, $project, $targetReferenceResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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/Compute/tests/Unit/V1/GlobalNetworkEndpointGroupsClientTest.php b/Compute/tests/Unit/V1/GlobalNetworkEndpointGroupsClientTest.php deleted file mode 100644 index 99642427863b..000000000000 --- a/Compute/tests/Unit/V1/GlobalNetworkEndpointGroupsClientTest.php +++ /dev/null @@ -1,774 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return GlobalNetworkEndpointGroupsClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new GlobalNetworkEndpointGroupsClient($options); - } - - /** @test */ - public function attachNetworkEndpointsTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/attachNetworkEndpointsTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/attachNetworkEndpointsTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $globalNetworkEndpointGroupsAttachEndpointsRequestResource = new GlobalNetworkEndpointGroupsAttachEndpointsRequest(); - $networkEndpointGroup = 'networkEndpointGroup-639834746'; - $project = 'project-309310695'; - $response = $gapicClient->attachNetworkEndpoints($globalNetworkEndpointGroupsAttachEndpointsRequestResource, $networkEndpointGroup, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.GlobalNetworkEndpointGroups/AttachNetworkEndpoints', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getGlobalNetworkEndpointGroupsAttachEndpointsRequestResource(); - $this->assertProtobufEquals($globalNetworkEndpointGroupsAttachEndpointsRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getNetworkEndpointGroup(); - $this->assertProtobufEquals($networkEndpointGroup, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function attachNetworkEndpointsExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/attachNetworkEndpointsExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $globalNetworkEndpointGroupsAttachEndpointsRequestResource = new GlobalNetworkEndpointGroupsAttachEndpointsRequest(); - $networkEndpointGroup = 'networkEndpointGroup-639834746'; - $project = 'project-309310695'; - $response = $gapicClient->attachNetworkEndpoints($globalNetworkEndpointGroupsAttachEndpointsRequestResource, $networkEndpointGroup, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $networkEndpointGroup = 'networkEndpointGroup-639834746'; - $project = 'project-309310695'; - $response = $gapicClient->delete($networkEndpointGroup, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.GlobalNetworkEndpointGroups/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getNetworkEndpointGroup(); - $this->assertProtobufEquals($networkEndpointGroup, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $networkEndpointGroup = 'networkEndpointGroup-639834746'; - $project = 'project-309310695'; - $response = $gapicClient->delete($networkEndpointGroup, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 detachNetworkEndpointsTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/detachNetworkEndpointsTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/detachNetworkEndpointsTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $globalNetworkEndpointGroupsDetachEndpointsRequestResource = new GlobalNetworkEndpointGroupsDetachEndpointsRequest(); - $networkEndpointGroup = 'networkEndpointGroup-639834746'; - $project = 'project-309310695'; - $response = $gapicClient->detachNetworkEndpoints($globalNetworkEndpointGroupsDetachEndpointsRequestResource, $networkEndpointGroup, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.GlobalNetworkEndpointGroups/DetachNetworkEndpoints', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getGlobalNetworkEndpointGroupsDetachEndpointsRequestResource(); - $this->assertProtobufEquals($globalNetworkEndpointGroupsDetachEndpointsRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getNetworkEndpointGroup(); - $this->assertProtobufEquals($networkEndpointGroup, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function detachNetworkEndpointsExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/detachNetworkEndpointsExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $globalNetworkEndpointGroupsDetachEndpointsRequestResource = new GlobalNetworkEndpointGroupsDetachEndpointsRequest(); - $networkEndpointGroup = 'networkEndpointGroup-639834746'; - $project = 'project-309310695'; - $response = $gapicClient->detachNetworkEndpoints($globalNetworkEndpointGroupsDetachEndpointsRequestResource, $networkEndpointGroup, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $creationTimestamp = 'creationTimestamp567396278'; - $defaultPort = 650363969; - $description = 'description-1724546052'; - $id = 3355; - $kind = 'kind3292052'; - $name = 'name3373707'; - $network = 'network1843485230'; - $networkEndpointType = 'networkEndpointType118301523'; - $pscTargetService = 'pscTargetService1879744870'; - $region = 'region-934795532'; - $selfLink = 'selfLink-1691268851'; - $size = 3530753; - $subnetwork = 'subnetwork-1302785042'; - $zone = 'zone3744684'; - $expectedResponse = new NetworkEndpointGroup(); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDefaultPort($defaultPort); - $expectedResponse->setDescription($description); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setName($name); - $expectedResponse->setNetwork($network); - $expectedResponse->setNetworkEndpointType($networkEndpointType); - $expectedResponse->setPscTargetService($pscTargetService); - $expectedResponse->setRegion($region); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setSize($size); - $expectedResponse->setSubnetwork($subnetwork); - $expectedResponse->setZone($zone); - $transport->addResponse($expectedResponse); - // Mock request - $networkEndpointGroup = 'networkEndpointGroup-639834746'; - $project = 'project-309310695'; - $response = $gapicClient->get($networkEndpointGroup, $project); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.GlobalNetworkEndpointGroups/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getNetworkEndpointGroup(); - $this->assertProtobufEquals($networkEndpointGroup, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $networkEndpointGroup = 'networkEndpointGroup-639834746'; - $project = 'project-309310695'; - try { - $gapicClient->get($networkEndpointGroup, $project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $networkEndpointGroupResource = new NetworkEndpointGroup(); - $project = 'project-309310695'; - $response = $gapicClient->insert($networkEndpointGroupResource, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.GlobalNetworkEndpointGroups/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getNetworkEndpointGroupResource(); - $this->assertProtobufEquals($networkEndpointGroupResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $networkEndpointGroupResource = new NetworkEndpointGroup(); - $project = 'project-309310695'; - $response = $gapicClient->insert($networkEndpointGroupResource, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new NetworkEndpointGroup(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new NetworkEndpointGroupList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->list($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.GlobalNetworkEndpointGroups/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->list($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listNetworkEndpointsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $itemsElement = new NetworkEndpointWithHealthStatus(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new NetworkEndpointGroupsListNetworkEndpoints(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $networkEndpointGroup = 'networkEndpointGroup-639834746'; - $project = 'project-309310695'; - $response = $gapicClient->listNetworkEndpoints($networkEndpointGroup, $project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.GlobalNetworkEndpointGroups/ListNetworkEndpoints', $actualFuncCall); - $actualValue = $actualRequestObject->getNetworkEndpointGroup(); - $this->assertProtobufEquals($networkEndpointGroup, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listNetworkEndpointsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $networkEndpointGroup = 'networkEndpointGroup-639834746'; - $project = 'project-309310695'; - try { - $gapicClient->listNetworkEndpoints($networkEndpointGroup, $project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->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/Compute/tests/Unit/V1/GlobalOperationsClientTest.php b/Compute/tests/Unit/V1/GlobalOperationsClientTest.php deleted file mode 100644 index 2cf0bc91d144..000000000000 --- a/Compute/tests/Unit/V1/GlobalOperationsClientTest.php +++ /dev/null @@ -1,484 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return GlobalOperationsClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new GlobalOperationsClient($options); - } - - /** @test */ - public function aggregatedListTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $items = [ - 'itemsKey' => new OperationsScopedList(), - ]; - $expectedResponse = new OperationAggregatedList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->aggregatedList($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertArrayHasKey('itemsKey', $expectedResponse->getItems()); - $this->assertArrayHasKey('itemsKey', $resources); - $this->assertEquals($expectedResponse->getItems()['itemsKey'], $resources['itemsKey']); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.GlobalOperations/AggregatedList', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function aggregatedListExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->aggregatedList($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new DeleteGlobalOperationResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $operation = 'operation1662702951'; - $project = 'project-309310695'; - $response = $gapicClient->delete($operation, $project); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.GlobalOperations/Delete', $actualFuncCall); - $actualValue = $actualRequestObject->getOperation(); - $this->assertProtobufEquals($operation, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $operation = 'operation1662702951'; - $project = 'project-309310695'; - try { - $gapicClient->delete($operation, $project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $clientOperationId = 'clientOperationId-239630617'; - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $endTime = 'endTime1725551537'; - $httpErrorMessage = 'httpErrorMessage1276263769'; - $httpErrorStatusCode = 1386087020; - $id = 3355; - $insertTime = 'insertTime-103148397'; - $kind = 'kind3292052'; - $name = 'name3373707'; - $operationGroupId = 'operationGroupId40171187'; - $operationType = 'operationType-1432962286'; - $progress = 1001078227; - $region = 'region-934795532'; - $selfLink = 'selfLink-1691268851'; - $startTime = 'startTime-1573145462'; - $statusMessage = 'statusMessage-239442758'; - $targetId = 815576439; - $targetLink = 'targetLink-2084812312'; - $user = 'user3599307'; - $zone = 'zone3744684'; - $expectedResponse = new Operation(); - $expectedResponse->setClientOperationId($clientOperationId); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setEndTime($endTime); - $expectedResponse->setHttpErrorMessage($httpErrorMessage); - $expectedResponse->setHttpErrorStatusCode($httpErrorStatusCode); - $expectedResponse->setId($id); - $expectedResponse->setInsertTime($insertTime); - $expectedResponse->setKind($kind); - $expectedResponse->setName($name); - $expectedResponse->setOperationGroupId($operationGroupId); - $expectedResponse->setOperationType($operationType); - $expectedResponse->setProgress($progress); - $expectedResponse->setRegion($region); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setStartTime($startTime); - $expectedResponse->setStatusMessage($statusMessage); - $expectedResponse->setTargetId($targetId); - $expectedResponse->setTargetLink($targetLink); - $expectedResponse->setUser($user); - $expectedResponse->setZone($zone); - $transport->addResponse($expectedResponse); - // Mock request - $operation = 'operation1662702951'; - $project = 'project-309310695'; - $response = $gapicClient->get($operation, $project); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.GlobalOperations/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getOperation(); - $this->assertProtobufEquals($operation, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $operation = 'operation1662702951'; - $project = 'project-309310695'; - try { - $gapicClient->get($operation, $project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new Operation(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new OperationList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->list($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.GlobalOperations/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->list($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function waitTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $clientOperationId = 'clientOperationId-239630617'; - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $endTime = 'endTime1725551537'; - $httpErrorMessage = 'httpErrorMessage1276263769'; - $httpErrorStatusCode = 1386087020; - $id = 3355; - $insertTime = 'insertTime-103148397'; - $kind = 'kind3292052'; - $name = 'name3373707'; - $operationGroupId = 'operationGroupId40171187'; - $operationType = 'operationType-1432962286'; - $progress = 1001078227; - $region = 'region-934795532'; - $selfLink = 'selfLink-1691268851'; - $startTime = 'startTime-1573145462'; - $statusMessage = 'statusMessage-239442758'; - $targetId = 815576439; - $targetLink = 'targetLink-2084812312'; - $user = 'user3599307'; - $zone = 'zone3744684'; - $expectedResponse = new Operation(); - $expectedResponse->setClientOperationId($clientOperationId); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setEndTime($endTime); - $expectedResponse->setHttpErrorMessage($httpErrorMessage); - $expectedResponse->setHttpErrorStatusCode($httpErrorStatusCode); - $expectedResponse->setId($id); - $expectedResponse->setInsertTime($insertTime); - $expectedResponse->setKind($kind); - $expectedResponse->setName($name); - $expectedResponse->setOperationGroupId($operationGroupId); - $expectedResponse->setOperationType($operationType); - $expectedResponse->setProgress($progress); - $expectedResponse->setRegion($region); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setStartTime($startTime); - $expectedResponse->setStatusMessage($statusMessage); - $expectedResponse->setTargetId($targetId); - $expectedResponse->setTargetLink($targetLink); - $expectedResponse->setUser($user); - $expectedResponse->setZone($zone); - $transport->addResponse($expectedResponse); - // Mock request - $operation = 'operation1662702951'; - $project = 'project-309310695'; - $response = $gapicClient->wait($operation, $project); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.GlobalOperations/Wait', $actualFuncCall); - $actualValue = $actualRequestObject->getOperation(); - $this->assertProtobufEquals($operation, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function waitExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $operation = 'operation1662702951'; - $project = 'project-309310695'; - try { - $gapicClient->wait($operation, $project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->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/Compute/tests/Unit/V1/GlobalOrganizationOperationsClientTest.php b/Compute/tests/Unit/V1/GlobalOrganizationOperationsClientTest.php deleted file mode 100644 index b9e43666fcf4..000000000000 --- a/Compute/tests/Unit/V1/GlobalOrganizationOperationsClientTest.php +++ /dev/null @@ -1,289 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return GlobalOrganizationOperationsClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new GlobalOrganizationOperationsClient($options); - } - - /** @test */ - public function deleteTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new DeleteGlobalOrganizationOperationResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $operation = 'operation1662702951'; - $response = $gapicClient->delete($operation); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.GlobalOrganizationOperations/Delete', $actualFuncCall); - $actualValue = $actualRequestObject->getOperation(); - $this->assertProtobufEquals($operation, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $operation = 'operation1662702951'; - try { - $gapicClient->delete($operation); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $clientOperationId = 'clientOperationId-239630617'; - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $endTime = 'endTime1725551537'; - $httpErrorMessage = 'httpErrorMessage1276263769'; - $httpErrorStatusCode = 1386087020; - $id = 3355; - $insertTime = 'insertTime-103148397'; - $kind = 'kind3292052'; - $name = 'name3373707'; - $operationGroupId = 'operationGroupId40171187'; - $operationType = 'operationType-1432962286'; - $progress = 1001078227; - $region = 'region-934795532'; - $selfLink = 'selfLink-1691268851'; - $startTime = 'startTime-1573145462'; - $statusMessage = 'statusMessage-239442758'; - $targetId = 815576439; - $targetLink = 'targetLink-2084812312'; - $user = 'user3599307'; - $zone = 'zone3744684'; - $expectedResponse = new Operation(); - $expectedResponse->setClientOperationId($clientOperationId); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setEndTime($endTime); - $expectedResponse->setHttpErrorMessage($httpErrorMessage); - $expectedResponse->setHttpErrorStatusCode($httpErrorStatusCode); - $expectedResponse->setId($id); - $expectedResponse->setInsertTime($insertTime); - $expectedResponse->setKind($kind); - $expectedResponse->setName($name); - $expectedResponse->setOperationGroupId($operationGroupId); - $expectedResponse->setOperationType($operationType); - $expectedResponse->setProgress($progress); - $expectedResponse->setRegion($region); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setStartTime($startTime); - $expectedResponse->setStatusMessage($statusMessage); - $expectedResponse->setTargetId($targetId); - $expectedResponse->setTargetLink($targetLink); - $expectedResponse->setUser($user); - $expectedResponse->setZone($zone); - $transport->addResponse($expectedResponse); - // Mock request - $operation = 'operation1662702951'; - $response = $gapicClient->get($operation); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.GlobalOrganizationOperations/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getOperation(); - $this->assertProtobufEquals($operation, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $operation = 'operation1662702951'; - try { - $gapicClient->get($operation); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new Operation(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new OperationList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - $response = $gapicClient->list(); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.GlobalOrganizationOperations/List', $actualFuncCall); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->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->list(); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->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/Compute/tests/Unit/V1/GlobalPublicDelegatedPrefixesClientTest.php b/Compute/tests/Unit/V1/GlobalPublicDelegatedPrefixesClientTest.php deleted file mode 100644 index 94ab1c2b4ba4..000000000000 --- a/Compute/tests/Unit/V1/GlobalPublicDelegatedPrefixesClientTest.php +++ /dev/null @@ -1,578 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return GlobalPublicDelegatedPrefixesClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new GlobalPublicDelegatedPrefixesClient($options); - } - - /** @test */ - public function deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $publicDelegatedPrefix = 'publicDelegatedPrefix1814851176'; - $response = $gapicClient->delete($project, $publicDelegatedPrefix); - $this->assertFalse($response->isDone()); - $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.compute.v1.GlobalPublicDelegatedPrefixes/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getPublicDelegatedPrefix(); - $this->assertProtobufEquals($publicDelegatedPrefix, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $publicDelegatedPrefix = 'publicDelegatedPrefix1814851176'; - $response = $gapicClient->delete($project, $publicDelegatedPrefix); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $allocatablePrefixLength = 1649040182; - $byoipApiVersion = 'byoipApiVersion162683283'; - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $fingerprint = 'fingerprint-1375934236'; - $id = 3355; - $ipCidrRange = 'ipCidrRange-2049366326'; - $isLiveMigration = true; - $kind = 'kind3292052'; - $mode = 'mode3357091'; - $name = 'name3373707'; - $parentPrefix = 'parentPrefix552104903'; - $region = 'region-934795532'; - $selfLink = 'selfLink-1691268851'; - $status = 'status-892481550'; - $expectedResponse = new PublicDelegatedPrefix(); - $expectedResponse->setAllocatablePrefixLength($allocatablePrefixLength); - $expectedResponse->setByoipApiVersion($byoipApiVersion); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setFingerprint($fingerprint); - $expectedResponse->setId($id); - $expectedResponse->setIpCidrRange($ipCidrRange); - $expectedResponse->setIsLiveMigration($isLiveMigration); - $expectedResponse->setKind($kind); - $expectedResponse->setMode($mode); - $expectedResponse->setName($name); - $expectedResponse->setParentPrefix($parentPrefix); - $expectedResponse->setRegion($region); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setStatus($status); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $publicDelegatedPrefix = 'publicDelegatedPrefix1814851176'; - $response = $gapicClient->get($project, $publicDelegatedPrefix); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.GlobalPublicDelegatedPrefixes/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getPublicDelegatedPrefix(); - $this->assertProtobufEquals($publicDelegatedPrefix, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $publicDelegatedPrefix = 'publicDelegatedPrefix1814851176'; - try { - $gapicClient->get($project, $publicDelegatedPrefix); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $publicDelegatedPrefixResource = new PublicDelegatedPrefix(); - $response = $gapicClient->insert($project, $publicDelegatedPrefixResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.GlobalPublicDelegatedPrefixes/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getPublicDelegatedPrefixResource(); - $this->assertProtobufEquals($publicDelegatedPrefixResource, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $publicDelegatedPrefixResource = new PublicDelegatedPrefix(); - $response = $gapicClient->insert($project, $publicDelegatedPrefixResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new PublicDelegatedPrefix(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new PublicDelegatedPrefixList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->list($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.GlobalPublicDelegatedPrefixes/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->list($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function patchTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/patchTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $publicDelegatedPrefix = 'publicDelegatedPrefix1814851176'; - $publicDelegatedPrefixResource = new PublicDelegatedPrefix(); - $response = $gapicClient->patch($project, $publicDelegatedPrefix, $publicDelegatedPrefixResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.GlobalPublicDelegatedPrefixes/Patch', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getPublicDelegatedPrefix(); - $this->assertProtobufEquals($publicDelegatedPrefix, $actualValue); - $actualValue = $actualApiRequestObject->getPublicDelegatedPrefixResource(); - $this->assertProtobufEquals($publicDelegatedPrefixResource, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function patchExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $publicDelegatedPrefix = 'publicDelegatedPrefix1814851176'; - $publicDelegatedPrefixResource = new PublicDelegatedPrefix(); - $response = $gapicClient->patch($project, $publicDelegatedPrefix, $publicDelegatedPrefixResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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/Compute/tests/Unit/V1/HealthChecksClientTest.php b/Compute/tests/Unit/V1/HealthChecksClientTest.php deleted file mode 100644 index a761101307f8..000000000000 --- a/Compute/tests/Unit/V1/HealthChecksClientTest.php +++ /dev/null @@ -1,767 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return HealthChecksClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new HealthChecksClient($options); - } - - /** @test */ - public function aggregatedListTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $items = [ - 'itemsKey' => new HealthChecksScopedList(), - ]; - $expectedResponse = new HealthChecksAggregatedList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->aggregatedList($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertArrayHasKey('itemsKey', $expectedResponse->getItems()); - $this->assertArrayHasKey('itemsKey', $resources); - $this->assertEquals($expectedResponse->getItems()['itemsKey'], $resources['itemsKey']); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.HealthChecks/AggregatedList', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function aggregatedListExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->aggregatedList($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $healthCheck = 'healthCheck845747557'; - $project = 'project-309310695'; - $response = $gapicClient->delete($healthCheck, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.HealthChecks/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getHealthCheck(); - $this->assertProtobufEquals($healthCheck, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $healthCheck = 'healthCheck845747557'; - $project = 'project-309310695'; - $response = $gapicClient->delete($healthCheck, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $checkIntervalSec = 345561006; - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $healthyThreshold = 133658551; - $id = 3355; - $kind = 'kind3292052'; - $name = 'name3373707'; - $region = 'region-934795532'; - $selfLink = 'selfLink-1691268851'; - $timeoutSec = 2067488653; - $type = 'type3575610'; - $unhealthyThreshold = 1838571216; - $expectedResponse = new HealthCheck(); - $expectedResponse->setCheckIntervalSec($checkIntervalSec); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setHealthyThreshold($healthyThreshold); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setName($name); - $expectedResponse->setRegion($region); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setTimeoutSec($timeoutSec); - $expectedResponse->setType($type); - $expectedResponse->setUnhealthyThreshold($unhealthyThreshold); - $transport->addResponse($expectedResponse); - // Mock request - $healthCheck = 'healthCheck845747557'; - $project = 'project-309310695'; - $response = $gapicClient->get($healthCheck, $project); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.HealthChecks/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getHealthCheck(); - $this->assertProtobufEquals($healthCheck, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $healthCheck = 'healthCheck845747557'; - $project = 'project-309310695'; - try { - $gapicClient->get($healthCheck, $project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $healthCheckResource = new HealthCheck(); - $project = 'project-309310695'; - $response = $gapicClient->insert($healthCheckResource, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.HealthChecks/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getHealthCheckResource(); - $this->assertProtobufEquals($healthCheckResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $healthCheckResource = new HealthCheck(); - $project = 'project-309310695'; - $response = $gapicClient->insert($healthCheckResource, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new HealthCheck(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new HealthCheckList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->list($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.HealthChecks/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->list($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function patchTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/patchTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $healthCheck = 'healthCheck845747557'; - $healthCheckResource = new HealthCheck(); - $project = 'project-309310695'; - $response = $gapicClient->patch($healthCheck, $healthCheckResource, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.HealthChecks/Patch', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getHealthCheck(); - $this->assertProtobufEquals($healthCheck, $actualValue); - $actualValue = $actualApiRequestObject->getHealthCheckResource(); - $this->assertProtobufEquals($healthCheckResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function patchExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $healthCheck = 'healthCheck845747557'; - $healthCheckResource = new HealthCheck(); - $project = 'project-309310695'; - $response = $gapicClient->patch($healthCheck, $healthCheckResource, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 updateTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/updateTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/updateTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $healthCheck = 'healthCheck845747557'; - $healthCheckResource = new HealthCheck(); - $project = 'project-309310695'; - $response = $gapicClient->update($healthCheck, $healthCheckResource, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.HealthChecks/Update', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getHealthCheck(); - $this->assertProtobufEquals($healthCheck, $actualValue); - $actualValue = $actualApiRequestObject->getHealthCheckResource(); - $this->assertProtobufEquals($healthCheckResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function updateExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/updateExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $healthCheck = 'healthCheck845747557'; - $healthCheckResource = new HealthCheck(); - $project = 'project-309310695'; - $response = $gapicClient->update($healthCheck, $healthCheckResource, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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/Compute/tests/Unit/V1/ImageFamilyViewsClientTest.php b/Compute/tests/Unit/V1/ImageFamilyViewsClientTest.php deleted file mode 100644 index d0141ee5e950..000000000000 --- a/Compute/tests/Unit/V1/ImageFamilyViewsClientTest.php +++ /dev/null @@ -1,127 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return ImageFamilyViewsClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new ImageFamilyViewsClient($options); - } - - /** @test */ - public function getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new ImageFamilyView(); - $transport->addResponse($expectedResponse); - // Mock request - $family = 'family-1281860764'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->get($family, $project, $zone); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.ImageFamilyViews/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getFamily(); - $this->assertProtobufEquals($family, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $family = 'family-1281860764'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - try { - $gapicClient->get($family, $project, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->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/Compute/tests/Unit/V1/ImagesClientTest.php b/Compute/tests/Unit/V1/ImagesClientTest.php deleted file mode 100644 index dd06158861c6..000000000000 --- a/Compute/tests/Unit/V1/ImagesClientTest.php +++ /dev/null @@ -1,1146 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return ImagesClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new ImagesClient($options); - } - - /** @test */ - public function deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $image = 'image100313435'; - $project = 'project-309310695'; - $response = $gapicClient->delete($image, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.Images/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getImage(); - $this->assertProtobufEquals($image, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $image = 'image100313435'; - $project = 'project-309310695'; - $response = $gapicClient->delete($image, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 deprecateTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deprecateTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deprecateTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $deprecationStatusResource = new DeprecationStatus(); - $image = 'image100313435'; - $project = 'project-309310695'; - $response = $gapicClient->deprecate($deprecationStatusResource, $image, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.Images/Deprecate', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getDeprecationStatusResource(); - $this->assertProtobufEquals($deprecationStatusResource, $actualValue); - $actualValue = $actualApiRequestObject->getImage(); - $this->assertProtobufEquals($image, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deprecateExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deprecateExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $deprecationStatusResource = new DeprecationStatus(); - $image = 'image100313435'; - $project = 'project-309310695'; - $response = $gapicClient->deprecate($deprecationStatusResource, $image, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $architecture = 'architecture839674195'; - $archiveSizeBytes = 1766390198; - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $diskSizeGb = 757478089; - $enableConfidentialCompute = true; - $family = 'family-1281860764'; - $id = 3355; - $kind = 'kind3292052'; - $labelFingerprint = 'labelFingerprint714995737'; - $name = 'name3373707'; - $satisfiesPzi = false; - $satisfiesPzs = false; - $selfLink = 'selfLink-1691268851'; - $sourceDisk = 'sourceDisk-85117119'; - $sourceDiskId = 'sourceDiskId-1693292839'; - $sourceImage = 'sourceImage1661056055'; - $sourceImageId = 'sourceImageId-2092155357'; - $sourceSnapshot = 'sourceSnapshot-947679896'; - $sourceSnapshotId = 'sourceSnapshotId-1511650478'; - $sourceType = 'sourceType-84625186'; - $status = 'status-892481550'; - $expectedResponse = new Image(); - $expectedResponse->setArchitecture($architecture); - $expectedResponse->setArchiveSizeBytes($archiveSizeBytes); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setDiskSizeGb($diskSizeGb); - $expectedResponse->setEnableConfidentialCompute($enableConfidentialCompute); - $expectedResponse->setFamily($family); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setLabelFingerprint($labelFingerprint); - $expectedResponse->setName($name); - $expectedResponse->setSatisfiesPzi($satisfiesPzi); - $expectedResponse->setSatisfiesPzs($satisfiesPzs); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setSourceDisk($sourceDisk); - $expectedResponse->setSourceDiskId($sourceDiskId); - $expectedResponse->setSourceImage($sourceImage); - $expectedResponse->setSourceImageId($sourceImageId); - $expectedResponse->setSourceSnapshot($sourceSnapshot); - $expectedResponse->setSourceSnapshotId($sourceSnapshotId); - $expectedResponse->setSourceType($sourceType); - $expectedResponse->setStatus($status); - $transport->addResponse($expectedResponse); - // Mock request - $image = 'image100313435'; - $project = 'project-309310695'; - $response = $gapicClient->get($image, $project); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Images/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getImage(); - $this->assertProtobufEquals($image, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $image = 'image100313435'; - $project = 'project-309310695'; - try { - $gapicClient->get($image, $project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getFromFamilyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $architecture = 'architecture839674195'; - $archiveSizeBytes = 1766390198; - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $diskSizeGb = 757478089; - $enableConfidentialCompute = true; - $family2 = 'family2787422743'; - $id = 3355; - $kind = 'kind3292052'; - $labelFingerprint = 'labelFingerprint714995737'; - $name = 'name3373707'; - $satisfiesPzi = false; - $satisfiesPzs = false; - $selfLink = 'selfLink-1691268851'; - $sourceDisk = 'sourceDisk-85117119'; - $sourceDiskId = 'sourceDiskId-1693292839'; - $sourceImage = 'sourceImage1661056055'; - $sourceImageId = 'sourceImageId-2092155357'; - $sourceSnapshot = 'sourceSnapshot-947679896'; - $sourceSnapshotId = 'sourceSnapshotId-1511650478'; - $sourceType = 'sourceType-84625186'; - $status = 'status-892481550'; - $expectedResponse = new Image(); - $expectedResponse->setArchitecture($architecture); - $expectedResponse->setArchiveSizeBytes($archiveSizeBytes); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setDiskSizeGb($diskSizeGb); - $expectedResponse->setEnableConfidentialCompute($enableConfidentialCompute); - $expectedResponse->setFamily($family2); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setLabelFingerprint($labelFingerprint); - $expectedResponse->setName($name); - $expectedResponse->setSatisfiesPzi($satisfiesPzi); - $expectedResponse->setSatisfiesPzs($satisfiesPzs); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setSourceDisk($sourceDisk); - $expectedResponse->setSourceDiskId($sourceDiskId); - $expectedResponse->setSourceImage($sourceImage); - $expectedResponse->setSourceImageId($sourceImageId); - $expectedResponse->setSourceSnapshot($sourceSnapshot); - $expectedResponse->setSourceSnapshotId($sourceSnapshotId); - $expectedResponse->setSourceType($sourceType); - $expectedResponse->setStatus($status); - $transport->addResponse($expectedResponse); - // Mock request - $family = 'family-1281860764'; - $project = 'project-309310695'; - $response = $gapicClient->getFromFamily($family, $project); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Images/GetFromFamily', $actualFuncCall); - $actualValue = $actualRequestObject->getFamily(); - $this->assertProtobufEquals($family, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getFromFamilyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $family = 'family-1281860764'; - $project = 'project-309310695'; - try { - $gapicClient->getFromFamily($family, $project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $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 - $etag = 'etag3123477'; - $iamOwned = false; - $version = 351608024; - $expectedResponse = new Policy(); - $expectedResponse->setEtag($etag); - $expectedResponse->setIamOwned($iamOwned); - $expectedResponse->setVersion($version); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $response = $gapicClient->getIamPolicy($project, $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.compute.v1.Images/GetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $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 - $project = 'project-309310695'; - $resource = 'resource-341064690'; - try { - $gapicClient->getIamPolicy($project, $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 insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $imageResource = new Image(); - $project = 'project-309310695'; - $response = $gapicClient->insert($imageResource, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.Images/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getImageResource(); - $this->assertProtobufEquals($imageResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $imageResource = new Image(); - $project = 'project-309310695'; - $response = $gapicClient->insert($imageResource, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new Image(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new ImageList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->list($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Images/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->list($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function patchTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/patchTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $image = 'image100313435'; - $imageResource = new Image(); - $project = 'project-309310695'; - $response = $gapicClient->patch($image, $imageResource, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.Images/Patch', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getImage(); - $this->assertProtobufEquals($image, $actualValue); - $actualValue = $actualApiRequestObject->getImageResource(); - $this->assertProtobufEquals($imageResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function patchExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $image = 'image100313435'; - $imageResource = new Image(); - $project = 'project-309310695'; - $response = $gapicClient->patch($image, $imageResource, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 - $etag = 'etag3123477'; - $iamOwned = false; - $version = 351608024; - $expectedResponse = new Policy(); - $expectedResponse->setEtag($etag); - $expectedResponse->setIamOwned($iamOwned); - $expectedResponse->setVersion($version); - $transport->addResponse($expectedResponse); - // Mock request - $globalSetPolicyRequestResource = new GlobalSetPolicyRequest(); - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $response = $gapicClient->setIamPolicy($globalSetPolicyRequestResource, $project, $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.compute.v1.Images/SetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getGlobalSetPolicyRequestResource(); - $this->assertProtobufEquals($globalSetPolicyRequestResource, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $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 - $globalSetPolicyRequestResource = new GlobalSetPolicyRequest(); - $project = 'project-309310695'; - $resource = 'resource-341064690'; - try { - $gapicClient->setIamPolicy($globalSetPolicyRequestResource, $project, $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 setLabelsTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setLabelsTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/setLabelsTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $globalSetLabelsRequestResource = new GlobalSetLabelsRequest(); - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $response = $gapicClient->setLabels($globalSetLabelsRequestResource, $project, $resource); - $this->assertFalse($response->isDone()); - $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.compute.v1.Images/SetLabels', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getGlobalSetLabelsRequestResource(); - $this->assertProtobufEquals($globalSetLabelsRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setLabelsExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setLabelsExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $globalSetLabelsRequestResource = new GlobalSetLabelsRequest(); - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $response = $gapicClient->setLabels($globalSetLabelsRequestResource, $project, $resource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 testIamPermissionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new TestPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $testPermissionsRequestResource = new TestPermissionsRequest(); - $response = $gapicClient->testIamPermissions($project, $resource, $testPermissionsRequestResource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Images/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getTestPermissionsRequestResource(); - $this->assertProtobufEquals($testPermissionsRequestResource, $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 - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $testPermissionsRequestResource = new TestPermissionsRequest(); - try { - $gapicClient->testIamPermissions($project, $resource, $testPermissionsRequestResource); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->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/Compute/tests/Unit/V1/InstanceGroupManagerResizeRequestsClientTest.php b/Compute/tests/Unit/V1/InstanceGroupManagerResizeRequestsClientTest.php deleted file mode 100644 index 11f09c45f2be..000000000000 --- a/Compute/tests/Unit/V1/InstanceGroupManagerResizeRequestsClientTest.php +++ /dev/null @@ -1,607 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return InstanceGroupManagerResizeRequestsClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new InstanceGroupManagerResizeRequestsClient($options); - } - - /** @test */ - public function cancelTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/cancelTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/cancelTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $project = 'project-309310695'; - $resizeRequest = 'resizeRequest-319929852'; - $zone = 'zone3744684'; - $response = $gapicClient->cancel($instanceGroupManager, $project, $resizeRequest, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.InstanceGroupManagerResizeRequests/Cancel', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstanceGroupManager(); - $this->assertProtobufEquals($instanceGroupManager, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getResizeRequest(); - $this->assertProtobufEquals($resizeRequest, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function cancelExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/cancelExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $project = 'project-309310695'; - $resizeRequest = 'resizeRequest-319929852'; - $zone = 'zone3744684'; - $response = $gapicClient->cancel($instanceGroupManager, $project, $resizeRequest, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $project = 'project-309310695'; - $resizeRequest = 'resizeRequest-319929852'; - $zone = 'zone3744684'; - $response = $gapicClient->delete($instanceGroupManager, $project, $resizeRequest, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.InstanceGroupManagerResizeRequests/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstanceGroupManager(); - $this->assertProtobufEquals($instanceGroupManager, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getResizeRequest(); - $this->assertProtobufEquals($resizeRequest, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $project = 'project-309310695'; - $resizeRequest = 'resizeRequest-319929852'; - $zone = 'zone3744684'; - $response = $gapicClient->delete($instanceGroupManager, $project, $resizeRequest, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $id = 3355; - $kind = 'kind3292052'; - $name = 'name3373707'; - $resizeBy = 2144348098; - $selfLink = 'selfLink-1691268851'; - $selfLinkWithId = 'selfLinkWithId-1029220862'; - $state = 'state109757585'; - $zone2 = 'zone2-696322977'; - $expectedResponse = new InstanceGroupManagerResizeRequest(); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setName($name); - $expectedResponse->setResizeBy($resizeBy); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setSelfLinkWithId($selfLinkWithId); - $expectedResponse->setState($state); - $expectedResponse->setZone($zone2); - $transport->addResponse($expectedResponse); - // Mock request - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $project = 'project-309310695'; - $resizeRequest = 'resizeRequest-319929852'; - $zone = 'zone3744684'; - $response = $gapicClient->get($instanceGroupManager, $project, $resizeRequest, $zone); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.InstanceGroupManagerResizeRequests/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getInstanceGroupManager(); - $this->assertProtobufEquals($instanceGroupManager, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getResizeRequest(); - $this->assertProtobufEquals($resizeRequest, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $project = 'project-309310695'; - $resizeRequest = 'resizeRequest-319929852'; - $zone = 'zone3744684'; - try { - $gapicClient->get($instanceGroupManager, $project, $resizeRequest, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $instanceGroupManagerResizeRequestResource = new InstanceGroupManagerResizeRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->insert($instanceGroupManager, $instanceGroupManagerResizeRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.InstanceGroupManagerResizeRequests/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstanceGroupManager(); - $this->assertProtobufEquals($instanceGroupManager, $actualValue); - $actualValue = $actualApiRequestObject->getInstanceGroupManagerResizeRequestResource(); - $this->assertProtobufEquals($instanceGroupManagerResizeRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $instanceGroupManagerResizeRequestResource = new InstanceGroupManagerResizeRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->insert($instanceGroupManager, $instanceGroupManagerResizeRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new InstanceGroupManagerResizeRequest(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new InstanceGroupManagerResizeRequestsListResponse(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->list($instanceGroupManager, $project, $zone); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.InstanceGroupManagerResizeRequests/List', $actualFuncCall); - $actualValue = $actualRequestObject->getInstanceGroupManager(); - $this->assertProtobufEquals($instanceGroupManager, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - try { - $gapicClient->list($instanceGroupManager, $project, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->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/Compute/tests/Unit/V1/InstanceGroupManagersClientTest.php b/Compute/tests/Unit/V1/InstanceGroupManagersClientTest.php deleted file mode 100644 index 8bffd8331cd6..000000000000 --- a/Compute/tests/Unit/V1/InstanceGroupManagersClientTest.php +++ /dev/null @@ -1,2777 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return InstanceGroupManagersClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new InstanceGroupManagersClient($options); - } - - /** @test */ - public function abandonInstancesTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/abandonInstancesTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/abandonInstancesTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $instanceGroupManagersAbandonInstancesRequestResource = new InstanceGroupManagersAbandonInstancesRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->abandonInstances($instanceGroupManager, $instanceGroupManagersAbandonInstancesRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.InstanceGroupManagers/AbandonInstances', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstanceGroupManager(); - $this->assertProtobufEquals($instanceGroupManager, $actualValue); - $actualValue = $actualApiRequestObject->getInstanceGroupManagersAbandonInstancesRequestResource(); - $this->assertProtobufEquals($instanceGroupManagersAbandonInstancesRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function abandonInstancesExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/abandonInstancesExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $instanceGroupManagersAbandonInstancesRequestResource = new InstanceGroupManagersAbandonInstancesRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->abandonInstances($instanceGroupManager, $instanceGroupManagersAbandonInstancesRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 aggregatedListTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $items = [ - 'itemsKey' => new InstanceGroupManagersScopedList(), - ]; - $expectedResponse = new InstanceGroupManagerAggregatedList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->aggregatedList($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertArrayHasKey('itemsKey', $expectedResponse->getItems()); - $this->assertArrayHasKey('itemsKey', $resources); - $this->assertEquals($expectedResponse->getItems()['itemsKey'], $resources['itemsKey']); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.InstanceGroupManagers/AggregatedList', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function aggregatedListExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->aggregatedList($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function applyUpdatesToInstancesTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/applyUpdatesToInstancesTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/applyUpdatesToInstancesTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $instanceGroupManagersApplyUpdatesRequestResource = new InstanceGroupManagersApplyUpdatesRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->applyUpdatesToInstances($instanceGroupManager, $instanceGroupManagersApplyUpdatesRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.InstanceGroupManagers/ApplyUpdatesToInstances', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstanceGroupManager(); - $this->assertProtobufEquals($instanceGroupManager, $actualValue); - $actualValue = $actualApiRequestObject->getInstanceGroupManagersApplyUpdatesRequestResource(); - $this->assertProtobufEquals($instanceGroupManagersApplyUpdatesRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function applyUpdatesToInstancesExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/applyUpdatesToInstancesExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $instanceGroupManagersApplyUpdatesRequestResource = new InstanceGroupManagersApplyUpdatesRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->applyUpdatesToInstances($instanceGroupManager, $instanceGroupManagersApplyUpdatesRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 createInstancesTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/createInstancesTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/createInstancesTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $instanceGroupManagersCreateInstancesRequestResource = new InstanceGroupManagersCreateInstancesRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->createInstances($instanceGroupManager, $instanceGroupManagersCreateInstancesRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.InstanceGroupManagers/CreateInstances', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstanceGroupManager(); - $this->assertProtobufEquals($instanceGroupManager, $actualValue); - $actualValue = $actualApiRequestObject->getInstanceGroupManagersCreateInstancesRequestResource(); - $this->assertProtobufEquals($instanceGroupManagersCreateInstancesRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function createInstancesExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/createInstancesExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $instanceGroupManagersCreateInstancesRequestResource = new InstanceGroupManagersCreateInstancesRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->createInstances($instanceGroupManager, $instanceGroupManagersCreateInstancesRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->delete($instanceGroupManager, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.InstanceGroupManagers/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstanceGroupManager(); - $this->assertProtobufEquals($instanceGroupManager, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->delete($instanceGroupManager, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 deleteInstancesTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteInstancesTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteInstancesTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $instanceGroupManagersDeleteInstancesRequestResource = new InstanceGroupManagersDeleteInstancesRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->deleteInstances($instanceGroupManager, $instanceGroupManagersDeleteInstancesRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.InstanceGroupManagers/DeleteInstances', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstanceGroupManager(); - $this->assertProtobufEquals($instanceGroupManager, $actualValue); - $actualValue = $actualApiRequestObject->getInstanceGroupManagersDeleteInstancesRequestResource(); - $this->assertProtobufEquals($instanceGroupManagersDeleteInstancesRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteInstancesExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteInstancesExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $instanceGroupManagersDeleteInstancesRequestResource = new InstanceGroupManagersDeleteInstancesRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->deleteInstances($instanceGroupManager, $instanceGroupManagersDeleteInstancesRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 deletePerInstanceConfigsTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deletePerInstanceConfigsTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deletePerInstanceConfigsTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $instanceGroupManagersDeletePerInstanceConfigsReqResource = new InstanceGroupManagersDeletePerInstanceConfigsReq(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->deletePerInstanceConfigs($instanceGroupManager, $instanceGroupManagersDeletePerInstanceConfigsReqResource, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.InstanceGroupManagers/DeletePerInstanceConfigs', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstanceGroupManager(); - $this->assertProtobufEquals($instanceGroupManager, $actualValue); - $actualValue = $actualApiRequestObject->getInstanceGroupManagersDeletePerInstanceConfigsReqResource(); - $this->assertProtobufEquals($instanceGroupManagersDeletePerInstanceConfigsReqResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deletePerInstanceConfigsExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deletePerInstanceConfigsExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $instanceGroupManagersDeletePerInstanceConfigsReqResource = new InstanceGroupManagersDeletePerInstanceConfigsReq(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->deletePerInstanceConfigs($instanceGroupManager, $instanceGroupManagersDeletePerInstanceConfigsReqResource, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $baseInstanceName = 'baseInstanceName389106439'; - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $fingerprint = 'fingerprint-1375934236'; - $id = 3355; - $instanceGroup = 'instanceGroup81095253'; - $instanceTemplate = 'instanceTemplate309248228'; - $kind = 'kind3292052'; - $listManagedInstancesResults = 'listManagedInstancesResults832918068'; - $name = 'name3373707'; - $region = 'region-934795532'; - $satisfiesPzi = false; - $satisfiesPzs = false; - $selfLink = 'selfLink-1691268851'; - $targetSize = 2084603409; - $targetStoppedSize = 1613032225; - $targetSuspendedSize = 765655981; - $zone2 = 'zone2-696322977'; - $expectedResponse = new InstanceGroupManager(); - $expectedResponse->setBaseInstanceName($baseInstanceName); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setFingerprint($fingerprint); - $expectedResponse->setId($id); - $expectedResponse->setInstanceGroup($instanceGroup); - $expectedResponse->setInstanceTemplate($instanceTemplate); - $expectedResponse->setKind($kind); - $expectedResponse->setListManagedInstancesResults($listManagedInstancesResults); - $expectedResponse->setName($name); - $expectedResponse->setRegion($region); - $expectedResponse->setSatisfiesPzi($satisfiesPzi); - $expectedResponse->setSatisfiesPzs($satisfiesPzs); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setTargetSize($targetSize); - $expectedResponse->setTargetStoppedSize($targetStoppedSize); - $expectedResponse->setTargetSuspendedSize($targetSuspendedSize); - $expectedResponse->setZone($zone2); - $transport->addResponse($expectedResponse); - // Mock request - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->get($instanceGroupManager, $project, $zone); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.InstanceGroupManagers/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getInstanceGroupManager(); - $this->assertProtobufEquals($instanceGroupManager, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - try { - $gapicClient->get($instanceGroupManager, $project, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instanceGroupManagerResource = new InstanceGroupManager(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->insert($instanceGroupManagerResource, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.InstanceGroupManagers/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstanceGroupManagerResource(); - $this->assertProtobufEquals($instanceGroupManagerResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instanceGroupManagerResource = new InstanceGroupManager(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->insert($instanceGroupManagerResource, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new InstanceGroupManager(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new InstanceGroupManagerList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->list($project, $zone); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.InstanceGroupManagers/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $zone = 'zone3744684'; - try { - $gapicClient->list($project, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listErrorsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $itemsElement = new InstanceManagedByIgmError(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new InstanceGroupManagersListErrorsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->listErrors($instanceGroupManager, $project, $zone); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.InstanceGroupManagers/ListErrors', $actualFuncCall); - $actualValue = $actualRequestObject->getInstanceGroupManager(); - $this->assertProtobufEquals($instanceGroupManager, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listErrorsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - try { - $gapicClient->listErrors($instanceGroupManager, $project, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listManagedInstancesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $managedInstancesElement = new ManagedInstance(); - $managedInstances = [ - $managedInstancesElement, - ]; - $expectedResponse = new InstanceGroupManagersListManagedInstancesResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setManagedInstances($managedInstances); - $transport->addResponse($expectedResponse); - // Mock request - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->listManagedInstances($instanceGroupManager, $project, $zone); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getManagedInstances()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.InstanceGroupManagers/ListManagedInstances', $actualFuncCall); - $actualValue = $actualRequestObject->getInstanceGroupManager(); - $this->assertProtobufEquals($instanceGroupManager, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listManagedInstancesExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - try { - $gapicClient->listManagedInstances($instanceGroupManager, $project, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listPerInstanceConfigsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $itemsElement = new PerInstanceConfig(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new InstanceGroupManagersListPerInstanceConfigsResp(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->listPerInstanceConfigs($instanceGroupManager, $project, $zone); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.InstanceGroupManagers/ListPerInstanceConfigs', $actualFuncCall); - $actualValue = $actualRequestObject->getInstanceGroupManager(); - $this->assertProtobufEquals($instanceGroupManager, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listPerInstanceConfigsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - try { - $gapicClient->listPerInstanceConfigs($instanceGroupManager, $project, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function patchTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/patchTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $instanceGroupManagerResource = new InstanceGroupManager(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->patch($instanceGroupManager, $instanceGroupManagerResource, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.InstanceGroupManagers/Patch', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstanceGroupManager(); - $this->assertProtobufEquals($instanceGroupManager, $actualValue); - $actualValue = $actualApiRequestObject->getInstanceGroupManagerResource(); - $this->assertProtobufEquals($instanceGroupManagerResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function patchExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $instanceGroupManagerResource = new InstanceGroupManager(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->patch($instanceGroupManager, $instanceGroupManagerResource, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 patchPerInstanceConfigsTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchPerInstanceConfigsTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/patchPerInstanceConfigsTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $instanceGroupManagersPatchPerInstanceConfigsReqResource = new InstanceGroupManagersPatchPerInstanceConfigsReq(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->patchPerInstanceConfigs($instanceGroupManager, $instanceGroupManagersPatchPerInstanceConfigsReqResource, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.InstanceGroupManagers/PatchPerInstanceConfigs', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstanceGroupManager(); - $this->assertProtobufEquals($instanceGroupManager, $actualValue); - $actualValue = $actualApiRequestObject->getInstanceGroupManagersPatchPerInstanceConfigsReqResource(); - $this->assertProtobufEquals($instanceGroupManagersPatchPerInstanceConfigsReqResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function patchPerInstanceConfigsExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchPerInstanceConfigsExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $instanceGroupManagersPatchPerInstanceConfigsReqResource = new InstanceGroupManagersPatchPerInstanceConfigsReq(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->patchPerInstanceConfigs($instanceGroupManager, $instanceGroupManagersPatchPerInstanceConfigsReqResource, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 recreateInstancesTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/recreateInstancesTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/recreateInstancesTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $instanceGroupManagersRecreateInstancesRequestResource = new InstanceGroupManagersRecreateInstancesRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->recreateInstances($instanceGroupManager, $instanceGroupManagersRecreateInstancesRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.InstanceGroupManagers/RecreateInstances', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstanceGroupManager(); - $this->assertProtobufEquals($instanceGroupManager, $actualValue); - $actualValue = $actualApiRequestObject->getInstanceGroupManagersRecreateInstancesRequestResource(); - $this->assertProtobufEquals($instanceGroupManagersRecreateInstancesRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function recreateInstancesExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/recreateInstancesExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $instanceGroupManagersRecreateInstancesRequestResource = new InstanceGroupManagersRecreateInstancesRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->recreateInstances($instanceGroupManager, $instanceGroupManagersRecreateInstancesRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 resizeTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/resizeTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/resizeTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $project = 'project-309310695'; - $size = 3530753; - $zone = 'zone3744684'; - $response = $gapicClient->resize($instanceGroupManager, $project, $size, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.InstanceGroupManagers/Resize', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstanceGroupManager(); - $this->assertProtobufEquals($instanceGroupManager, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getSize(); - $this->assertProtobufEquals($size, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function resizeExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/resizeExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $project = 'project-309310695'; - $size = 3530753; - $zone = 'zone3744684'; - $response = $gapicClient->resize($instanceGroupManager, $project, $size, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 resumeInstancesTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/resumeInstancesTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/resumeInstancesTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $instanceGroupManagersResumeInstancesRequestResource = new InstanceGroupManagersResumeInstancesRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->resumeInstances($instanceGroupManager, $instanceGroupManagersResumeInstancesRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.InstanceGroupManagers/ResumeInstances', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstanceGroupManager(); - $this->assertProtobufEquals($instanceGroupManager, $actualValue); - $actualValue = $actualApiRequestObject->getInstanceGroupManagersResumeInstancesRequestResource(); - $this->assertProtobufEquals($instanceGroupManagersResumeInstancesRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function resumeInstancesExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/resumeInstancesExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $instanceGroupManagersResumeInstancesRequestResource = new InstanceGroupManagersResumeInstancesRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->resumeInstances($instanceGroupManager, $instanceGroupManagersResumeInstancesRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 setInstanceTemplateTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setInstanceTemplateTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/setInstanceTemplateTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $instanceGroupManagersSetInstanceTemplateRequestResource = new InstanceGroupManagersSetInstanceTemplateRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->setInstanceTemplate($instanceGroupManager, $instanceGroupManagersSetInstanceTemplateRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.InstanceGroupManagers/SetInstanceTemplate', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstanceGroupManager(); - $this->assertProtobufEquals($instanceGroupManager, $actualValue); - $actualValue = $actualApiRequestObject->getInstanceGroupManagersSetInstanceTemplateRequestResource(); - $this->assertProtobufEquals($instanceGroupManagersSetInstanceTemplateRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setInstanceTemplateExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setInstanceTemplateExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $instanceGroupManagersSetInstanceTemplateRequestResource = new InstanceGroupManagersSetInstanceTemplateRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->setInstanceTemplate($instanceGroupManager, $instanceGroupManagersSetInstanceTemplateRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 setTargetPoolsTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setTargetPoolsTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/setTargetPoolsTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $instanceGroupManagersSetTargetPoolsRequestResource = new InstanceGroupManagersSetTargetPoolsRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->setTargetPools($instanceGroupManager, $instanceGroupManagersSetTargetPoolsRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.InstanceGroupManagers/SetTargetPools', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstanceGroupManager(); - $this->assertProtobufEquals($instanceGroupManager, $actualValue); - $actualValue = $actualApiRequestObject->getInstanceGroupManagersSetTargetPoolsRequestResource(); - $this->assertProtobufEquals($instanceGroupManagersSetTargetPoolsRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setTargetPoolsExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setTargetPoolsExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $instanceGroupManagersSetTargetPoolsRequestResource = new InstanceGroupManagersSetTargetPoolsRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->setTargetPools($instanceGroupManager, $instanceGroupManagersSetTargetPoolsRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 startInstancesTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/startInstancesTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/startInstancesTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $instanceGroupManagersStartInstancesRequestResource = new InstanceGroupManagersStartInstancesRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->startInstances($instanceGroupManager, $instanceGroupManagersStartInstancesRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.InstanceGroupManagers/StartInstances', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstanceGroupManager(); - $this->assertProtobufEquals($instanceGroupManager, $actualValue); - $actualValue = $actualApiRequestObject->getInstanceGroupManagersStartInstancesRequestResource(); - $this->assertProtobufEquals($instanceGroupManagersStartInstancesRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function startInstancesExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/startInstancesExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $instanceGroupManagersStartInstancesRequestResource = new InstanceGroupManagersStartInstancesRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->startInstances($instanceGroupManager, $instanceGroupManagersStartInstancesRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 stopInstancesTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/stopInstancesTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/stopInstancesTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $instanceGroupManagersStopInstancesRequestResource = new InstanceGroupManagersStopInstancesRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->stopInstances($instanceGroupManager, $instanceGroupManagersStopInstancesRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.InstanceGroupManagers/StopInstances', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstanceGroupManager(); - $this->assertProtobufEquals($instanceGroupManager, $actualValue); - $actualValue = $actualApiRequestObject->getInstanceGroupManagersStopInstancesRequestResource(); - $this->assertProtobufEquals($instanceGroupManagersStopInstancesRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function stopInstancesExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/stopInstancesExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $instanceGroupManagersStopInstancesRequestResource = new InstanceGroupManagersStopInstancesRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->stopInstances($instanceGroupManager, $instanceGroupManagersStopInstancesRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 suspendInstancesTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/suspendInstancesTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/suspendInstancesTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $instanceGroupManagersSuspendInstancesRequestResource = new InstanceGroupManagersSuspendInstancesRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->suspendInstances($instanceGroupManager, $instanceGroupManagersSuspendInstancesRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.InstanceGroupManagers/SuspendInstances', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstanceGroupManager(); - $this->assertProtobufEquals($instanceGroupManager, $actualValue); - $actualValue = $actualApiRequestObject->getInstanceGroupManagersSuspendInstancesRequestResource(); - $this->assertProtobufEquals($instanceGroupManagersSuspendInstancesRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function suspendInstancesExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/suspendInstancesExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $instanceGroupManagersSuspendInstancesRequestResource = new InstanceGroupManagersSuspendInstancesRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->suspendInstances($instanceGroupManager, $instanceGroupManagersSuspendInstancesRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 updatePerInstanceConfigsTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/updatePerInstanceConfigsTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/updatePerInstanceConfigsTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $instanceGroupManagersUpdatePerInstanceConfigsReqResource = new InstanceGroupManagersUpdatePerInstanceConfigsReq(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->updatePerInstanceConfigs($instanceGroupManager, $instanceGroupManagersUpdatePerInstanceConfigsReqResource, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.InstanceGroupManagers/UpdatePerInstanceConfigs', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstanceGroupManager(); - $this->assertProtobufEquals($instanceGroupManager, $actualValue); - $actualValue = $actualApiRequestObject->getInstanceGroupManagersUpdatePerInstanceConfigsReqResource(); - $this->assertProtobufEquals($instanceGroupManagersUpdatePerInstanceConfigsReqResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function updatePerInstanceConfigsExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/updatePerInstanceConfigsExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $instanceGroupManagersUpdatePerInstanceConfigsReqResource = new InstanceGroupManagersUpdatePerInstanceConfigsReq(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->updatePerInstanceConfigs($instanceGroupManager, $instanceGroupManagersUpdatePerInstanceConfigsReqResource, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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/Compute/tests/Unit/V1/InstanceGroupsClientTest.php b/Compute/tests/Unit/V1/InstanceGroupsClientTest.php deleted file mode 100644 index 5b2ba943eb13..000000000000 --- a/Compute/tests/Unit/V1/InstanceGroupsClientTest.php +++ /dev/null @@ -1,1010 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return InstanceGroupsClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new InstanceGroupsClient($options); - } - - /** @test */ - public function addInstancesTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/addInstancesTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/addInstancesTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instanceGroup = 'instanceGroup81095253'; - $instanceGroupsAddInstancesRequestResource = new InstanceGroupsAddInstancesRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->addInstances($instanceGroup, $instanceGroupsAddInstancesRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.InstanceGroups/AddInstances', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstanceGroup(); - $this->assertProtobufEquals($instanceGroup, $actualValue); - $actualValue = $actualApiRequestObject->getInstanceGroupsAddInstancesRequestResource(); - $this->assertProtobufEquals($instanceGroupsAddInstancesRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function addInstancesExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/addInstancesExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instanceGroup = 'instanceGroup81095253'; - $instanceGroupsAddInstancesRequestResource = new InstanceGroupsAddInstancesRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->addInstances($instanceGroup, $instanceGroupsAddInstancesRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 aggregatedListTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $items = [ - 'itemsKey' => new InstanceGroupsScopedList(), - ]; - $expectedResponse = new InstanceGroupAggregatedList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->aggregatedList($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertArrayHasKey('itemsKey', $expectedResponse->getItems()); - $this->assertArrayHasKey('itemsKey', $resources); - $this->assertEquals($expectedResponse->getItems()['itemsKey'], $resources['itemsKey']); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.InstanceGroups/AggregatedList', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function aggregatedListExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->aggregatedList($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instanceGroup = 'instanceGroup81095253'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->delete($instanceGroup, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.InstanceGroups/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstanceGroup(); - $this->assertProtobufEquals($instanceGroup, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instanceGroup = 'instanceGroup81095253'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->delete($instanceGroup, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $fingerprint = 'fingerprint-1375934236'; - $id = 3355; - $kind = 'kind3292052'; - $name = 'name3373707'; - $network = 'network1843485230'; - $region = 'region-934795532'; - $selfLink = 'selfLink-1691268851'; - $size = 3530753; - $subnetwork = 'subnetwork-1302785042'; - $zone2 = 'zone2-696322977'; - $expectedResponse = new InstanceGroup(); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setFingerprint($fingerprint); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setName($name); - $expectedResponse->setNetwork($network); - $expectedResponse->setRegion($region); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setSize($size); - $expectedResponse->setSubnetwork($subnetwork); - $expectedResponse->setZone($zone2); - $transport->addResponse($expectedResponse); - // Mock request - $instanceGroup = 'instanceGroup81095253'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->get($instanceGroup, $project, $zone); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.InstanceGroups/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getInstanceGroup(); - $this->assertProtobufEquals($instanceGroup, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $instanceGroup = 'instanceGroup81095253'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - try { - $gapicClient->get($instanceGroup, $project, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instanceGroupResource = new InstanceGroup(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->insert($instanceGroupResource, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.InstanceGroups/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstanceGroupResource(); - $this->assertProtobufEquals($instanceGroupResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instanceGroupResource = new InstanceGroup(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->insert($instanceGroupResource, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new InstanceGroup(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new InstanceGroupList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->list($project, $zone); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.InstanceGroups/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $zone = 'zone3744684'; - try { - $gapicClient->list($project, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listInstancesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new InstanceWithNamedPorts(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new InstanceGroupsListInstances(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $instanceGroup = 'instanceGroup81095253'; - $instanceGroupsListInstancesRequestResource = new InstanceGroupsListInstancesRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->listInstances($instanceGroup, $instanceGroupsListInstancesRequestResource, $project, $zone); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.InstanceGroups/ListInstances', $actualFuncCall); - $actualValue = $actualRequestObject->getInstanceGroup(); - $this->assertProtobufEquals($instanceGroup, $actualValue); - $actualValue = $actualRequestObject->getInstanceGroupsListInstancesRequestResource(); - $this->assertProtobufEquals($instanceGroupsListInstancesRequestResource, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listInstancesExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $instanceGroup = 'instanceGroup81095253'; - $instanceGroupsListInstancesRequestResource = new InstanceGroupsListInstancesRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - try { - $gapicClient->listInstances($instanceGroup, $instanceGroupsListInstancesRequestResource, $project, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function removeInstancesTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/removeInstancesTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/removeInstancesTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instanceGroup = 'instanceGroup81095253'; - $instanceGroupsRemoveInstancesRequestResource = new InstanceGroupsRemoveInstancesRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->removeInstances($instanceGroup, $instanceGroupsRemoveInstancesRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.InstanceGroups/RemoveInstances', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstanceGroup(); - $this->assertProtobufEquals($instanceGroup, $actualValue); - $actualValue = $actualApiRequestObject->getInstanceGroupsRemoveInstancesRequestResource(); - $this->assertProtobufEquals($instanceGroupsRemoveInstancesRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function removeInstancesExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/removeInstancesExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instanceGroup = 'instanceGroup81095253'; - $instanceGroupsRemoveInstancesRequestResource = new InstanceGroupsRemoveInstancesRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->removeInstances($instanceGroup, $instanceGroupsRemoveInstancesRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 setNamedPortsTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setNamedPortsTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/setNamedPortsTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instanceGroup = 'instanceGroup81095253'; - $instanceGroupsSetNamedPortsRequestResource = new InstanceGroupsSetNamedPortsRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->setNamedPorts($instanceGroup, $instanceGroupsSetNamedPortsRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.InstanceGroups/SetNamedPorts', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstanceGroup(); - $this->assertProtobufEquals($instanceGroup, $actualValue); - $actualValue = $actualApiRequestObject->getInstanceGroupsSetNamedPortsRequestResource(); - $this->assertProtobufEquals($instanceGroupsSetNamedPortsRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setNamedPortsExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setNamedPortsExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instanceGroup = 'instanceGroup81095253'; - $instanceGroupsSetNamedPortsRequestResource = new InstanceGroupsSetNamedPortsRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->setNamedPorts($instanceGroup, $instanceGroupsSetNamedPortsRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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/Compute/tests/Unit/V1/InstanceSettingsServiceClientTest.php b/Compute/tests/Unit/V1/InstanceSettingsServiceClientTest.php deleted file mode 100644 index d2c5797f9008..000000000000 --- a/Compute/tests/Unit/V1/InstanceSettingsServiceClientTest.php +++ /dev/null @@ -1,252 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return InstanceSettingsServiceClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new InstanceSettingsServiceClient($options); - } - - /** @test */ - public function getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $fingerprint = 'fingerprint-1375934236'; - $kind = 'kind3292052'; - $zone2 = 'zone2-696322977'; - $expectedResponse = new InstanceSettings(); - $expectedResponse->setFingerprint($fingerprint); - $expectedResponse->setKind($kind); - $expectedResponse->setZone($zone2); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->get($project, $zone); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.InstanceSettingsService/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $zone = 'zone3744684'; - try { - $gapicClient->get($project, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function patchTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/patchTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instanceSettingsResource = new InstanceSettings(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->patch($instanceSettingsResource, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.InstanceSettingsService/Patch', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstanceSettingsResource(); - $this->assertProtobufEquals($instanceSettingsResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function patchExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instanceSettingsResource = new InstanceSettings(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->patch($instanceSettingsResource, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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/Compute/tests/Unit/V1/InstanceTemplatesClientTest.php b/Compute/tests/Unit/V1/InstanceTemplatesClientTest.php deleted file mode 100644 index 3eb7ebb80a5c..000000000000 --- a/Compute/tests/Unit/V1/InstanceTemplatesClientTest.php +++ /dev/null @@ -1,733 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return InstanceTemplatesClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new InstanceTemplatesClient($options); - } - - /** @test */ - public function aggregatedListTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $items = [ - 'itemsKey' => new InstanceTemplatesScopedList(), - ]; - $expectedResponse = new InstanceTemplateAggregatedList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->aggregatedList($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertArrayHasKey('itemsKey', $expectedResponse->getItems()); - $this->assertArrayHasKey('itemsKey', $resources); - $this->assertEquals($expectedResponse->getItems()['itemsKey'], $resources['itemsKey']); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.InstanceTemplates/AggregatedList', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function aggregatedListExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->aggregatedList($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instanceTemplate = 'instanceTemplate309248228'; - $project = 'project-309310695'; - $response = $gapicClient->delete($instanceTemplate, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.InstanceTemplates/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstanceTemplate(); - $this->assertProtobufEquals($instanceTemplate, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instanceTemplate = 'instanceTemplate309248228'; - $project = 'project-309310695'; - $response = $gapicClient->delete($instanceTemplate, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $id = 3355; - $kind = 'kind3292052'; - $name = 'name3373707'; - $region = 'region-934795532'; - $selfLink = 'selfLink-1691268851'; - $sourceInstance = 'sourceInstance-677426119'; - $expectedResponse = new InstanceTemplate(); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setName($name); - $expectedResponse->setRegion($region); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setSourceInstance($sourceInstance); - $transport->addResponse($expectedResponse); - // Mock request - $instanceTemplate = 'instanceTemplate309248228'; - $project = 'project-309310695'; - $response = $gapicClient->get($instanceTemplate, $project); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.InstanceTemplates/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getInstanceTemplate(); - $this->assertProtobufEquals($instanceTemplate, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $instanceTemplate = 'instanceTemplate309248228'; - $project = 'project-309310695'; - try { - $gapicClient->get($instanceTemplate, $project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $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 - $etag = 'etag3123477'; - $iamOwned = false; - $version = 351608024; - $expectedResponse = new Policy(); - $expectedResponse->setEtag($etag); - $expectedResponse->setIamOwned($iamOwned); - $expectedResponse->setVersion($version); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $response = $gapicClient->getIamPolicy($project, $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.compute.v1.InstanceTemplates/GetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $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 - $project = 'project-309310695'; - $resource = 'resource-341064690'; - try { - $gapicClient->getIamPolicy($project, $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 insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instanceTemplateResource = new InstanceTemplate(); - $project = 'project-309310695'; - $response = $gapicClient->insert($instanceTemplateResource, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.InstanceTemplates/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstanceTemplateResource(); - $this->assertProtobufEquals($instanceTemplateResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instanceTemplateResource = new InstanceTemplate(); - $project = 'project-309310695'; - $response = $gapicClient->insert($instanceTemplateResource, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new InstanceTemplate(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new InstanceTemplateList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->list($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.InstanceTemplates/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->list($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $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 - $etag = 'etag3123477'; - $iamOwned = false; - $version = 351608024; - $expectedResponse = new Policy(); - $expectedResponse->setEtag($etag); - $expectedResponse->setIamOwned($iamOwned); - $expectedResponse->setVersion($version); - $transport->addResponse($expectedResponse); - // Mock request - $globalSetPolicyRequestResource = new GlobalSetPolicyRequest(); - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $response = $gapicClient->setIamPolicy($globalSetPolicyRequestResource, $project, $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.compute.v1.InstanceTemplates/SetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getGlobalSetPolicyRequestResource(); - $this->assertProtobufEquals($globalSetPolicyRequestResource, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $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 - $globalSetPolicyRequestResource = new GlobalSetPolicyRequest(); - $project = 'project-309310695'; - $resource = 'resource-341064690'; - try { - $gapicClient->setIamPolicy($globalSetPolicyRequestResource, $project, $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 testIamPermissionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new TestPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $testPermissionsRequestResource = new TestPermissionsRequest(); - $response = $gapicClient->testIamPermissions($project, $resource, $testPermissionsRequestResource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.InstanceTemplates/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getTestPermissionsRequestResource(); - $this->assertProtobufEquals($testPermissionsRequestResource, $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 - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $testPermissionsRequestResource = new TestPermissionsRequest(); - try { - $gapicClient->testIamPermissions($project, $resource, $testPermissionsRequestResource); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->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/Compute/tests/Unit/V1/InstancesClientTest.php b/Compute/tests/Unit/V1/InstancesClientTest.php deleted file mode 100644 index a0cd5f6027fe..000000000000 --- a/Compute/tests/Unit/V1/InstancesClientTest.php +++ /dev/null @@ -1,5502 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return InstancesClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new InstancesClient($options); - } - - /** @test */ - public function addAccessConfigTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/addAccessConfigTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/addAccessConfigTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $accessConfigResource = new AccessConfig(); - $instance = 'instance555127957'; - $networkInterface = 'networkInterface902258792'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->addAccessConfig($accessConfigResource, $instance, $networkInterface, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.Instances/AddAccessConfig', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getAccessConfigResource(); - $this->assertProtobufEquals($accessConfigResource, $actualValue); - $actualValue = $actualApiRequestObject->getInstance(); - $this->assertProtobufEquals($instance, $actualValue); - $actualValue = $actualApiRequestObject->getNetworkInterface(); - $this->assertProtobufEquals($networkInterface, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function addAccessConfigExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/addAccessConfigExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $accessConfigResource = new AccessConfig(); - $instance = 'instance555127957'; - $networkInterface = 'networkInterface902258792'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->addAccessConfig($accessConfigResource, $instance, $networkInterface, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 addResourcePoliciesTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/addResourcePoliciesTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/addResourcePoliciesTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instance = 'instance555127957'; - $instancesAddResourcePoliciesRequestResource = new InstancesAddResourcePoliciesRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->addResourcePolicies($instance, $instancesAddResourcePoliciesRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.Instances/AddResourcePolicies', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstance(); - $this->assertProtobufEquals($instance, $actualValue); - $actualValue = $actualApiRequestObject->getInstancesAddResourcePoliciesRequestResource(); - $this->assertProtobufEquals($instancesAddResourcePoliciesRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function addResourcePoliciesExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/addResourcePoliciesExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instance = 'instance555127957'; - $instancesAddResourcePoliciesRequestResource = new InstancesAddResourcePoliciesRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->addResourcePolicies($instance, $instancesAddResourcePoliciesRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 aggregatedListTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $items = [ - 'itemsKey' => new InstancesScopedList(), - ]; - $expectedResponse = new InstanceAggregatedList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->aggregatedList($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertArrayHasKey('itemsKey', $expectedResponse->getItems()); - $this->assertArrayHasKey('itemsKey', $resources); - $this->assertEquals($expectedResponse->getItems()['itemsKey'], $resources['itemsKey']); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Instances/AggregatedList', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function aggregatedListExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->aggregatedList($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function attachDiskTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/attachDiskTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/attachDiskTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $attachedDiskResource = new AttachedDisk(); - $instance = 'instance555127957'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->attachDisk($attachedDiskResource, $instance, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.Instances/AttachDisk', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getAttachedDiskResource(); - $this->assertProtobufEquals($attachedDiskResource, $actualValue); - $actualValue = $actualApiRequestObject->getInstance(); - $this->assertProtobufEquals($instance, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function attachDiskExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/attachDiskExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $attachedDiskResource = new AttachedDisk(); - $instance = 'instance555127957'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->attachDisk($attachedDiskResource, $instance, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 bulkInsertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/bulkInsertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/bulkInsertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $bulkInsertInstanceResourceResource = new BulkInsertInstanceResource(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->bulkInsert($bulkInsertInstanceResourceResource, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.Instances/BulkInsert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getBulkInsertInstanceResourceResource(); - $this->assertProtobufEquals($bulkInsertInstanceResourceResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function bulkInsertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/bulkInsertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $bulkInsertInstanceResourceResource = new BulkInsertInstanceResource(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->bulkInsert($bulkInsertInstanceResourceResource, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instance = 'instance555127957'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->delete($instance, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.Instances/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstance(); - $this->assertProtobufEquals($instance, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instance = 'instance555127957'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->delete($instance, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 deleteAccessConfigTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteAccessConfigTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteAccessConfigTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $accessConfig = 'accessConfig-464014723'; - $instance = 'instance555127957'; - $networkInterface = 'networkInterface902258792'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->deleteAccessConfig($accessConfig, $instance, $networkInterface, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.Instances/DeleteAccessConfig', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getAccessConfig(); - $this->assertProtobufEquals($accessConfig, $actualValue); - $actualValue = $actualApiRequestObject->getInstance(); - $this->assertProtobufEquals($instance, $actualValue); - $actualValue = $actualApiRequestObject->getNetworkInterface(); - $this->assertProtobufEquals($networkInterface, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteAccessConfigExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteAccessConfigExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $accessConfig = 'accessConfig-464014723'; - $instance = 'instance555127957'; - $networkInterface = 'networkInterface902258792'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->deleteAccessConfig($accessConfig, $instance, $networkInterface, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 detachDiskTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/detachDiskTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/detachDiskTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $deviceName = 'deviceName-1543071020'; - $instance = 'instance555127957'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->detachDisk($deviceName, $instance, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.Instances/DetachDisk', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getDeviceName(); - $this->assertProtobufEquals($deviceName, $actualValue); - $actualValue = $actualApiRequestObject->getInstance(); - $this->assertProtobufEquals($instance, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function detachDiskExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/detachDiskExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $deviceName = 'deviceName-1543071020'; - $instance = 'instance555127957'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->detachDisk($deviceName, $instance, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $canIpForward = true; - $cpuPlatform = 'cpuPlatform947156266'; - $creationTimestamp = 'creationTimestamp567396278'; - $deletionProtection = true; - $description = 'description-1724546052'; - $fingerprint = 'fingerprint-1375934236'; - $hostname = 'hostname-299803597'; - $id = 3355; - $keyRevocationActionType = 'keyRevocationActionType-1374671262'; - $kind = 'kind3292052'; - $labelFingerprint = 'labelFingerprint714995737'; - $lastStartTimestamp = 'lastStartTimestamp-629911088'; - $lastStopTimestamp = 'lastStopTimestamp-1197789726'; - $lastSuspendedTimestamp = 'lastSuspendedTimestamp893146249'; - $machineType = 'machineType1838323762'; - $minCpuPlatform = 'minCpuPlatform-1367699977'; - $name = 'name3373707'; - $privateIpv6GoogleAccess = 'privateIpv6GoogleAccess1122018830'; - $satisfiesPzi = false; - $satisfiesPzs = false; - $selfLink = 'selfLink-1691268851'; - $sourceMachineImage = 'sourceMachineImage-1051972033'; - $startRestricted = true; - $status = 'status-892481550'; - $statusMessage = 'statusMessage-239442758'; - $zone2 = 'zone2-696322977'; - $expectedResponse = new Instance(); - $expectedResponse->setCanIpForward($canIpForward); - $expectedResponse->setCpuPlatform($cpuPlatform); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDeletionProtection($deletionProtection); - $expectedResponse->setDescription($description); - $expectedResponse->setFingerprint($fingerprint); - $expectedResponse->setHostname($hostname); - $expectedResponse->setId($id); - $expectedResponse->setKeyRevocationActionType($keyRevocationActionType); - $expectedResponse->setKind($kind); - $expectedResponse->setLabelFingerprint($labelFingerprint); - $expectedResponse->setLastStartTimestamp($lastStartTimestamp); - $expectedResponse->setLastStopTimestamp($lastStopTimestamp); - $expectedResponse->setLastSuspendedTimestamp($lastSuspendedTimestamp); - $expectedResponse->setMachineType($machineType); - $expectedResponse->setMinCpuPlatform($minCpuPlatform); - $expectedResponse->setName($name); - $expectedResponse->setPrivateIpv6GoogleAccess($privateIpv6GoogleAccess); - $expectedResponse->setSatisfiesPzi($satisfiesPzi); - $expectedResponse->setSatisfiesPzs($satisfiesPzs); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setSourceMachineImage($sourceMachineImage); - $expectedResponse->setStartRestricted($startRestricted); - $expectedResponse->setStatus($status); - $expectedResponse->setStatusMessage($statusMessage); - $expectedResponse->setZone($zone2); - $transport->addResponse($expectedResponse); - // Mock request - $instance = 'instance555127957'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->get($instance, $project, $zone); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Instances/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getInstance(); - $this->assertProtobufEquals($instance, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $instance = 'instance555127957'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - try { - $gapicClient->get($instance, $project, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getEffectiveFirewallsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new InstancesGetEffectiveFirewallsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $instance = 'instance555127957'; - $networkInterface = 'networkInterface902258792'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->getEffectiveFirewalls($instance, $networkInterface, $project, $zone); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Instances/GetEffectiveFirewalls', $actualFuncCall); - $actualValue = $actualRequestObject->getInstance(); - $this->assertProtobufEquals($instance, $actualValue); - $actualValue = $actualRequestObject->getNetworkInterface(); - $this->assertProtobufEquals($networkInterface, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getEffectiveFirewallsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $instance = 'instance555127957'; - $networkInterface = 'networkInterface902258792'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - try { - $gapicClient->getEffectiveFirewalls($instance, $networkInterface, $project, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getGuestAttributesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $kind = 'kind3292052'; - $queryPath2 = 'queryPath21491922415'; - $selfLink = 'selfLink-1691268851'; - $variableKey2 = 'variableKey2-1496058161'; - $variableValue = 'variableValue-1486030354'; - $expectedResponse = new GuestAttributes(); - $expectedResponse->setKind($kind); - $expectedResponse->setQueryPath($queryPath2); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setVariableKey($variableKey2); - $expectedResponse->setVariableValue($variableValue); - $transport->addResponse($expectedResponse); - // Mock request - $instance = 'instance555127957'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->getGuestAttributes($instance, $project, $zone); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Instances/GetGuestAttributes', $actualFuncCall); - $actualValue = $actualRequestObject->getInstance(); - $this->assertProtobufEquals($instance, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getGuestAttributesExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $instance = 'instance555127957'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - try { - $gapicClient->getGuestAttributes($instance, $project, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $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 - $etag = 'etag3123477'; - $iamOwned = false; - $version = 351608024; - $expectedResponse = new Policy(); - $expectedResponse->setEtag($etag); - $expectedResponse->setIamOwned($iamOwned); - $expectedResponse->setVersion($version); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $zone = 'zone3744684'; - $response = $gapicClient->getIamPolicy($project, $resource, $zone); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Instances/GetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $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 - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $zone = 'zone3744684'; - try { - $gapicClient->getIamPolicy($project, $resource, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getScreenshotTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $contents = 'contents-567321830'; - $kind = 'kind3292052'; - $expectedResponse = new Screenshot(); - $expectedResponse->setContents($contents); - $expectedResponse->setKind($kind); - $transport->addResponse($expectedResponse); - // Mock request - $instance = 'instance555127957'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->getScreenshot($instance, $project, $zone); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Instances/GetScreenshot', $actualFuncCall); - $actualValue = $actualRequestObject->getInstance(); - $this->assertProtobufEquals($instance, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getScreenshotExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $instance = 'instance555127957'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - try { - $gapicClient->getScreenshot($instance, $project, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getSerialPortOutputTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $contents = 'contents-567321830'; - $kind = 'kind3292052'; - $next = 3377907; - $selfLink = 'selfLink-1691268851'; - $start2 = 1897185387; - $expectedResponse = new SerialPortOutput(); - $expectedResponse->setContents($contents); - $expectedResponse->setKind($kind); - $expectedResponse->setNext($next); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setStart($start2); - $transport->addResponse($expectedResponse); - // Mock request - $instance = 'instance555127957'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->getSerialPortOutput($instance, $project, $zone); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Instances/GetSerialPortOutput', $actualFuncCall); - $actualValue = $actualRequestObject->getInstance(); - $this->assertProtobufEquals($instance, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getSerialPortOutputExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $instance = 'instance555127957'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - try { - $gapicClient->getSerialPortOutput($instance, $project, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getShieldedInstanceIdentityTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $kind = 'kind3292052'; - $expectedResponse = new ShieldedInstanceIdentity(); - $expectedResponse->setKind($kind); - $transport->addResponse($expectedResponse); - // Mock request - $instance = 'instance555127957'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->getShieldedInstanceIdentity($instance, $project, $zone); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Instances/GetShieldedInstanceIdentity', $actualFuncCall); - $actualValue = $actualRequestObject->getInstance(); - $this->assertProtobufEquals($instance, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getShieldedInstanceIdentityExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $instance = 'instance555127957'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - try { - $gapicClient->getShieldedInstanceIdentity($instance, $project, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instanceResource = new Instance(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->insert($instanceResource, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.Instances/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstanceResource(); - $this->assertProtobufEquals($instanceResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instanceResource = new Instance(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->insert($instanceResource, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new Instance(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new InstanceList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->list($project, $zone); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Instances/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $zone = 'zone3744684'; - try { - $gapicClient->list($project, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listReferrersTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new Reference(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new InstanceListReferrers(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $instance = 'instance555127957'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->listReferrers($instance, $project, $zone); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Instances/ListReferrers', $actualFuncCall); - $actualValue = $actualRequestObject->getInstance(); - $this->assertProtobufEquals($instance, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listReferrersExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $instance = 'instance555127957'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - try { - $gapicClient->listReferrers($instance, $project, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function performMaintenanceTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/performMaintenanceTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/performMaintenanceTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instance = 'instance555127957'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->performMaintenance($instance, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.Instances/PerformMaintenance', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstance(); - $this->assertProtobufEquals($instance, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function performMaintenanceExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/performMaintenanceExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instance = 'instance555127957'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->performMaintenance($instance, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 removeResourcePoliciesTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/removeResourcePoliciesTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/removeResourcePoliciesTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instance = 'instance555127957'; - $instancesRemoveResourcePoliciesRequestResource = new InstancesRemoveResourcePoliciesRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->removeResourcePolicies($instance, $instancesRemoveResourcePoliciesRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.Instances/RemoveResourcePolicies', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstance(); - $this->assertProtobufEquals($instance, $actualValue); - $actualValue = $actualApiRequestObject->getInstancesRemoveResourcePoliciesRequestResource(); - $this->assertProtobufEquals($instancesRemoveResourcePoliciesRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function removeResourcePoliciesExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/removeResourcePoliciesExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instance = 'instance555127957'; - $instancesRemoveResourcePoliciesRequestResource = new InstancesRemoveResourcePoliciesRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->removeResourcePolicies($instance, $instancesRemoveResourcePoliciesRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 reportHostAsFaultyTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/reportHostAsFaultyTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/reportHostAsFaultyTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instance = 'instance555127957'; - $instancesReportHostAsFaultyRequestResource = new InstancesReportHostAsFaultyRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->reportHostAsFaulty($instance, $instancesReportHostAsFaultyRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.Instances/ReportHostAsFaulty', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstance(); - $this->assertProtobufEquals($instance, $actualValue); - $actualValue = $actualApiRequestObject->getInstancesReportHostAsFaultyRequestResource(); - $this->assertProtobufEquals($instancesReportHostAsFaultyRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function reportHostAsFaultyExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/reportHostAsFaultyExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instance = 'instance555127957'; - $instancesReportHostAsFaultyRequestResource = new InstancesReportHostAsFaultyRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->reportHostAsFaulty($instance, $instancesReportHostAsFaultyRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 resetTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/resetTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/resetTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instance = 'instance555127957'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->reset($instance, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.Instances/Reset', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstance(); - $this->assertProtobufEquals($instance, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function resetExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/resetExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instance = 'instance555127957'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->reset($instance, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 resumeTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/resumeTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/resumeTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instance = 'instance555127957'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->resume($instance, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.Instances/Resume', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstance(); - $this->assertProtobufEquals($instance, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function resumeExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/resumeExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instance = 'instance555127957'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->resume($instance, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 sendDiagnosticInterruptTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new SendDiagnosticInterruptInstanceResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $instance = 'instance555127957'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->sendDiagnosticInterrupt($instance, $project, $zone); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Instances/SendDiagnosticInterrupt', $actualFuncCall); - $actualValue = $actualRequestObject->getInstance(); - $this->assertProtobufEquals($instance, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function sendDiagnosticInterruptExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $instance = 'instance555127957'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - try { - $gapicClient->sendDiagnosticInterrupt($instance, $project, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setDeletionProtectionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setDeletionProtectionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/setDeletionProtectionTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $zone = 'zone3744684'; - $response = $gapicClient->setDeletionProtection($project, $resource, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.Instances/SetDeletionProtection', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setDeletionProtectionExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setDeletionProtectionExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $zone = 'zone3744684'; - $response = $gapicClient->setDeletionProtection($project, $resource, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 setDiskAutoDeleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setDiskAutoDeleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/setDiskAutoDeleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $autoDelete = false; - $deviceName = 'deviceName-1543071020'; - $instance = 'instance555127957'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->setDiskAutoDelete($autoDelete, $deviceName, $instance, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.Instances/SetDiskAutoDelete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getAutoDelete(); - $this->assertProtobufEquals($autoDelete, $actualValue); - $actualValue = $actualApiRequestObject->getDeviceName(); - $this->assertProtobufEquals($deviceName, $actualValue); - $actualValue = $actualApiRequestObject->getInstance(); - $this->assertProtobufEquals($instance, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setDiskAutoDeleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setDiskAutoDeleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $autoDelete = false; - $deviceName = 'deviceName-1543071020'; - $instance = 'instance555127957'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->setDiskAutoDelete($autoDelete, $deviceName, $instance, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 - $etag = 'etag3123477'; - $iamOwned = false; - $version = 351608024; - $expectedResponse = new Policy(); - $expectedResponse->setEtag($etag); - $expectedResponse->setIamOwned($iamOwned); - $expectedResponse->setVersion($version); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $zone = 'zone3744684'; - $zoneSetPolicyRequestResource = new ZoneSetPolicyRequest(); - $response = $gapicClient->setIamPolicy($project, $resource, $zone, $zoneSetPolicyRequestResource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Instances/SetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $actualValue = $actualRequestObject->getZoneSetPolicyRequestResource(); - $this->assertProtobufEquals($zoneSetPolicyRequestResource, $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 - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $zone = 'zone3744684'; - $zoneSetPolicyRequestResource = new ZoneSetPolicyRequest(); - try { - $gapicClient->setIamPolicy($project, $resource, $zone, $zoneSetPolicyRequestResource); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setLabelsTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setLabelsTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/setLabelsTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instance = 'instance555127957'; - $instancesSetLabelsRequestResource = new InstancesSetLabelsRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->setLabels($instance, $instancesSetLabelsRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.Instances/SetLabels', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstance(); - $this->assertProtobufEquals($instance, $actualValue); - $actualValue = $actualApiRequestObject->getInstancesSetLabelsRequestResource(); - $this->assertProtobufEquals($instancesSetLabelsRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setLabelsExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setLabelsExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instance = 'instance555127957'; - $instancesSetLabelsRequestResource = new InstancesSetLabelsRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->setLabels($instance, $instancesSetLabelsRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 setMachineResourcesTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setMachineResourcesTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/setMachineResourcesTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instance = 'instance555127957'; - $instancesSetMachineResourcesRequestResource = new InstancesSetMachineResourcesRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->setMachineResources($instance, $instancesSetMachineResourcesRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.Instances/SetMachineResources', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstance(); - $this->assertProtobufEquals($instance, $actualValue); - $actualValue = $actualApiRequestObject->getInstancesSetMachineResourcesRequestResource(); - $this->assertProtobufEquals($instancesSetMachineResourcesRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setMachineResourcesExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setMachineResourcesExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instance = 'instance555127957'; - $instancesSetMachineResourcesRequestResource = new InstancesSetMachineResourcesRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->setMachineResources($instance, $instancesSetMachineResourcesRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 setMachineTypeTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setMachineTypeTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/setMachineTypeTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instance = 'instance555127957'; - $instancesSetMachineTypeRequestResource = new InstancesSetMachineTypeRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->setMachineType($instance, $instancesSetMachineTypeRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.Instances/SetMachineType', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstance(); - $this->assertProtobufEquals($instance, $actualValue); - $actualValue = $actualApiRequestObject->getInstancesSetMachineTypeRequestResource(); - $this->assertProtobufEquals($instancesSetMachineTypeRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setMachineTypeExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setMachineTypeExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instance = 'instance555127957'; - $instancesSetMachineTypeRequestResource = new InstancesSetMachineTypeRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->setMachineType($instance, $instancesSetMachineTypeRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 setMetadataTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setMetadataTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/setMetadataTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instance = 'instance555127957'; - $metadataResource = new Metadata(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->setMetadata($instance, $metadataResource, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.Instances/SetMetadata', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstance(); - $this->assertProtobufEquals($instance, $actualValue); - $actualValue = $actualApiRequestObject->getMetadataResource(); - $this->assertProtobufEquals($metadataResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setMetadataExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setMetadataExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instance = 'instance555127957'; - $metadataResource = new Metadata(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->setMetadata($instance, $metadataResource, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 setMinCpuPlatformTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setMinCpuPlatformTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/setMinCpuPlatformTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instance = 'instance555127957'; - $instancesSetMinCpuPlatformRequestResource = new InstancesSetMinCpuPlatformRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->setMinCpuPlatform($instance, $instancesSetMinCpuPlatformRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.Instances/SetMinCpuPlatform', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstance(); - $this->assertProtobufEquals($instance, $actualValue); - $actualValue = $actualApiRequestObject->getInstancesSetMinCpuPlatformRequestResource(); - $this->assertProtobufEquals($instancesSetMinCpuPlatformRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setMinCpuPlatformExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setMinCpuPlatformExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instance = 'instance555127957'; - $instancesSetMinCpuPlatformRequestResource = new InstancesSetMinCpuPlatformRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->setMinCpuPlatform($instance, $instancesSetMinCpuPlatformRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 setNameTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setNameTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/setNameTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instance = 'instance555127957'; - $instancesSetNameRequestResource = new InstancesSetNameRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->setName($instance, $instancesSetNameRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.Instances/SetName', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstance(); - $this->assertProtobufEquals($instance, $actualValue); - $actualValue = $actualApiRequestObject->getInstancesSetNameRequestResource(); - $this->assertProtobufEquals($instancesSetNameRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setNameExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setNameExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instance = 'instance555127957'; - $instancesSetNameRequestResource = new InstancesSetNameRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->setName($instance, $instancesSetNameRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 setSchedulingTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setSchedulingTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/setSchedulingTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instance = 'instance555127957'; - $project = 'project-309310695'; - $schedulingResource = new Scheduling(); - $zone = 'zone3744684'; - $response = $gapicClient->setScheduling($instance, $project, $schedulingResource, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.Instances/SetScheduling', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstance(); - $this->assertProtobufEquals($instance, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getSchedulingResource(); - $this->assertProtobufEquals($schedulingResource, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setSchedulingExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setSchedulingExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instance = 'instance555127957'; - $project = 'project-309310695'; - $schedulingResource = new Scheduling(); - $zone = 'zone3744684'; - $response = $gapicClient->setScheduling($instance, $project, $schedulingResource, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 setSecurityPolicyTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setSecurityPolicyTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/setSecurityPolicyTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instance = 'instance555127957'; - $instancesSetSecurityPolicyRequestResource = new InstancesSetSecurityPolicyRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->setSecurityPolicy($instance, $instancesSetSecurityPolicyRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.Instances/SetSecurityPolicy', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstance(); - $this->assertProtobufEquals($instance, $actualValue); - $actualValue = $actualApiRequestObject->getInstancesSetSecurityPolicyRequestResource(); - $this->assertProtobufEquals($instancesSetSecurityPolicyRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setSecurityPolicyExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setSecurityPolicyExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instance = 'instance555127957'; - $instancesSetSecurityPolicyRequestResource = new InstancesSetSecurityPolicyRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->setSecurityPolicy($instance, $instancesSetSecurityPolicyRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 setServiceAccountTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setServiceAccountTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/setServiceAccountTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instance = 'instance555127957'; - $instancesSetServiceAccountRequestResource = new InstancesSetServiceAccountRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->setServiceAccount($instance, $instancesSetServiceAccountRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.Instances/SetServiceAccount', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstance(); - $this->assertProtobufEquals($instance, $actualValue); - $actualValue = $actualApiRequestObject->getInstancesSetServiceAccountRequestResource(); - $this->assertProtobufEquals($instancesSetServiceAccountRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setServiceAccountExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setServiceAccountExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instance = 'instance555127957'; - $instancesSetServiceAccountRequestResource = new InstancesSetServiceAccountRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->setServiceAccount($instance, $instancesSetServiceAccountRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 setShieldedInstanceIntegrityPolicyTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setShieldedInstanceIntegrityPolicyTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/setShieldedInstanceIntegrityPolicyTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instance = 'instance555127957'; - $project = 'project-309310695'; - $shieldedInstanceIntegrityPolicyResource = new ShieldedInstanceIntegrityPolicy(); - $zone = 'zone3744684'; - $response = $gapicClient->setShieldedInstanceIntegrityPolicy($instance, $project, $shieldedInstanceIntegrityPolicyResource, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.Instances/SetShieldedInstanceIntegrityPolicy', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstance(); - $this->assertProtobufEquals($instance, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getShieldedInstanceIntegrityPolicyResource(); - $this->assertProtobufEquals($shieldedInstanceIntegrityPolicyResource, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setShieldedInstanceIntegrityPolicyExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setShieldedInstanceIntegrityPolicyExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instance = 'instance555127957'; - $project = 'project-309310695'; - $shieldedInstanceIntegrityPolicyResource = new ShieldedInstanceIntegrityPolicy(); - $zone = 'zone3744684'; - $response = $gapicClient->setShieldedInstanceIntegrityPolicy($instance, $project, $shieldedInstanceIntegrityPolicyResource, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 setTagsTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setTagsTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/setTagsTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instance = 'instance555127957'; - $project = 'project-309310695'; - $tagsResource = new Tags(); - $zone = 'zone3744684'; - $response = $gapicClient->setTags($instance, $project, $tagsResource, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.Instances/SetTags', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstance(); - $this->assertProtobufEquals($instance, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getTagsResource(); - $this->assertProtobufEquals($tagsResource, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setTagsExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setTagsExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instance = 'instance555127957'; - $project = 'project-309310695'; - $tagsResource = new Tags(); - $zone = 'zone3744684'; - $response = $gapicClient->setTags($instance, $project, $tagsResource, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 simulateMaintenanceEventTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/simulateMaintenanceEventTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/simulateMaintenanceEventTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instance = 'instance555127957'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->simulateMaintenanceEvent($instance, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.Instances/SimulateMaintenanceEvent', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstance(); - $this->assertProtobufEquals($instance, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function simulateMaintenanceEventExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/simulateMaintenanceEventExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instance = 'instance555127957'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->simulateMaintenanceEvent($instance, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 startTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/startTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/startTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instance = 'instance555127957'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->start($instance, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.Instances/Start', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstance(); - $this->assertProtobufEquals($instance, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function startExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/startExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instance = 'instance555127957'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->start($instance, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 startWithEncryptionKeyTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/startWithEncryptionKeyTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/startWithEncryptionKeyTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instance = 'instance555127957'; - $instancesStartWithEncryptionKeyRequestResource = new InstancesStartWithEncryptionKeyRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->startWithEncryptionKey($instance, $instancesStartWithEncryptionKeyRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.Instances/StartWithEncryptionKey', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstance(); - $this->assertProtobufEquals($instance, $actualValue); - $actualValue = $actualApiRequestObject->getInstancesStartWithEncryptionKeyRequestResource(); - $this->assertProtobufEquals($instancesStartWithEncryptionKeyRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function startWithEncryptionKeyExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/startWithEncryptionKeyExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instance = 'instance555127957'; - $instancesStartWithEncryptionKeyRequestResource = new InstancesStartWithEncryptionKeyRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->startWithEncryptionKey($instance, $instancesStartWithEncryptionKeyRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 stopTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/stopTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/stopTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instance = 'instance555127957'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->stop($instance, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.Instances/Stop', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstance(); - $this->assertProtobufEquals($instance, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function stopExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/stopExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instance = 'instance555127957'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->stop($instance, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 suspendTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/suspendTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/suspendTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instance = 'instance555127957'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->suspend($instance, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.Instances/Suspend', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstance(); - $this->assertProtobufEquals($instance, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function suspendExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/suspendExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instance = 'instance555127957'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->suspend($instance, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 testIamPermissionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new TestPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $testPermissionsRequestResource = new TestPermissionsRequest(); - $zone = 'zone3744684'; - $response = $gapicClient->testIamPermissions($project, $resource, $testPermissionsRequestResource, $zone); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Instances/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getTestPermissionsRequestResource(); - $this->assertProtobufEquals($testPermissionsRequestResource, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $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 - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $testPermissionsRequestResource = new TestPermissionsRequest(); - $zone = 'zone3744684'; - try { - $gapicClient->testIamPermissions($project, $resource, $testPermissionsRequestResource, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/updateTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/updateTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instance = 'instance555127957'; - $instanceResource = new Instance(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->update($instance, $instanceResource, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.Instances/Update', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstance(); - $this->assertProtobufEquals($instance, $actualValue); - $actualValue = $actualApiRequestObject->getInstanceResource(); - $this->assertProtobufEquals($instanceResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function updateExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/updateExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instance = 'instance555127957'; - $instanceResource = new Instance(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->update($instance, $instanceResource, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 updateAccessConfigTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/updateAccessConfigTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/updateAccessConfigTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $accessConfigResource = new AccessConfig(); - $instance = 'instance555127957'; - $networkInterface = 'networkInterface902258792'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->updateAccessConfig($accessConfigResource, $instance, $networkInterface, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.Instances/UpdateAccessConfig', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getAccessConfigResource(); - $this->assertProtobufEquals($accessConfigResource, $actualValue); - $actualValue = $actualApiRequestObject->getInstance(); - $this->assertProtobufEquals($instance, $actualValue); - $actualValue = $actualApiRequestObject->getNetworkInterface(); - $this->assertProtobufEquals($networkInterface, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function updateAccessConfigExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/updateAccessConfigExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $accessConfigResource = new AccessConfig(); - $instance = 'instance555127957'; - $networkInterface = 'networkInterface902258792'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->updateAccessConfig($accessConfigResource, $instance, $networkInterface, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 updateDisplayDeviceTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/updateDisplayDeviceTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/updateDisplayDeviceTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $displayDeviceResource = new DisplayDevice(); - $instance = 'instance555127957'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->updateDisplayDevice($displayDeviceResource, $instance, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.Instances/UpdateDisplayDevice', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getDisplayDeviceResource(); - $this->assertProtobufEquals($displayDeviceResource, $actualValue); - $actualValue = $actualApiRequestObject->getInstance(); - $this->assertProtobufEquals($instance, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function updateDisplayDeviceExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/updateDisplayDeviceExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $displayDeviceResource = new DisplayDevice(); - $instance = 'instance555127957'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->updateDisplayDevice($displayDeviceResource, $instance, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 updateNetworkInterfaceTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/updateNetworkInterfaceTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/updateNetworkInterfaceTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instance = 'instance555127957'; - $networkInterface = 'networkInterface902258792'; - $networkInterfaceResource = new NetworkInterface(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->updateNetworkInterface($instance, $networkInterface, $networkInterfaceResource, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.Instances/UpdateNetworkInterface', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstance(); - $this->assertProtobufEquals($instance, $actualValue); - $actualValue = $actualApiRequestObject->getNetworkInterface(); - $this->assertProtobufEquals($networkInterface, $actualValue); - $actualValue = $actualApiRequestObject->getNetworkInterfaceResource(); - $this->assertProtobufEquals($networkInterfaceResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function updateNetworkInterfaceExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/updateNetworkInterfaceExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instance = 'instance555127957'; - $networkInterface = 'networkInterface902258792'; - $networkInterfaceResource = new NetworkInterface(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->updateNetworkInterface($instance, $networkInterface, $networkInterfaceResource, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 updateShieldedInstanceConfigTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/updateShieldedInstanceConfigTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/updateShieldedInstanceConfigTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instance = 'instance555127957'; - $project = 'project-309310695'; - $shieldedInstanceConfigResource = new ShieldedInstanceConfig(); - $zone = 'zone3744684'; - $response = $gapicClient->updateShieldedInstanceConfig($instance, $project, $shieldedInstanceConfigResource, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.Instances/UpdateShieldedInstanceConfig', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstance(); - $this->assertProtobufEquals($instance, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getShieldedInstanceConfigResource(); - $this->assertProtobufEquals($shieldedInstanceConfigResource, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function updateShieldedInstanceConfigExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/updateShieldedInstanceConfigExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instance = 'instance555127957'; - $project = 'project-309310695'; - $shieldedInstanceConfigResource = new ShieldedInstanceConfig(); - $zone = 'zone3744684'; - $response = $gapicClient->updateShieldedInstanceConfig($instance, $project, $shieldedInstanceConfigResource, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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/Compute/tests/Unit/V1/InstantSnapshotsClientTest.php b/Compute/tests/Unit/V1/InstantSnapshotsClientTest.php deleted file mode 100644 index de747b661812..000000000000 --- a/Compute/tests/Unit/V1/InstantSnapshotsClientTest.php +++ /dev/null @@ -1,905 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return InstantSnapshotsClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new InstantSnapshotsClient($options); - } - - /** @test */ - public function aggregatedListTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $items = [ - 'itemsKey' => new InstantSnapshotsScopedList(), - ]; - $expectedResponse = new InstantSnapshotAggregatedList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->aggregatedList($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertArrayHasKey('itemsKey', $expectedResponse->getItems()); - $this->assertArrayHasKey('itemsKey', $resources); - $this->assertEquals($expectedResponse->getItems()['itemsKey'], $resources['itemsKey']); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.InstantSnapshots/AggregatedList', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function aggregatedListExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->aggregatedList($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instantSnapshot = 'instantSnapshot1465380450'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->delete($instantSnapshot, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.InstantSnapshots/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstantSnapshot(); - $this->assertProtobufEquals($instantSnapshot, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instantSnapshot = 'instantSnapshot1465380450'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->delete($instantSnapshot, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $architecture = 'architecture839674195'; - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $diskSizeGb = 757478089; - $id = 3355; - $kind = 'kind3292052'; - $labelFingerprint = 'labelFingerprint714995737'; - $name = 'name3373707'; - $region = 'region-934795532'; - $satisfiesPzi = false; - $satisfiesPzs = false; - $selfLink = 'selfLink-1691268851'; - $selfLinkWithId = 'selfLinkWithId-1029220862'; - $sourceDisk = 'sourceDisk-85117119'; - $sourceDiskId = 'sourceDiskId-1693292839'; - $status = 'status-892481550'; - $zone2 = 'zone2-696322977'; - $expectedResponse = new InstantSnapshot(); - $expectedResponse->setArchitecture($architecture); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setDiskSizeGb($diskSizeGb); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setLabelFingerprint($labelFingerprint); - $expectedResponse->setName($name); - $expectedResponse->setRegion($region); - $expectedResponse->setSatisfiesPzi($satisfiesPzi); - $expectedResponse->setSatisfiesPzs($satisfiesPzs); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setSelfLinkWithId($selfLinkWithId); - $expectedResponse->setSourceDisk($sourceDisk); - $expectedResponse->setSourceDiskId($sourceDiskId); - $expectedResponse->setStatus($status); - $expectedResponse->setZone($zone2); - $transport->addResponse($expectedResponse); - // Mock request - $instantSnapshot = 'instantSnapshot1465380450'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->get($instantSnapshot, $project, $zone); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.InstantSnapshots/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getInstantSnapshot(); - $this->assertProtobufEquals($instantSnapshot, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $instantSnapshot = 'instantSnapshot1465380450'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - try { - $gapicClient->get($instantSnapshot, $project, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $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 - $etag = 'etag3123477'; - $iamOwned = false; - $version = 351608024; - $expectedResponse = new Policy(); - $expectedResponse->setEtag($etag); - $expectedResponse->setIamOwned($iamOwned); - $expectedResponse->setVersion($version); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $zone = 'zone3744684'; - $response = $gapicClient->getIamPolicy($project, $resource, $zone); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.InstantSnapshots/GetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $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 - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $zone = 'zone3744684'; - try { - $gapicClient->getIamPolicy($project, $resource, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instantSnapshotResource = new InstantSnapshot(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->insert($instantSnapshotResource, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.InstantSnapshots/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstantSnapshotResource(); - $this->assertProtobufEquals($instantSnapshotResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instantSnapshotResource = new InstantSnapshot(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->insert($instantSnapshotResource, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new InstantSnapshot(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new InstantSnapshotList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->list($project, $zone); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.InstantSnapshots/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $zone = 'zone3744684'; - try { - $gapicClient->list($project, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $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 - $etag = 'etag3123477'; - $iamOwned = false; - $version = 351608024; - $expectedResponse = new Policy(); - $expectedResponse->setEtag($etag); - $expectedResponse->setIamOwned($iamOwned); - $expectedResponse->setVersion($version); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $zone = 'zone3744684'; - $zoneSetPolicyRequestResource = new ZoneSetPolicyRequest(); - $response = $gapicClient->setIamPolicy($project, $resource, $zone, $zoneSetPolicyRequestResource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.InstantSnapshots/SetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $actualValue = $actualRequestObject->getZoneSetPolicyRequestResource(); - $this->assertProtobufEquals($zoneSetPolicyRequestResource, $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 - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $zone = 'zone3744684'; - $zoneSetPolicyRequestResource = new ZoneSetPolicyRequest(); - try { - $gapicClient->setIamPolicy($project, $resource, $zone, $zoneSetPolicyRequestResource); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setLabelsTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setLabelsTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/setLabelsTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $zone = 'zone3744684'; - $zoneSetLabelsRequestResource = new ZoneSetLabelsRequest(); - $response = $gapicClient->setLabels($project, $resource, $zone, $zoneSetLabelsRequestResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.InstantSnapshots/SetLabels', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $actualValue = $actualApiRequestObject->getZoneSetLabelsRequestResource(); - $this->assertProtobufEquals($zoneSetLabelsRequestResource, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setLabelsExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setLabelsExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $zone = 'zone3744684'; - $zoneSetLabelsRequestResource = new ZoneSetLabelsRequest(); - $response = $gapicClient->setLabels($project, $resource, $zone, $zoneSetLabelsRequestResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 testIamPermissionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new TestPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $testPermissionsRequestResource = new TestPermissionsRequest(); - $zone = 'zone3744684'; - $response = $gapicClient->testIamPermissions($project, $resource, $testPermissionsRequestResource, $zone); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.InstantSnapshots/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getTestPermissionsRequestResource(); - $this->assertProtobufEquals($testPermissionsRequestResource, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $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 - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $testPermissionsRequestResource = new TestPermissionsRequest(); - $zone = 'zone3744684'; - try { - $gapicClient->testIamPermissions($project, $resource, $testPermissionsRequestResource, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->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/Compute/tests/Unit/V1/InterconnectAttachmentGroupsClientTest.php b/Compute/tests/Unit/V1/InterconnectAttachmentGroupsClientTest.php deleted file mode 100644 index dfc55c75c611..000000000000 --- a/Compute/tests/Unit/V1/InterconnectAttachmentGroupsClientTest.php +++ /dev/null @@ -1,833 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return InterconnectAttachmentGroupsClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new InterconnectAttachmentGroupsClient($options); - } - - /** @test */ - public function deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $interconnectAttachmentGroup = 'interconnectAttachmentGroup-460965900'; - $project = 'project-309310695'; - $response = $gapicClient->delete($interconnectAttachmentGroup, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.InterconnectAttachmentGroups/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInterconnectAttachmentGroup(); - $this->assertProtobufEquals($interconnectAttachmentGroup, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $interconnectAttachmentGroup = 'interconnectAttachmentGroup-460965900'; - $project = 'project-309310695'; - $response = $gapicClient->delete($interconnectAttachmentGroup, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $etag = 'etag3123477'; - $id = 3355; - $interconnectGroup = 'interconnectGroup1462393742'; - $kind = 'kind3292052'; - $name = 'name3373707'; - $selfLink = 'selfLink-1691268851'; - $expectedResponse = new InterconnectAttachmentGroup(); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setEtag($etag); - $expectedResponse->setId($id); - $expectedResponse->setInterconnectGroup($interconnectGroup); - $expectedResponse->setKind($kind); - $expectedResponse->setName($name); - $expectedResponse->setSelfLink($selfLink); - $transport->addResponse($expectedResponse); - // Mock request - $interconnectAttachmentGroup = 'interconnectAttachmentGroup-460965900'; - $project = 'project-309310695'; - $response = $gapicClient->get($interconnectAttachmentGroup, $project); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.InterconnectAttachmentGroups/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getInterconnectAttachmentGroup(); - $this->assertProtobufEquals($interconnectAttachmentGroup, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $interconnectAttachmentGroup = 'interconnectAttachmentGroup-460965900'; - $project = 'project-309310695'; - try { - $gapicClient->get($interconnectAttachmentGroup, $project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $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 - $etag = 'etag3123477'; - $iamOwned = false; - $version = 351608024; - $expectedResponse = new Policy(); - $expectedResponse->setEtag($etag); - $expectedResponse->setIamOwned($iamOwned); - $expectedResponse->setVersion($version); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $response = $gapicClient->getIamPolicy($project, $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.compute.v1.InterconnectAttachmentGroups/GetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $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 - $project = 'project-309310695'; - $resource = 'resource-341064690'; - try { - $gapicClient->getIamPolicy($project, $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 getOperationalStatusTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $etag = 'etag3123477'; - $expectedResponse = new InterconnectAttachmentGroupsGetOperationalStatusResponse(); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $interconnectAttachmentGroup = 'interconnectAttachmentGroup-460965900'; - $project = 'project-309310695'; - $response = $gapicClient->getOperationalStatus($interconnectAttachmentGroup, $project); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.InterconnectAttachmentGroups/GetOperationalStatus', $actualFuncCall); - $actualValue = $actualRequestObject->getInterconnectAttachmentGroup(); - $this->assertProtobufEquals($interconnectAttachmentGroup, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getOperationalStatusExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $interconnectAttachmentGroup = 'interconnectAttachmentGroup-460965900'; - $project = 'project-309310695'; - try { - $gapicClient->getOperationalStatus($interconnectAttachmentGroup, $project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $interconnectAttachmentGroupResource = new InterconnectAttachmentGroup(); - $project = 'project-309310695'; - $response = $gapicClient->insert($interconnectAttachmentGroupResource, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.InterconnectAttachmentGroups/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInterconnectAttachmentGroupResource(); - $this->assertProtobufEquals($interconnectAttachmentGroupResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $interconnectAttachmentGroupResource = new InterconnectAttachmentGroup(); - $project = 'project-309310695'; - $response = $gapicClient->insert($interconnectAttachmentGroupResource, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $etag = 'etag3123477'; - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = 'nextPageToken-1530815211'; - $selfLink = 'selfLink-1691268851'; - $expectedResponse = new InterconnectAttachmentGroupsListResponse(); - $expectedResponse->setEtag($etag); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->list($project); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.InterconnectAttachmentGroups/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->list($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function patchTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/patchTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $interconnectAttachmentGroup = 'interconnectAttachmentGroup-460965900'; - $interconnectAttachmentGroupResource = new InterconnectAttachmentGroup(); - $project = 'project-309310695'; - $response = $gapicClient->patch($interconnectAttachmentGroup, $interconnectAttachmentGroupResource, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.InterconnectAttachmentGroups/Patch', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInterconnectAttachmentGroup(); - $this->assertProtobufEquals($interconnectAttachmentGroup, $actualValue); - $actualValue = $actualApiRequestObject->getInterconnectAttachmentGroupResource(); - $this->assertProtobufEquals($interconnectAttachmentGroupResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function patchExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $interconnectAttachmentGroup = 'interconnectAttachmentGroup-460965900'; - $interconnectAttachmentGroupResource = new InterconnectAttachmentGroup(); - $project = 'project-309310695'; - $response = $gapicClient->patch($interconnectAttachmentGroup, $interconnectAttachmentGroupResource, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 - $etag = 'etag3123477'; - $iamOwned = false; - $version = 351608024; - $expectedResponse = new Policy(); - $expectedResponse->setEtag($etag); - $expectedResponse->setIamOwned($iamOwned); - $expectedResponse->setVersion($version); - $transport->addResponse($expectedResponse); - // Mock request - $globalSetPolicyRequestResource = new GlobalSetPolicyRequest(); - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $response = $gapicClient->setIamPolicy($globalSetPolicyRequestResource, $project, $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.compute.v1.InterconnectAttachmentGroups/SetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getGlobalSetPolicyRequestResource(); - $this->assertProtobufEquals($globalSetPolicyRequestResource, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $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 - $globalSetPolicyRequestResource = new GlobalSetPolicyRequest(); - $project = 'project-309310695'; - $resource = 'resource-341064690'; - try { - $gapicClient->setIamPolicy($globalSetPolicyRequestResource, $project, $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 testIamPermissionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new TestPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $testPermissionsRequestResource = new TestPermissionsRequest(); - $response = $gapicClient->testIamPermissions($project, $resource, $testPermissionsRequestResource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.InterconnectAttachmentGroups/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getTestPermissionsRequestResource(); - $this->assertProtobufEquals($testPermissionsRequestResource, $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 - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $testPermissionsRequestResource = new TestPermissionsRequest(); - try { - $gapicClient->testIamPermissions($project, $resource, $testPermissionsRequestResource); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->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/Compute/tests/Unit/V1/InterconnectAttachmentsClientTest.php b/Compute/tests/Unit/V1/InterconnectAttachmentsClientTest.php deleted file mode 100644 index 9ad797c79fda..000000000000 --- a/Compute/tests/Unit/V1/InterconnectAttachmentsClientTest.php +++ /dev/null @@ -1,840 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return InterconnectAttachmentsClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new InterconnectAttachmentsClient($options); - } - - /** @test */ - public function aggregatedListTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $items = [ - 'itemsKey' => new InterconnectAttachmentsScopedList(), - ]; - $expectedResponse = new InterconnectAttachmentAggregatedList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->aggregatedList($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertArrayHasKey('itemsKey', $expectedResponse->getItems()); - $this->assertArrayHasKey('itemsKey', $resources); - $this->assertEquals($expectedResponse->getItems()['itemsKey'], $resources['itemsKey']); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.InterconnectAttachments/AggregatedList', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function aggregatedListExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->aggregatedList($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $interconnectAttachment = 'interconnectAttachment308135284'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->delete($interconnectAttachment, $project, $region); - $this->assertFalse($response->isDone()); - $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.compute.v1.InterconnectAttachments/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInterconnectAttachment(); - $this->assertProtobufEquals($interconnectAttachment, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $interconnectAttachment = 'interconnectAttachment308135284'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->delete($interconnectAttachment, $project, $region); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $adminEnabled = false; - $attachmentGroup = 'attachmentGroup600312931'; - $bandwidth = 'bandwidth-1965768527'; - $cloudRouterIpAddress = 'cloudRouterIpAddress1361134600'; - $cloudRouterIpv6Address = 'cloudRouterIpv6Address-621819448'; - $cloudRouterIpv6InterfaceId = 'cloudRouterIpv6InterfaceId1058153613'; - $creationTimestamp = 'creationTimestamp567396278'; - $customerRouterIpAddress = 'customerRouterIpAddress-741266063'; - $customerRouterIpv6Address = 'customerRouterIpv6Address1900739825'; - $customerRouterIpv6InterfaceId = 'customerRouterIpv6InterfaceId-1229618428'; - $dataplaneVersion = 1645532811; - $description = 'description-1724546052'; - $edgeAvailabilityDomain = 'edgeAvailabilityDomain-1539323226'; - $encryption = 'encryption-1512632445'; - $googleReferenceId = 'googleReferenceId534944469'; - $id = 3355; - $interconnect = 'interconnect-849140594'; - $kind = 'kind3292052'; - $labelFingerprint = 'labelFingerprint714995737'; - $mtu = 108462; - $name = 'name3373707'; - $operationalStatus = 'operationalStatus1274812671'; - $pairingKey = 'pairingKey976566376'; - $partnerAsn = 975037061; - $region2 = 'region2-690338393'; - $remoteService = 'remoteService-1218658372'; - $router = 'router-925132983'; - $satisfiesPzs = false; - $selfLink = 'selfLink-1691268851'; - $stackType = 'stackType2036521617'; - $state = 'state109757585'; - $subnetLength = 1867652600; - $type = 'type3575610'; - $vlanTag8021q = 1730540572; - $expectedResponse = new InterconnectAttachment(); - $expectedResponse->setAdminEnabled($adminEnabled); - $expectedResponse->setAttachmentGroup($attachmentGroup); - $expectedResponse->setBandwidth($bandwidth); - $expectedResponse->setCloudRouterIpAddress($cloudRouterIpAddress); - $expectedResponse->setCloudRouterIpv6Address($cloudRouterIpv6Address); - $expectedResponse->setCloudRouterIpv6InterfaceId($cloudRouterIpv6InterfaceId); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setCustomerRouterIpAddress($customerRouterIpAddress); - $expectedResponse->setCustomerRouterIpv6Address($customerRouterIpv6Address); - $expectedResponse->setCustomerRouterIpv6InterfaceId($customerRouterIpv6InterfaceId); - $expectedResponse->setDataplaneVersion($dataplaneVersion); - $expectedResponse->setDescription($description); - $expectedResponse->setEdgeAvailabilityDomain($edgeAvailabilityDomain); - $expectedResponse->setEncryption($encryption); - $expectedResponse->setGoogleReferenceId($googleReferenceId); - $expectedResponse->setId($id); - $expectedResponse->setInterconnect($interconnect); - $expectedResponse->setKind($kind); - $expectedResponse->setLabelFingerprint($labelFingerprint); - $expectedResponse->setMtu($mtu); - $expectedResponse->setName($name); - $expectedResponse->setOperationalStatus($operationalStatus); - $expectedResponse->setPairingKey($pairingKey); - $expectedResponse->setPartnerAsn($partnerAsn); - $expectedResponse->setRegion($region2); - $expectedResponse->setRemoteService($remoteService); - $expectedResponse->setRouter($router); - $expectedResponse->setSatisfiesPzs($satisfiesPzs); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setStackType($stackType); - $expectedResponse->setState($state); - $expectedResponse->setSubnetLength($subnetLength); - $expectedResponse->setType($type); - $expectedResponse->setVlanTag8021q($vlanTag8021q); - $transport->addResponse($expectedResponse); - // Mock request - $interconnectAttachment = 'interconnectAttachment308135284'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->get($interconnectAttachment, $project, $region); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.InterconnectAttachments/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getInterconnectAttachment(); - $this->assertProtobufEquals($interconnectAttachment, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $interconnectAttachment = 'interconnectAttachment308135284'; - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->get($interconnectAttachment, $project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $interconnectAttachmentResource = new InterconnectAttachment(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->insert($interconnectAttachmentResource, $project, $region); - $this->assertFalse($response->isDone()); - $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.compute.v1.InterconnectAttachments/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInterconnectAttachmentResource(); - $this->assertProtobufEquals($interconnectAttachmentResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $interconnectAttachmentResource = new InterconnectAttachment(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->insert($interconnectAttachmentResource, $project, $region); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new InterconnectAttachment(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new InterconnectAttachmentList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->list($project, $region); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.InterconnectAttachments/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->list($project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function patchTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/patchTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $interconnectAttachment = 'interconnectAttachment308135284'; - $interconnectAttachmentResource = new InterconnectAttachment(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->patch($interconnectAttachment, $interconnectAttachmentResource, $project, $region); - $this->assertFalse($response->isDone()); - $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.compute.v1.InterconnectAttachments/Patch', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInterconnectAttachment(); - $this->assertProtobufEquals($interconnectAttachment, $actualValue); - $actualValue = $actualApiRequestObject->getInterconnectAttachmentResource(); - $this->assertProtobufEquals($interconnectAttachmentResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function patchExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $interconnectAttachment = 'interconnectAttachment308135284'; - $interconnectAttachmentResource = new InterconnectAttachment(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->patch($interconnectAttachment, $interconnectAttachmentResource, $project, $region); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 setLabelsTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setLabelsTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/setLabelsTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionSetLabelsRequestResource = new RegionSetLabelsRequest(); - $resource = 'resource-341064690'; - $response = $gapicClient->setLabels($project, $region, $regionSetLabelsRequestResource, $resource); - $this->assertFalse($response->isDone()); - $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.compute.v1.InterconnectAttachments/SetLabels', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getRegionSetLabelsRequestResource(); - $this->assertProtobufEquals($regionSetLabelsRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setLabelsExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setLabelsExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionSetLabelsRequestResource = new RegionSetLabelsRequest(); - $resource = 'resource-341064690'; - $response = $gapicClient->setLabels($project, $region, $regionSetLabelsRequestResource, $resource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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/Compute/tests/Unit/V1/InterconnectGroupsClientTest.php b/Compute/tests/Unit/V1/InterconnectGroupsClientTest.php deleted file mode 100644 index 3d4ef157a63d..000000000000 --- a/Compute/tests/Unit/V1/InterconnectGroupsClientTest.php +++ /dev/null @@ -1,950 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return InterconnectGroupsClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new InterconnectGroupsClient($options); - } - - /** @test */ - public function createMembersTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/createMembersTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/createMembersTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $interconnectGroup = 'interconnectGroup1462393742'; - $interconnectGroupsCreateMembersRequestResource = new InterconnectGroupsCreateMembersRequest(); - $project = 'project-309310695'; - $response = $gapicClient->createMembers($interconnectGroup, $interconnectGroupsCreateMembersRequestResource, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.InterconnectGroups/CreateMembers', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInterconnectGroup(); - $this->assertProtobufEquals($interconnectGroup, $actualValue); - $actualValue = $actualApiRequestObject->getInterconnectGroupsCreateMembersRequestResource(); - $this->assertProtobufEquals($interconnectGroupsCreateMembersRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function createMembersExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/createMembersExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $interconnectGroup = 'interconnectGroup1462393742'; - $interconnectGroupsCreateMembersRequestResource = new InterconnectGroupsCreateMembersRequest(); - $project = 'project-309310695'; - $response = $gapicClient->createMembers($interconnectGroup, $interconnectGroupsCreateMembersRequestResource, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $interconnectGroup = 'interconnectGroup1462393742'; - $project = 'project-309310695'; - $response = $gapicClient->delete($interconnectGroup, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.InterconnectGroups/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInterconnectGroup(); - $this->assertProtobufEquals($interconnectGroup, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $interconnectGroup = 'interconnectGroup1462393742'; - $project = 'project-309310695'; - $response = $gapicClient->delete($interconnectGroup, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $etag = 'etag3123477'; - $id = 3355; - $kind = 'kind3292052'; - $name = 'name3373707'; - $selfLink = 'selfLink-1691268851'; - $expectedResponse = new InterconnectGroup(); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setEtag($etag); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setName($name); - $expectedResponse->setSelfLink($selfLink); - $transport->addResponse($expectedResponse); - // Mock request - $interconnectGroup = 'interconnectGroup1462393742'; - $project = 'project-309310695'; - $response = $gapicClient->get($interconnectGroup, $project); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.InterconnectGroups/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getInterconnectGroup(); - $this->assertProtobufEquals($interconnectGroup, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $interconnectGroup = 'interconnectGroup1462393742'; - $project = 'project-309310695'; - try { - $gapicClient->get($interconnectGroup, $project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $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 - $etag = 'etag3123477'; - $iamOwned = false; - $version = 351608024; - $expectedResponse = new Policy(); - $expectedResponse->setEtag($etag); - $expectedResponse->setIamOwned($iamOwned); - $expectedResponse->setVersion($version); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $response = $gapicClient->getIamPolicy($project, $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.compute.v1.InterconnectGroups/GetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $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 - $project = 'project-309310695'; - $resource = 'resource-341064690'; - try { - $gapicClient->getIamPolicy($project, $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 getOperationalStatusTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $etag = 'etag3123477'; - $expectedResponse = new InterconnectGroupsGetOperationalStatusResponse(); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $interconnectGroup = 'interconnectGroup1462393742'; - $project = 'project-309310695'; - $response = $gapicClient->getOperationalStatus($interconnectGroup, $project); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.InterconnectGroups/GetOperationalStatus', $actualFuncCall); - $actualValue = $actualRequestObject->getInterconnectGroup(); - $this->assertProtobufEquals($interconnectGroup, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getOperationalStatusExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $interconnectGroup = 'interconnectGroup1462393742'; - $project = 'project-309310695'; - try { - $gapicClient->getOperationalStatus($interconnectGroup, $project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $interconnectGroupResource = new InterconnectGroup(); - $project = 'project-309310695'; - $response = $gapicClient->insert($interconnectGroupResource, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.InterconnectGroups/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInterconnectGroupResource(); - $this->assertProtobufEquals($interconnectGroupResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $interconnectGroupResource = new InterconnectGroup(); - $project = 'project-309310695'; - $response = $gapicClient->insert($interconnectGroupResource, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $etag = 'etag3123477'; - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = 'nextPageToken-1530815211'; - $selfLink = 'selfLink-1691268851'; - $expectedResponse = new InterconnectGroupsListResponse(); - $expectedResponse->setEtag($etag); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->list($project); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.InterconnectGroups/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->list($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function patchTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/patchTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $interconnectGroup = 'interconnectGroup1462393742'; - $interconnectGroupResource = new InterconnectGroup(); - $project = 'project-309310695'; - $response = $gapicClient->patch($interconnectGroup, $interconnectGroupResource, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.InterconnectGroups/Patch', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInterconnectGroup(); - $this->assertProtobufEquals($interconnectGroup, $actualValue); - $actualValue = $actualApiRequestObject->getInterconnectGroupResource(); - $this->assertProtobufEquals($interconnectGroupResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function patchExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $interconnectGroup = 'interconnectGroup1462393742'; - $interconnectGroupResource = new InterconnectGroup(); - $project = 'project-309310695'; - $response = $gapicClient->patch($interconnectGroup, $interconnectGroupResource, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 - $etag = 'etag3123477'; - $iamOwned = false; - $version = 351608024; - $expectedResponse = new Policy(); - $expectedResponse->setEtag($etag); - $expectedResponse->setIamOwned($iamOwned); - $expectedResponse->setVersion($version); - $transport->addResponse($expectedResponse); - // Mock request - $globalSetPolicyRequestResource = new GlobalSetPolicyRequest(); - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $response = $gapicClient->setIamPolicy($globalSetPolicyRequestResource, $project, $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.compute.v1.InterconnectGroups/SetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getGlobalSetPolicyRequestResource(); - $this->assertProtobufEquals($globalSetPolicyRequestResource, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $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 - $globalSetPolicyRequestResource = new GlobalSetPolicyRequest(); - $project = 'project-309310695'; - $resource = 'resource-341064690'; - try { - $gapicClient->setIamPolicy($globalSetPolicyRequestResource, $project, $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 testIamPermissionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new TestPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $testPermissionsRequestResource = new TestPermissionsRequest(); - $response = $gapicClient->testIamPermissions($project, $resource, $testPermissionsRequestResource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.InterconnectGroups/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getTestPermissionsRequestResource(); - $this->assertProtobufEquals($testPermissionsRequestResource, $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 - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $testPermissionsRequestResource = new TestPermissionsRequest(); - try { - $gapicClient->testIamPermissions($project, $resource, $testPermissionsRequestResource); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->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/Compute/tests/Unit/V1/InterconnectLocationsClientTest.php b/Compute/tests/Unit/V1/InterconnectLocationsClientTest.php deleted file mode 100644 index fe5707cf3a23..000000000000 --- a/Compute/tests/Unit/V1/InterconnectLocationsClientTest.php +++ /dev/null @@ -1,228 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return InterconnectLocationsClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new InterconnectLocationsClient($options); - } - - /** @test */ - public function getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $address = 'address-1147692044'; - $availabilityZone = 'availabilityZone-378410992'; - $city = 'city3053931'; - $continent = 'continent-403427916'; - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $facilityProvider = 'facilityProvider2143916045'; - $facilityProviderFacilityId = 'facilityProviderFacilityId-1523343611'; - $id = 3355; - $kind = 'kind3292052'; - $name = 'name3373707'; - $peeringdbFacilityId = 'peeringdbFacilityId-303818'; - $selfLink = 'selfLink-1691268851'; - $status = 'status-892481550'; - $supportsPzs = true; - $expectedResponse = new InterconnectLocation(); - $expectedResponse->setAddress($address); - $expectedResponse->setAvailabilityZone($availabilityZone); - $expectedResponse->setCity($city); - $expectedResponse->setContinent($continent); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setFacilityProvider($facilityProvider); - $expectedResponse->setFacilityProviderFacilityId($facilityProviderFacilityId); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setName($name); - $expectedResponse->setPeeringdbFacilityId($peeringdbFacilityId); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setStatus($status); - $expectedResponse->setSupportsPzs($supportsPzs); - $transport->addResponse($expectedResponse); - // Mock request - $interconnectLocation = 'interconnectLocation-581505978'; - $project = 'project-309310695'; - $response = $gapicClient->get($interconnectLocation, $project); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.InterconnectLocations/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getInterconnectLocation(); - $this->assertProtobufEquals($interconnectLocation, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $interconnectLocation = 'interconnectLocation-581505978'; - $project = 'project-309310695'; - try { - $gapicClient->get($interconnectLocation, $project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new InterconnectLocation(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new InterconnectLocationList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->list($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.InterconnectLocations/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->list($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->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/Compute/tests/Unit/V1/InterconnectRemoteLocationsClientTest.php b/Compute/tests/Unit/V1/InterconnectRemoteLocationsClientTest.php deleted file mode 100644 index a4a616877db5..000000000000 --- a/Compute/tests/Unit/V1/InterconnectRemoteLocationsClientTest.php +++ /dev/null @@ -1,232 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return InterconnectRemoteLocationsClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new InterconnectRemoteLocationsClient($options); - } - - /** @test */ - public function getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $address = 'address-1147692044'; - $city = 'city3053931'; - $continent = 'continent-403427916'; - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $facilityProvider = 'facilityProvider2143916045'; - $facilityProviderFacilityId = 'facilityProviderFacilityId-1523343611'; - $id = 3355; - $kind = 'kind3292052'; - $lacp = 'lacp3313826'; - $maxLagSize100Gbps = 828522571; - $maxLagSize10Gbps = 294007573; - $name = 'name3373707'; - $peeringdbFacilityId = 'peeringdbFacilityId-303818'; - $remoteService = 'remoteService-1218658372'; - $selfLink = 'selfLink-1691268851'; - $status = 'status-892481550'; - $expectedResponse = new InterconnectRemoteLocation(); - $expectedResponse->setAddress($address); - $expectedResponse->setCity($city); - $expectedResponse->setContinent($continent); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setFacilityProvider($facilityProvider); - $expectedResponse->setFacilityProviderFacilityId($facilityProviderFacilityId); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setLacp($lacp); - $expectedResponse->setMaxLagSize100Gbps($maxLagSize100Gbps); - $expectedResponse->setMaxLagSize10Gbps($maxLagSize10Gbps); - $expectedResponse->setName($name); - $expectedResponse->setPeeringdbFacilityId($peeringdbFacilityId); - $expectedResponse->setRemoteService($remoteService); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setStatus($status); - $transport->addResponse($expectedResponse); - // Mock request - $interconnectRemoteLocation = 'interconnectRemoteLocation1363895773'; - $project = 'project-309310695'; - $response = $gapicClient->get($interconnectRemoteLocation, $project); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.InterconnectRemoteLocations/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getInterconnectRemoteLocation(); - $this->assertProtobufEquals($interconnectRemoteLocation, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $interconnectRemoteLocation = 'interconnectRemoteLocation1363895773'; - $project = 'project-309310695'; - try { - $gapicClient->get($interconnectRemoteLocation, $project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new InterconnectRemoteLocation(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new InterconnectRemoteLocationList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->list($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.InterconnectRemoteLocations/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->list($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->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/Compute/tests/Unit/V1/InterconnectsClientTest.php b/Compute/tests/Unit/V1/InterconnectsClientTest.php deleted file mode 100644 index 3bd036751b92..000000000000 --- a/Compute/tests/Unit/V1/InterconnectsClientTest.php +++ /dev/null @@ -1,843 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return InterconnectsClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new InterconnectsClient($options); - } - - /** @test */ - public function deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $interconnect = 'interconnect-849140594'; - $project = 'project-309310695'; - $response = $gapicClient->delete($interconnect, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.Interconnects/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInterconnect(); - $this->assertProtobufEquals($interconnect, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $interconnect = 'interconnect-849140594'; - $project = 'project-309310695'; - $response = $gapicClient->delete($interconnect, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $aaiEnabled = false; - $adminEnabled = false; - $creationTimestamp = 'creationTimestamp567396278'; - $customerName = 'customerName-2143818164'; - $description = 'description-1724546052'; - $googleIpAddress = 'googleIpAddress1516847778'; - $googleReferenceId = 'googleReferenceId534944469'; - $id = 3355; - $interconnectType = 'interconnectType2125777995'; - $kind = 'kind3292052'; - $labelFingerprint = 'labelFingerprint714995737'; - $linkType = 'linkType-1624275873'; - $location = 'location1901043637'; - $macsecEnabled = true; - $name = 'name3373707'; - $nocContactEmail = 'nocContactEmail1087814656'; - $operationalStatus = 'operationalStatus1274812671'; - $peerIpAddress = 'peerIpAddress-1939747879'; - $provisionedLinkCount = 1199724171; - $remoteLocation = 'remoteLocation1398130574'; - $requestedLinkCount = 1118793211; - $satisfiesPzs = false; - $selfLink = 'selfLink-1691268851'; - $state = 'state109757585'; - $expectedResponse = new Interconnect(); - $expectedResponse->setAaiEnabled($aaiEnabled); - $expectedResponse->setAdminEnabled($adminEnabled); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setCustomerName($customerName); - $expectedResponse->setDescription($description); - $expectedResponse->setGoogleIpAddress($googleIpAddress); - $expectedResponse->setGoogleReferenceId($googleReferenceId); - $expectedResponse->setId($id); - $expectedResponse->setInterconnectType($interconnectType); - $expectedResponse->setKind($kind); - $expectedResponse->setLabelFingerprint($labelFingerprint); - $expectedResponse->setLinkType($linkType); - $expectedResponse->setLocation($location); - $expectedResponse->setMacsecEnabled($macsecEnabled); - $expectedResponse->setName($name); - $expectedResponse->setNocContactEmail($nocContactEmail); - $expectedResponse->setOperationalStatus($operationalStatus); - $expectedResponse->setPeerIpAddress($peerIpAddress); - $expectedResponse->setProvisionedLinkCount($provisionedLinkCount); - $expectedResponse->setRemoteLocation($remoteLocation); - $expectedResponse->setRequestedLinkCount($requestedLinkCount); - $expectedResponse->setSatisfiesPzs($satisfiesPzs); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setState($state); - $transport->addResponse($expectedResponse); - // Mock request - $interconnect = 'interconnect-849140594'; - $project = 'project-309310695'; - $response = $gapicClient->get($interconnect, $project); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Interconnects/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getInterconnect(); - $this->assertProtobufEquals($interconnect, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $interconnect = 'interconnect-849140594'; - $project = 'project-309310695'; - try { - $gapicClient->get($interconnect, $project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getDiagnosticsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new InterconnectsGetDiagnosticsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $interconnect = 'interconnect-849140594'; - $project = 'project-309310695'; - $response = $gapicClient->getDiagnostics($interconnect, $project); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Interconnects/GetDiagnostics', $actualFuncCall); - $actualValue = $actualRequestObject->getInterconnect(); - $this->assertProtobufEquals($interconnect, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getDiagnosticsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $interconnect = 'interconnect-849140594'; - $project = 'project-309310695'; - try { - $gapicClient->getDiagnostics($interconnect, $project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getMacsecConfigTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $etag = 'etag3123477'; - $expectedResponse = new InterconnectsGetMacsecConfigResponse(); - $expectedResponse->setEtag($etag); - $transport->addResponse($expectedResponse); - // Mock request - $interconnect = 'interconnect-849140594'; - $project = 'project-309310695'; - $response = $gapicClient->getMacsecConfig($interconnect, $project); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Interconnects/GetMacsecConfig', $actualFuncCall); - $actualValue = $actualRequestObject->getInterconnect(); - $this->assertProtobufEquals($interconnect, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getMacsecConfigExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $interconnect = 'interconnect-849140594'; - $project = 'project-309310695'; - try { - $gapicClient->getMacsecConfig($interconnect, $project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $interconnectResource = new Interconnect(); - $project = 'project-309310695'; - $response = $gapicClient->insert($interconnectResource, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.Interconnects/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInterconnectResource(); - $this->assertProtobufEquals($interconnectResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $interconnectResource = new Interconnect(); - $project = 'project-309310695'; - $response = $gapicClient->insert($interconnectResource, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new Interconnect(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new InterconnectList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->list($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Interconnects/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->list($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function patchTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/patchTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $interconnect = 'interconnect-849140594'; - $interconnectResource = new Interconnect(); - $project = 'project-309310695'; - $response = $gapicClient->patch($interconnect, $interconnectResource, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.Interconnects/Patch', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInterconnect(); - $this->assertProtobufEquals($interconnect, $actualValue); - $actualValue = $actualApiRequestObject->getInterconnectResource(); - $this->assertProtobufEquals($interconnectResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function patchExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $interconnect = 'interconnect-849140594'; - $interconnectResource = new Interconnect(); - $project = 'project-309310695'; - $response = $gapicClient->patch($interconnect, $interconnectResource, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 setLabelsTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setLabelsTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/setLabelsTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $globalSetLabelsRequestResource = new GlobalSetLabelsRequest(); - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $response = $gapicClient->setLabels($globalSetLabelsRequestResource, $project, $resource); - $this->assertFalse($response->isDone()); - $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.compute.v1.Interconnects/SetLabels', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getGlobalSetLabelsRequestResource(); - $this->assertProtobufEquals($globalSetLabelsRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setLabelsExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setLabelsExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $globalSetLabelsRequestResource = new GlobalSetLabelsRequest(); - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $response = $gapicClient->setLabels($globalSetLabelsRequestResource, $project, $resource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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/Compute/tests/Unit/V1/LicenseCodesClientTest.php b/Compute/tests/Unit/V1/LicenseCodesClientTest.php deleted file mode 100644 index 9aac11837615..000000000000 --- a/Compute/tests/Unit/V1/LicenseCodesClientTest.php +++ /dev/null @@ -1,207 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return LicenseCodesClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new LicenseCodesClient($options); - } - - /** @test */ - public function getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $id = 3355; - $kind = 'kind3292052'; - $name = 'name3373707'; - $selfLink = 'selfLink-1691268851'; - $state = 'state109757585'; - $transferable = false; - $expectedResponse = new LicenseCode(); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setName($name); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setState($state); - $expectedResponse->setTransferable($transferable); - $transport->addResponse($expectedResponse); - // Mock request - $licenseCode = 'licenseCode1612079915'; - $project = 'project-309310695'; - $response = $gapicClient->get($licenseCode, $project); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.LicenseCodes/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getLicenseCode(); - $this->assertProtobufEquals($licenseCode, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $licenseCode = 'licenseCode1612079915'; - $project = 'project-309310695'; - try { - $gapicClient->get($licenseCode, $project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $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 TestPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $testPermissionsRequestResource = new TestPermissionsRequest(); - $response = $gapicClient->testIamPermissions($project, $resource, $testPermissionsRequestResource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.LicenseCodes/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getTestPermissionsRequestResource(); - $this->assertProtobufEquals($testPermissionsRequestResource, $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 - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $testPermissionsRequestResource = new TestPermissionsRequest(); - try { - $gapicClient->testIamPermissions($project, $resource, $testPermissionsRequestResource); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->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/Compute/tests/Unit/V1/LicensesClientTest.php b/Compute/tests/Unit/V1/LicensesClientTest.php deleted file mode 100644 index 63615276c183..000000000000 --- a/Compute/tests/Unit/V1/LicensesClientTest.php +++ /dev/null @@ -1,788 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return LicensesClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new LicensesClient($options); - } - - /** @test */ - public function deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $license = 'license166757441'; - $project = 'project-309310695'; - $response = $gapicClient->delete($license, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.Licenses/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getLicense(); - $this->assertProtobufEquals($license, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $license = 'license166757441'; - $project = 'project-309310695'; - $response = $gapicClient->delete($license, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $appendableToDisk = true; - $chargesUseFee = true; - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $id = 3355; - $kind = 'kind3292052'; - $licenseCode = 1612079915; - $multiTenantOnly = false; - $name = 'name3373707'; - $osLicense = true; - $removableFromDisk = true; - $selfLink = 'selfLink-1691268851'; - $selfLinkWithId = 'selfLinkWithId-1029220862'; - $soleTenantOnly = false; - $transferable = false; - $updateTimestamp = 'updateTimestamp-415976160'; - $expectedResponse = new License(); - $expectedResponse->setAppendableToDisk($appendableToDisk); - $expectedResponse->setChargesUseFee($chargesUseFee); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setLicenseCode($licenseCode); - $expectedResponse->setMultiTenantOnly($multiTenantOnly); - $expectedResponse->setName($name); - $expectedResponse->setOsLicense($osLicense); - $expectedResponse->setRemovableFromDisk($removableFromDisk); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setSelfLinkWithId($selfLinkWithId); - $expectedResponse->setSoleTenantOnly($soleTenantOnly); - $expectedResponse->setTransferable($transferable); - $expectedResponse->setUpdateTimestamp($updateTimestamp); - $transport->addResponse($expectedResponse); - // Mock request - $license = 'license166757441'; - $project = 'project-309310695'; - $response = $gapicClient->get($license, $project); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Licenses/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getLicense(); - $this->assertProtobufEquals($license, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $license = 'license166757441'; - $project = 'project-309310695'; - try { - $gapicClient->get($license, $project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $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 - $etag = 'etag3123477'; - $iamOwned = false; - $version = 351608024; - $expectedResponse = new Policy(); - $expectedResponse->setEtag($etag); - $expectedResponse->setIamOwned($iamOwned); - $expectedResponse->setVersion($version); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $response = $gapicClient->getIamPolicy($project, $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.compute.v1.Licenses/GetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $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 - $project = 'project-309310695'; - $resource = 'resource-341064690'; - try { - $gapicClient->getIamPolicy($project, $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 insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $licenseResource = new License(); - $project = 'project-309310695'; - $response = $gapicClient->insert($licenseResource, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.Licenses/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getLicenseResource(); - $this->assertProtobufEquals($licenseResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $licenseResource = new License(); - $project = 'project-309310695'; - $response = $gapicClient->insert($licenseResource, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new License(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new LicensesListResponse(); - $expectedResponse->setId($id); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->list($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Licenses/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->list($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $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 - $etag = 'etag3123477'; - $iamOwned = false; - $version = 351608024; - $expectedResponse = new Policy(); - $expectedResponse->setEtag($etag); - $expectedResponse->setIamOwned($iamOwned); - $expectedResponse->setVersion($version); - $transport->addResponse($expectedResponse); - // Mock request - $globalSetPolicyRequestResource = new GlobalSetPolicyRequest(); - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $response = $gapicClient->setIamPolicy($globalSetPolicyRequestResource, $project, $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.compute.v1.Licenses/SetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getGlobalSetPolicyRequestResource(); - $this->assertProtobufEquals($globalSetPolicyRequestResource, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $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 - $globalSetPolicyRequestResource = new GlobalSetPolicyRequest(); - $project = 'project-309310695'; - $resource = 'resource-341064690'; - try { - $gapicClient->setIamPolicy($globalSetPolicyRequestResource, $project, $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 testIamPermissionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new TestPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $testPermissionsRequestResource = new TestPermissionsRequest(); - $response = $gapicClient->testIamPermissions($project, $resource, $testPermissionsRequestResource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Licenses/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getTestPermissionsRequestResource(); - $this->assertProtobufEquals($testPermissionsRequestResource, $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 - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $testPermissionsRequestResource = new TestPermissionsRequest(); - try { - $gapicClient->testIamPermissions($project, $resource, $testPermissionsRequestResource); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/updateTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/updateTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $license = 'license166757441'; - $licenseResource = new License(); - $project = 'project-309310695'; - $response = $gapicClient->update($license, $licenseResource, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.Licenses/Update', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getLicense(); - $this->assertProtobufEquals($license, $actualValue); - $actualValue = $actualApiRequestObject->getLicenseResource(); - $this->assertProtobufEquals($licenseResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function updateExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/updateExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $license = 'license166757441'; - $licenseResource = new License(); - $project = 'project-309310695'; - $response = $gapicClient->update($license, $licenseResource, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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/Compute/tests/Unit/V1/MachineImagesClientTest.php b/Compute/tests/Unit/V1/MachineImagesClientTest.php deleted file mode 100644 index 9e71eea3f05e..000000000000 --- a/Compute/tests/Unit/V1/MachineImagesClientTest.php +++ /dev/null @@ -1,785 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return MachineImagesClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new MachineImagesClient($options); - } - - /** @test */ - public function deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $machineImage = 'machineImage1142931299'; - $project = 'project-309310695'; - $response = $gapicClient->delete($machineImage, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.MachineImages/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getMachineImage(); - $this->assertProtobufEquals($machineImage, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $machineImage = 'machineImage1142931299'; - $project = 'project-309310695'; - $response = $gapicClient->delete($machineImage, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $guestFlush = false; - $id = 3355; - $kind = 'kind3292052'; - $labelFingerprint = 'labelFingerprint714995737'; - $name = 'name3373707'; - $satisfiesPzi = false; - $satisfiesPzs = false; - $selfLink = 'selfLink-1691268851'; - $sourceInstance = 'sourceInstance-677426119'; - $status = 'status-892481550'; - $totalStorageBytes = 1528757268; - $expectedResponse = new MachineImage(); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setGuestFlush($guestFlush); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setLabelFingerprint($labelFingerprint); - $expectedResponse->setName($name); - $expectedResponse->setSatisfiesPzi($satisfiesPzi); - $expectedResponse->setSatisfiesPzs($satisfiesPzs); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setSourceInstance($sourceInstance); - $expectedResponse->setStatus($status); - $expectedResponse->setTotalStorageBytes($totalStorageBytes); - $transport->addResponse($expectedResponse); - // Mock request - $machineImage = 'machineImage1142931299'; - $project = 'project-309310695'; - $response = $gapicClient->get($machineImage, $project); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.MachineImages/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getMachineImage(); - $this->assertProtobufEquals($machineImage, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $machineImage = 'machineImage1142931299'; - $project = 'project-309310695'; - try { - $gapicClient->get($machineImage, $project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $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 - $etag = 'etag3123477'; - $iamOwned = false; - $version = 351608024; - $expectedResponse = new Policy(); - $expectedResponse->setEtag($etag); - $expectedResponse->setIamOwned($iamOwned); - $expectedResponse->setVersion($version); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $response = $gapicClient->getIamPolicy($project, $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.compute.v1.MachineImages/GetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $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 - $project = 'project-309310695'; - $resource = 'resource-341064690'; - try { - $gapicClient->getIamPolicy($project, $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 insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $machineImageResource = new MachineImage(); - $project = 'project-309310695'; - $response = $gapicClient->insert($machineImageResource, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.MachineImages/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getMachineImageResource(); - $this->assertProtobufEquals($machineImageResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $machineImageResource = new MachineImage(); - $project = 'project-309310695'; - $response = $gapicClient->insert($machineImageResource, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new MachineImage(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new MachineImageList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->list($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.MachineImages/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->list($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $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 - $etag = 'etag3123477'; - $iamOwned = false; - $version = 351608024; - $expectedResponse = new Policy(); - $expectedResponse->setEtag($etag); - $expectedResponse->setIamOwned($iamOwned); - $expectedResponse->setVersion($version); - $transport->addResponse($expectedResponse); - // Mock request - $globalSetPolicyRequestResource = new GlobalSetPolicyRequest(); - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $response = $gapicClient->setIamPolicy($globalSetPolicyRequestResource, $project, $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.compute.v1.MachineImages/SetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getGlobalSetPolicyRequestResource(); - $this->assertProtobufEquals($globalSetPolicyRequestResource, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $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 - $globalSetPolicyRequestResource = new GlobalSetPolicyRequest(); - $project = 'project-309310695'; - $resource = 'resource-341064690'; - try { - $gapicClient->setIamPolicy($globalSetPolicyRequestResource, $project, $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 setLabelsTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setLabelsTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/setLabelsTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $globalSetLabelsRequestResource = new GlobalSetLabelsRequest(); - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $response = $gapicClient->setLabels($globalSetLabelsRequestResource, $project, $resource); - $this->assertFalse($response->isDone()); - $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.compute.v1.MachineImages/SetLabels', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getGlobalSetLabelsRequestResource(); - $this->assertProtobufEquals($globalSetLabelsRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setLabelsExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setLabelsExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $globalSetLabelsRequestResource = new GlobalSetLabelsRequest(); - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $response = $gapicClient->setLabels($globalSetLabelsRequestResource, $project, $resource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 testIamPermissionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new TestPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $testPermissionsRequestResource = new TestPermissionsRequest(); - $response = $gapicClient->testIamPermissions($project, $resource, $testPermissionsRequestResource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.MachineImages/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getTestPermissionsRequestResource(); - $this->assertProtobufEquals($testPermissionsRequestResource, $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 - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $testPermissionsRequestResource = new TestPermissionsRequest(); - try { - $gapicClient->testIamPermissions($project, $resource, $testPermissionsRequestResource); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->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/Compute/tests/Unit/V1/MachineTypesClientTest.php b/Compute/tests/Unit/V1/MachineTypesClientTest.php deleted file mode 100644 index 4e9136c06077..000000000000 --- a/Compute/tests/Unit/V1/MachineTypesClientTest.php +++ /dev/null @@ -1,311 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return MachineTypesClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new MachineTypesClient($options); - } - - /** @test */ - public function aggregatedListTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $items = [ - 'itemsKey' => new MachineTypesScopedList(), - ]; - $expectedResponse = new MachineTypeAggregatedList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->aggregatedList($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertArrayHasKey('itemsKey', $expectedResponse->getItems()); - $this->assertArrayHasKey('itemsKey', $resources); - $this->assertEquals($expectedResponse->getItems()['itemsKey'], $resources['itemsKey']); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.MachineTypes/AggregatedList', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function aggregatedListExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->aggregatedList($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $architecture = 'architecture839674195'; - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $guestCpus = 1754126894; - $id = 3355; - $imageSpaceGb = 461539048; - $isSharedCpu = false; - $kind = 'kind3292052'; - $maximumPersistentDisks = 1033091853; - $maximumPersistentDisksSizeGb = 1993209177; - $memoryMb = 1726613907; - $name = 'name3373707'; - $selfLink = 'selfLink-1691268851'; - $zone2 = 'zone2-696322977'; - $expectedResponse = new MachineType(); - $expectedResponse->setArchitecture($architecture); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setGuestCpus($guestCpus); - $expectedResponse->setId($id); - $expectedResponse->setImageSpaceGb($imageSpaceGb); - $expectedResponse->setIsSharedCpu($isSharedCpu); - $expectedResponse->setKind($kind); - $expectedResponse->setMaximumPersistentDisks($maximumPersistentDisks); - $expectedResponse->setMaximumPersistentDisksSizeGb($maximumPersistentDisksSizeGb); - $expectedResponse->setMemoryMb($memoryMb); - $expectedResponse->setName($name); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setZone($zone2); - $transport->addResponse($expectedResponse); - // Mock request - $machineType = 'machineType1838323762'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->get($machineType, $project, $zone); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.MachineTypes/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getMachineType(); - $this->assertProtobufEquals($machineType, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $machineType = 'machineType1838323762'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - try { - $gapicClient->get($machineType, $project, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new MachineType(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new MachineTypeList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->list($project, $zone); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.MachineTypes/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $zone = 'zone3744684'; - try { - $gapicClient->list($project, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->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/Compute/tests/Unit/V1/NetworkAttachmentsClientTest.php b/Compute/tests/Unit/V1/NetworkAttachmentsClientTest.php deleted file mode 100644 index 9a3a44bd3f85..000000000000 --- a/Compute/tests/Unit/V1/NetworkAttachmentsClientTest.php +++ /dev/null @@ -1,892 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return NetworkAttachmentsClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new NetworkAttachmentsClient($options); - } - - /** @test */ - public function aggregatedListTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $items = [ - 'itemsKey' => new NetworkAttachmentsScopedList(), - ]; - $expectedResponse = new NetworkAttachmentAggregatedList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->aggregatedList($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertArrayHasKey('itemsKey', $expectedResponse->getItems()); - $this->assertArrayHasKey('itemsKey', $resources); - $this->assertEquals($expectedResponse->getItems()['itemsKey'], $resources['itemsKey']); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.NetworkAttachments/AggregatedList', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function aggregatedListExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->aggregatedList($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $networkAttachment = 'networkAttachment1835256788'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->delete($networkAttachment, $project, $region); - $this->assertFalse($response->isDone()); - $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.compute.v1.NetworkAttachments/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getNetworkAttachment(); - $this->assertProtobufEquals($networkAttachment, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $networkAttachment = 'networkAttachment1835256788'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->delete($networkAttachment, $project, $region); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $connectionPreference = 'connectionPreference822688988'; - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $fingerprint = 'fingerprint-1375934236'; - $id = 3355; - $kind = 'kind3292052'; - $name = 'name3373707'; - $network = 'network1843485230'; - $region2 = 'region2-690338393'; - $selfLink = 'selfLink-1691268851'; - $selfLinkWithId = 'selfLinkWithId-1029220862'; - $expectedResponse = new NetworkAttachment(); - $expectedResponse->setConnectionPreference($connectionPreference); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setFingerprint($fingerprint); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setName($name); - $expectedResponse->setNetwork($network); - $expectedResponse->setRegion($region2); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setSelfLinkWithId($selfLinkWithId); - $transport->addResponse($expectedResponse); - // Mock request - $networkAttachment = 'networkAttachment1835256788'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->get($networkAttachment, $project, $region); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.NetworkAttachments/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getNetworkAttachment(); - $this->assertProtobufEquals($networkAttachment, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $networkAttachment = 'networkAttachment1835256788'; - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->get($networkAttachment, $project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $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 - $etag = 'etag3123477'; - $iamOwned = false; - $version = 351608024; - $expectedResponse = new Policy(); - $expectedResponse->setEtag($etag); - $expectedResponse->setIamOwned($iamOwned); - $expectedResponse->setVersion($version); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $resource = 'resource-341064690'; - $response = $gapicClient->getIamPolicy($project, $region, $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.compute.v1.NetworkAttachments/GetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $resource = 'resource-341064690'; - try { - $gapicClient->getIamPolicy($project, $region, $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 insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $networkAttachmentResource = new NetworkAttachment(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->insert($networkAttachmentResource, $project, $region); - $this->assertFalse($response->isDone()); - $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.compute.v1.NetworkAttachments/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getNetworkAttachmentResource(); - $this->assertProtobufEquals($networkAttachmentResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $networkAttachmentResource = new NetworkAttachment(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->insert($networkAttachmentResource, $project, $region); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new NetworkAttachment(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new NetworkAttachmentList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->list($project, $region); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.NetworkAttachments/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->list($project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function patchTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/patchTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $networkAttachment = 'networkAttachment1835256788'; - $networkAttachmentResource = new NetworkAttachment(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->patch($networkAttachment, $networkAttachmentResource, $project, $region); - $this->assertFalse($response->isDone()); - $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.compute.v1.NetworkAttachments/Patch', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getNetworkAttachment(); - $this->assertProtobufEquals($networkAttachment, $actualValue); - $actualValue = $actualApiRequestObject->getNetworkAttachmentResource(); - $this->assertProtobufEquals($networkAttachmentResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function patchExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $networkAttachment = 'networkAttachment1835256788'; - $networkAttachmentResource = new NetworkAttachment(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->patch($networkAttachment, $networkAttachmentResource, $project, $region); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 - $etag = 'etag3123477'; - $iamOwned = false; - $version = 351608024; - $expectedResponse = new Policy(); - $expectedResponse->setEtag($etag); - $expectedResponse->setIamOwned($iamOwned); - $expectedResponse->setVersion($version); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionSetPolicyRequestResource = new RegionSetPolicyRequest(); - $resource = 'resource-341064690'; - $response = $gapicClient->setIamPolicy($project, $region, $regionSetPolicyRequestResource, $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.compute.v1.NetworkAttachments/SetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualRequestObject->getRegionSetPolicyRequestResource(); - $this->assertProtobufEquals($regionSetPolicyRequestResource, $actualValue); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionSetPolicyRequestResource = new RegionSetPolicyRequest(); - $resource = 'resource-341064690'; - try { - $gapicClient->setIamPolicy($project, $region, $regionSetPolicyRequestResource, $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 testIamPermissionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new TestPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $resource = 'resource-341064690'; - $testPermissionsRequestResource = new TestPermissionsRequest(); - $response = $gapicClient->testIamPermissions($project, $region, $resource, $testPermissionsRequestResource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.NetworkAttachments/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getTestPermissionsRequestResource(); - $this->assertProtobufEquals($testPermissionsRequestResource, $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $resource = 'resource-341064690'; - $testPermissionsRequestResource = new TestPermissionsRequest(); - try { - $gapicClient->testIamPermissions($project, $region, $resource, $testPermissionsRequestResource); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->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/Compute/tests/Unit/V1/NetworkEdgeSecurityServicesClientTest.php b/Compute/tests/Unit/V1/NetworkEdgeSecurityServicesClientTest.php deleted file mode 100644 index 7cfffb2ec753..000000000000 --- a/Compute/tests/Unit/V1/NetworkEdgeSecurityServicesClientTest.php +++ /dev/null @@ -1,591 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return NetworkEdgeSecurityServicesClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new NetworkEdgeSecurityServicesClient($options); - } - - /** @test */ - public function aggregatedListTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $etag = 'etag3123477'; - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $items = [ - 'itemsKey' => new NetworkEdgeSecurityServicesScopedList(), - ]; - $expectedResponse = new NetworkEdgeSecurityServiceAggregatedList(); - $expectedResponse->setEtag($etag); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->aggregatedList($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertArrayHasKey('itemsKey', $expectedResponse->getItems()); - $this->assertArrayHasKey('itemsKey', $resources); - $this->assertEquals($expectedResponse->getItems()['itemsKey'], $resources['itemsKey']); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.NetworkEdgeSecurityServices/AggregatedList', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function aggregatedListExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->aggregatedList($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $networkEdgeSecurityService = 'networkEdgeSecurityService693882791'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->delete($networkEdgeSecurityService, $project, $region); - $this->assertFalse($response->isDone()); - $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.compute.v1.NetworkEdgeSecurityServices/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getNetworkEdgeSecurityService(); - $this->assertProtobufEquals($networkEdgeSecurityService, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $networkEdgeSecurityService = 'networkEdgeSecurityService693882791'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->delete($networkEdgeSecurityService, $project, $region); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $fingerprint = 'fingerprint-1375934236'; - $id = 3355; - $kind = 'kind3292052'; - $name = 'name3373707'; - $region2 = 'region2-690338393'; - $securityPolicy = 'securityPolicy1781695249'; - $selfLink = 'selfLink-1691268851'; - $selfLinkWithId = 'selfLinkWithId-1029220862'; - $expectedResponse = new NetworkEdgeSecurityService(); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setFingerprint($fingerprint); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setName($name); - $expectedResponse->setRegion($region2); - $expectedResponse->setSecurityPolicy($securityPolicy); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setSelfLinkWithId($selfLinkWithId); - $transport->addResponse($expectedResponse); - // Mock request - $networkEdgeSecurityService = 'networkEdgeSecurityService693882791'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->get($networkEdgeSecurityService, $project, $region); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.NetworkEdgeSecurityServices/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getNetworkEdgeSecurityService(); - $this->assertProtobufEquals($networkEdgeSecurityService, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $networkEdgeSecurityService = 'networkEdgeSecurityService693882791'; - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->get($networkEdgeSecurityService, $project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $networkEdgeSecurityServiceResource = new NetworkEdgeSecurityService(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->insert($networkEdgeSecurityServiceResource, $project, $region); - $this->assertFalse($response->isDone()); - $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.compute.v1.NetworkEdgeSecurityServices/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getNetworkEdgeSecurityServiceResource(); - $this->assertProtobufEquals($networkEdgeSecurityServiceResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $networkEdgeSecurityServiceResource = new NetworkEdgeSecurityService(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->insert($networkEdgeSecurityServiceResource, $project, $region); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 patchTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/patchTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $networkEdgeSecurityService = 'networkEdgeSecurityService693882791'; - $networkEdgeSecurityServiceResource = new NetworkEdgeSecurityService(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->patch($networkEdgeSecurityService, $networkEdgeSecurityServiceResource, $project, $region); - $this->assertFalse($response->isDone()); - $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.compute.v1.NetworkEdgeSecurityServices/Patch', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getNetworkEdgeSecurityService(); - $this->assertProtobufEquals($networkEdgeSecurityService, $actualValue); - $actualValue = $actualApiRequestObject->getNetworkEdgeSecurityServiceResource(); - $this->assertProtobufEquals($networkEdgeSecurityServiceResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function patchExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $networkEdgeSecurityService = 'networkEdgeSecurityService693882791'; - $networkEdgeSecurityServiceResource = new NetworkEdgeSecurityService(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->patch($networkEdgeSecurityService, $networkEdgeSecurityServiceResource, $project, $region); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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/Compute/tests/Unit/V1/NetworkEndpointGroupsClientTest.php b/Compute/tests/Unit/V1/NetworkEndpointGroupsClientTest.php deleted file mode 100644 index 3fced7ab49f4..000000000000 --- a/Compute/tests/Unit/V1/NetworkEndpointGroupsClientTest.php +++ /dev/null @@ -1,960 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return NetworkEndpointGroupsClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new NetworkEndpointGroupsClient($options); - } - - /** @test */ - public function aggregatedListTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $items = [ - 'itemsKey' => new NetworkEndpointGroupsScopedList(), - ]; - $expectedResponse = new NetworkEndpointGroupAggregatedList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->aggregatedList($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertArrayHasKey('itemsKey', $expectedResponse->getItems()); - $this->assertArrayHasKey('itemsKey', $resources); - $this->assertEquals($expectedResponse->getItems()['itemsKey'], $resources['itemsKey']); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.NetworkEndpointGroups/AggregatedList', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function aggregatedListExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->aggregatedList($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function attachNetworkEndpointsTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/attachNetworkEndpointsTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/attachNetworkEndpointsTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $networkEndpointGroup = 'networkEndpointGroup-639834746'; - $networkEndpointGroupsAttachEndpointsRequestResource = new NetworkEndpointGroupsAttachEndpointsRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->attachNetworkEndpoints($networkEndpointGroup, $networkEndpointGroupsAttachEndpointsRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.NetworkEndpointGroups/AttachNetworkEndpoints', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getNetworkEndpointGroup(); - $this->assertProtobufEquals($networkEndpointGroup, $actualValue); - $actualValue = $actualApiRequestObject->getNetworkEndpointGroupsAttachEndpointsRequestResource(); - $this->assertProtobufEquals($networkEndpointGroupsAttachEndpointsRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function attachNetworkEndpointsExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/attachNetworkEndpointsExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $networkEndpointGroup = 'networkEndpointGroup-639834746'; - $networkEndpointGroupsAttachEndpointsRequestResource = new NetworkEndpointGroupsAttachEndpointsRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->attachNetworkEndpoints($networkEndpointGroup, $networkEndpointGroupsAttachEndpointsRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $networkEndpointGroup = 'networkEndpointGroup-639834746'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->delete($networkEndpointGroup, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.NetworkEndpointGroups/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getNetworkEndpointGroup(); - $this->assertProtobufEquals($networkEndpointGroup, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $networkEndpointGroup = 'networkEndpointGroup-639834746'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->delete($networkEndpointGroup, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 detachNetworkEndpointsTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/detachNetworkEndpointsTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/detachNetworkEndpointsTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $networkEndpointGroup = 'networkEndpointGroup-639834746'; - $networkEndpointGroupsDetachEndpointsRequestResource = new NetworkEndpointGroupsDetachEndpointsRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->detachNetworkEndpoints($networkEndpointGroup, $networkEndpointGroupsDetachEndpointsRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.NetworkEndpointGroups/DetachNetworkEndpoints', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getNetworkEndpointGroup(); - $this->assertProtobufEquals($networkEndpointGroup, $actualValue); - $actualValue = $actualApiRequestObject->getNetworkEndpointGroupsDetachEndpointsRequestResource(); - $this->assertProtobufEquals($networkEndpointGroupsDetachEndpointsRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function detachNetworkEndpointsExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/detachNetworkEndpointsExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $networkEndpointGroup = 'networkEndpointGroup-639834746'; - $networkEndpointGroupsDetachEndpointsRequestResource = new NetworkEndpointGroupsDetachEndpointsRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->detachNetworkEndpoints($networkEndpointGroup, $networkEndpointGroupsDetachEndpointsRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $creationTimestamp = 'creationTimestamp567396278'; - $defaultPort = 650363969; - $description = 'description-1724546052'; - $id = 3355; - $kind = 'kind3292052'; - $name = 'name3373707'; - $network = 'network1843485230'; - $networkEndpointType = 'networkEndpointType118301523'; - $pscTargetService = 'pscTargetService1879744870'; - $region = 'region-934795532'; - $selfLink = 'selfLink-1691268851'; - $size = 3530753; - $subnetwork = 'subnetwork-1302785042'; - $zone2 = 'zone2-696322977'; - $expectedResponse = new NetworkEndpointGroup(); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDefaultPort($defaultPort); - $expectedResponse->setDescription($description); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setName($name); - $expectedResponse->setNetwork($network); - $expectedResponse->setNetworkEndpointType($networkEndpointType); - $expectedResponse->setPscTargetService($pscTargetService); - $expectedResponse->setRegion($region); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setSize($size); - $expectedResponse->setSubnetwork($subnetwork); - $expectedResponse->setZone($zone2); - $transport->addResponse($expectedResponse); - // Mock request - $networkEndpointGroup = 'networkEndpointGroup-639834746'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->get($networkEndpointGroup, $project, $zone); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.NetworkEndpointGroups/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getNetworkEndpointGroup(); - $this->assertProtobufEquals($networkEndpointGroup, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $networkEndpointGroup = 'networkEndpointGroup-639834746'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - try { - $gapicClient->get($networkEndpointGroup, $project, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $networkEndpointGroupResource = new NetworkEndpointGroup(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->insert($networkEndpointGroupResource, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.NetworkEndpointGroups/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getNetworkEndpointGroupResource(); - $this->assertProtobufEquals($networkEndpointGroupResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $networkEndpointGroupResource = new NetworkEndpointGroup(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->insert($networkEndpointGroupResource, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new NetworkEndpointGroup(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new NetworkEndpointGroupList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->list($project, $zone); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.NetworkEndpointGroups/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $zone = 'zone3744684'; - try { - $gapicClient->list($project, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listNetworkEndpointsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $itemsElement = new NetworkEndpointWithHealthStatus(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new NetworkEndpointGroupsListNetworkEndpoints(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $networkEndpointGroup = 'networkEndpointGroup-639834746'; - $networkEndpointGroupsListEndpointsRequestResource = new NetworkEndpointGroupsListEndpointsRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->listNetworkEndpoints($networkEndpointGroup, $networkEndpointGroupsListEndpointsRequestResource, $project, $zone); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.NetworkEndpointGroups/ListNetworkEndpoints', $actualFuncCall); - $actualValue = $actualRequestObject->getNetworkEndpointGroup(); - $this->assertProtobufEquals($networkEndpointGroup, $actualValue); - $actualValue = $actualRequestObject->getNetworkEndpointGroupsListEndpointsRequestResource(); - $this->assertProtobufEquals($networkEndpointGroupsListEndpointsRequestResource, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listNetworkEndpointsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $networkEndpointGroup = 'networkEndpointGroup-639834746'; - $networkEndpointGroupsListEndpointsRequestResource = new NetworkEndpointGroupsListEndpointsRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - try { - $gapicClient->listNetworkEndpoints($networkEndpointGroup, $networkEndpointGroupsListEndpointsRequestResource, $project, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $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 TestPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $testPermissionsRequestResource = new TestPermissionsRequest(); - $zone = 'zone3744684'; - $response = $gapicClient->testIamPermissions($project, $resource, $testPermissionsRequestResource, $zone); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.NetworkEndpointGroups/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getTestPermissionsRequestResource(); - $this->assertProtobufEquals($testPermissionsRequestResource, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $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 - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $testPermissionsRequestResource = new TestPermissionsRequest(); - $zone = 'zone3744684'; - try { - $gapicClient->testIamPermissions($project, $resource, $testPermissionsRequestResource, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->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/Compute/tests/Unit/V1/NetworkFirewallPoliciesClientTest.php b/Compute/tests/Unit/V1/NetworkFirewallPoliciesClientTest.php deleted file mode 100644 index d329ea9f2440..000000000000 --- a/Compute/tests/Unit/V1/NetworkFirewallPoliciesClientTest.php +++ /dev/null @@ -1,2147 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return NetworkFirewallPoliciesClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new NetworkFirewallPoliciesClient($options); - } - - /** @test */ - public function addAssociationTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/addAssociationTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/addAssociationTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $firewallPolicy = 'firewallPolicy1035044177'; - $firewallPolicyAssociationResource = new FirewallPolicyAssociation(); - $project = 'project-309310695'; - $response = $gapicClient->addAssociation($firewallPolicy, $firewallPolicyAssociationResource, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.NetworkFirewallPolicies/AddAssociation', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getFirewallPolicy(); - $this->assertProtobufEquals($firewallPolicy, $actualValue); - $actualValue = $actualApiRequestObject->getFirewallPolicyAssociationResource(); - $this->assertProtobufEquals($firewallPolicyAssociationResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function addAssociationExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/addAssociationExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $firewallPolicy = 'firewallPolicy1035044177'; - $firewallPolicyAssociationResource = new FirewallPolicyAssociation(); - $project = 'project-309310695'; - $response = $gapicClient->addAssociation($firewallPolicy, $firewallPolicyAssociationResource, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 addPacketMirroringRuleTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/addPacketMirroringRuleTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/addPacketMirroringRuleTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $firewallPolicy = 'firewallPolicy1035044177'; - $firewallPolicyRuleResource = new FirewallPolicyRule(); - $project = 'project-309310695'; - $response = $gapicClient->addPacketMirroringRule($firewallPolicy, $firewallPolicyRuleResource, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.NetworkFirewallPolicies/AddPacketMirroringRule', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getFirewallPolicy(); - $this->assertProtobufEquals($firewallPolicy, $actualValue); - $actualValue = $actualApiRequestObject->getFirewallPolicyRuleResource(); - $this->assertProtobufEquals($firewallPolicyRuleResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function addPacketMirroringRuleExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/addPacketMirroringRuleExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $firewallPolicy = 'firewallPolicy1035044177'; - $firewallPolicyRuleResource = new FirewallPolicyRule(); - $project = 'project-309310695'; - $response = $gapicClient->addPacketMirroringRule($firewallPolicy, $firewallPolicyRuleResource, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 addRuleTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/addRuleTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/addRuleTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $firewallPolicy = 'firewallPolicy1035044177'; - $firewallPolicyRuleResource = new FirewallPolicyRule(); - $project = 'project-309310695'; - $response = $gapicClient->addRule($firewallPolicy, $firewallPolicyRuleResource, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.NetworkFirewallPolicies/AddRule', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getFirewallPolicy(); - $this->assertProtobufEquals($firewallPolicy, $actualValue); - $actualValue = $actualApiRequestObject->getFirewallPolicyRuleResource(); - $this->assertProtobufEquals($firewallPolicyRuleResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function addRuleExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/addRuleExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $firewallPolicy = 'firewallPolicy1035044177'; - $firewallPolicyRuleResource = new FirewallPolicyRule(); - $project = 'project-309310695'; - $response = $gapicClient->addRule($firewallPolicy, $firewallPolicyRuleResource, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 aggregatedListTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $items = [ - 'itemsKey' => new FirewallPoliciesScopedList(), - ]; - $expectedResponse = new NetworkFirewallPolicyAggregatedList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->aggregatedList($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertArrayHasKey('itemsKey', $expectedResponse->getItems()); - $this->assertArrayHasKey('itemsKey', $resources); - $this->assertEquals($expectedResponse->getItems()['itemsKey'], $resources['itemsKey']); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.NetworkFirewallPolicies/AggregatedList', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function aggregatedListExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->aggregatedList($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function cloneRulesTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/cloneRulesTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/cloneRulesTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $firewallPolicy = 'firewallPolicy1035044177'; - $project = 'project-309310695'; - $response = $gapicClient->cloneRules($firewallPolicy, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.NetworkFirewallPolicies/CloneRules', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getFirewallPolicy(); - $this->assertProtobufEquals($firewallPolicy, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function cloneRulesExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/cloneRulesExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $firewallPolicy = 'firewallPolicy1035044177'; - $project = 'project-309310695'; - $response = $gapicClient->cloneRules($firewallPolicy, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $firewallPolicy = 'firewallPolicy1035044177'; - $project = 'project-309310695'; - $response = $gapicClient->delete($firewallPolicy, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.NetworkFirewallPolicies/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getFirewallPolicy(); - $this->assertProtobufEquals($firewallPolicy, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $firewallPolicy = 'firewallPolicy1035044177'; - $project = 'project-309310695'; - $response = $gapicClient->delete($firewallPolicy, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $displayName = 'displayName1615086568'; - $fingerprint = 'fingerprint-1375934236'; - $id = 3355; - $kind = 'kind3292052'; - $name = 'name3373707'; - $parent = 'parent-995424086'; - $region = 'region-934795532'; - $ruleTupleCount = 388342037; - $selfLink = 'selfLink-1691268851'; - $selfLinkWithId = 'selfLinkWithId-1029220862'; - $shortName = 'shortName1565793390'; - $expectedResponse = new FirewallPolicy(); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setFingerprint($fingerprint); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setName($name); - $expectedResponse->setParent($parent); - $expectedResponse->setRegion($region); - $expectedResponse->setRuleTupleCount($ruleTupleCount); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setSelfLinkWithId($selfLinkWithId); - $expectedResponse->setShortName($shortName); - $transport->addResponse($expectedResponse); - // Mock request - $firewallPolicy = 'firewallPolicy1035044177'; - $project = 'project-309310695'; - $response = $gapicClient->get($firewallPolicy, $project); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.NetworkFirewallPolicies/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getFirewallPolicy(); - $this->assertProtobufEquals($firewallPolicy, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $firewallPolicy = 'firewallPolicy1035044177'; - $project = 'project-309310695'; - try { - $gapicClient->get($firewallPolicy, $project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getAssociationTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $attachmentTarget = 'attachmentTarget1786386477'; - $displayName = 'displayName1615086568'; - $firewallPolicyId = 'firewallPolicyId1430953673'; - $name2 = 'name2-1052831874'; - $shortName = 'shortName1565793390'; - $expectedResponse = new FirewallPolicyAssociation(); - $expectedResponse->setAttachmentTarget($attachmentTarget); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setFirewallPolicyId($firewallPolicyId); - $expectedResponse->setName($name2); - $expectedResponse->setShortName($shortName); - $transport->addResponse($expectedResponse); - // Mock request - $firewallPolicy = 'firewallPolicy1035044177'; - $project = 'project-309310695'; - $response = $gapicClient->getAssociation($firewallPolicy, $project); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.NetworkFirewallPolicies/GetAssociation', $actualFuncCall); - $actualValue = $actualRequestObject->getFirewallPolicy(); - $this->assertProtobufEquals($firewallPolicy, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getAssociationExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $firewallPolicy = 'firewallPolicy1035044177'; - $project = 'project-309310695'; - try { - $gapicClient->getAssociation($firewallPolicy, $project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $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 - $etag = 'etag3123477'; - $iamOwned = false; - $version = 351608024; - $expectedResponse = new Policy(); - $expectedResponse->setEtag($etag); - $expectedResponse->setIamOwned($iamOwned); - $expectedResponse->setVersion($version); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $response = $gapicClient->getIamPolicy($project, $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.compute.v1.NetworkFirewallPolicies/GetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $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 - $project = 'project-309310695'; - $resource = 'resource-341064690'; - try { - $gapicClient->getIamPolicy($project, $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 getPacketMirroringRuleTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $action = 'action-1422950858'; - $description = 'description-1724546052'; - $direction = 'direction-962590849'; - $disabled = true; - $enableLogging = false; - $kind = 'kind3292052'; - $priority2 = 978365527; - $ruleName = 'ruleName-2092197394'; - $ruleTupleCount = 388342037; - $securityProfileGroup = 'securityProfileGroup-329459286'; - $tlsInspect = true; - $expectedResponse = new FirewallPolicyRule(); - $expectedResponse->setAction($action); - $expectedResponse->setDescription($description); - $expectedResponse->setDirection($direction); - $expectedResponse->setDisabled($disabled); - $expectedResponse->setEnableLogging($enableLogging); - $expectedResponse->setKind($kind); - $expectedResponse->setPriority($priority2); - $expectedResponse->setRuleName($ruleName); - $expectedResponse->setRuleTupleCount($ruleTupleCount); - $expectedResponse->setSecurityProfileGroup($securityProfileGroup); - $expectedResponse->setTlsInspect($tlsInspect); - $transport->addResponse($expectedResponse); - // Mock request - $firewallPolicy = 'firewallPolicy1035044177'; - $project = 'project-309310695'; - $response = $gapicClient->getPacketMirroringRule($firewallPolicy, $project); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.NetworkFirewallPolicies/GetPacketMirroringRule', $actualFuncCall); - $actualValue = $actualRequestObject->getFirewallPolicy(); - $this->assertProtobufEquals($firewallPolicy, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getPacketMirroringRuleExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $firewallPolicy = 'firewallPolicy1035044177'; - $project = 'project-309310695'; - try { - $gapicClient->getPacketMirroringRule($firewallPolicy, $project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getRuleTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $action = 'action-1422950858'; - $description = 'description-1724546052'; - $direction = 'direction-962590849'; - $disabled = true; - $enableLogging = false; - $kind = 'kind3292052'; - $priority2 = 978365527; - $ruleName = 'ruleName-2092197394'; - $ruleTupleCount = 388342037; - $securityProfileGroup = 'securityProfileGroup-329459286'; - $tlsInspect = true; - $expectedResponse = new FirewallPolicyRule(); - $expectedResponse->setAction($action); - $expectedResponse->setDescription($description); - $expectedResponse->setDirection($direction); - $expectedResponse->setDisabled($disabled); - $expectedResponse->setEnableLogging($enableLogging); - $expectedResponse->setKind($kind); - $expectedResponse->setPriority($priority2); - $expectedResponse->setRuleName($ruleName); - $expectedResponse->setRuleTupleCount($ruleTupleCount); - $expectedResponse->setSecurityProfileGroup($securityProfileGroup); - $expectedResponse->setTlsInspect($tlsInspect); - $transport->addResponse($expectedResponse); - // Mock request - $firewallPolicy = 'firewallPolicy1035044177'; - $project = 'project-309310695'; - $response = $gapicClient->getRule($firewallPolicy, $project); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.NetworkFirewallPolicies/GetRule', $actualFuncCall); - $actualValue = $actualRequestObject->getFirewallPolicy(); - $this->assertProtobufEquals($firewallPolicy, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getRuleExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $firewallPolicy = 'firewallPolicy1035044177'; - $project = 'project-309310695'; - try { - $gapicClient->getRule($firewallPolicy, $project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $firewallPolicyResource = new FirewallPolicy(); - $project = 'project-309310695'; - $response = $gapicClient->insert($firewallPolicyResource, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.NetworkFirewallPolicies/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getFirewallPolicyResource(); - $this->assertProtobufEquals($firewallPolicyResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $firewallPolicyResource = new FirewallPolicy(); - $project = 'project-309310695'; - $response = $gapicClient->insert($firewallPolicyResource, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $itemsElement = new FirewallPolicy(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new FirewallPolicyList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->list($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.NetworkFirewallPolicies/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->list($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function patchTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/patchTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $firewallPolicy = 'firewallPolicy1035044177'; - $firewallPolicyResource = new FirewallPolicy(); - $project = 'project-309310695'; - $response = $gapicClient->patch($firewallPolicy, $firewallPolicyResource, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.NetworkFirewallPolicies/Patch', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getFirewallPolicy(); - $this->assertProtobufEquals($firewallPolicy, $actualValue); - $actualValue = $actualApiRequestObject->getFirewallPolicyResource(); - $this->assertProtobufEquals($firewallPolicyResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function patchExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $firewallPolicy = 'firewallPolicy1035044177'; - $firewallPolicyResource = new FirewallPolicy(); - $project = 'project-309310695'; - $response = $gapicClient->patch($firewallPolicy, $firewallPolicyResource, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 patchPacketMirroringRuleTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchPacketMirroringRuleTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/patchPacketMirroringRuleTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $firewallPolicy = 'firewallPolicy1035044177'; - $firewallPolicyRuleResource = new FirewallPolicyRule(); - $project = 'project-309310695'; - $response = $gapicClient->patchPacketMirroringRule($firewallPolicy, $firewallPolicyRuleResource, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.NetworkFirewallPolicies/PatchPacketMirroringRule', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getFirewallPolicy(); - $this->assertProtobufEquals($firewallPolicy, $actualValue); - $actualValue = $actualApiRequestObject->getFirewallPolicyRuleResource(); - $this->assertProtobufEquals($firewallPolicyRuleResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function patchPacketMirroringRuleExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchPacketMirroringRuleExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $firewallPolicy = 'firewallPolicy1035044177'; - $firewallPolicyRuleResource = new FirewallPolicyRule(); - $project = 'project-309310695'; - $response = $gapicClient->patchPacketMirroringRule($firewallPolicy, $firewallPolicyRuleResource, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 patchRuleTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchRuleTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/patchRuleTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $firewallPolicy = 'firewallPolicy1035044177'; - $firewallPolicyRuleResource = new FirewallPolicyRule(); - $project = 'project-309310695'; - $response = $gapicClient->patchRule($firewallPolicy, $firewallPolicyRuleResource, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.NetworkFirewallPolicies/PatchRule', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getFirewallPolicy(); - $this->assertProtobufEquals($firewallPolicy, $actualValue); - $actualValue = $actualApiRequestObject->getFirewallPolicyRuleResource(); - $this->assertProtobufEquals($firewallPolicyRuleResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function patchRuleExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchRuleExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $firewallPolicy = 'firewallPolicy1035044177'; - $firewallPolicyRuleResource = new FirewallPolicyRule(); - $project = 'project-309310695'; - $response = $gapicClient->patchRule($firewallPolicy, $firewallPolicyRuleResource, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 removeAssociationTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/removeAssociationTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/removeAssociationTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $firewallPolicy = 'firewallPolicy1035044177'; - $project = 'project-309310695'; - $response = $gapicClient->removeAssociation($firewallPolicy, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.NetworkFirewallPolicies/RemoveAssociation', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getFirewallPolicy(); - $this->assertProtobufEquals($firewallPolicy, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function removeAssociationExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/removeAssociationExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $firewallPolicy = 'firewallPolicy1035044177'; - $project = 'project-309310695'; - $response = $gapicClient->removeAssociation($firewallPolicy, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 removePacketMirroringRuleTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/removePacketMirroringRuleTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/removePacketMirroringRuleTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $firewallPolicy = 'firewallPolicy1035044177'; - $project = 'project-309310695'; - $response = $gapicClient->removePacketMirroringRule($firewallPolicy, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.NetworkFirewallPolicies/RemovePacketMirroringRule', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getFirewallPolicy(); - $this->assertProtobufEquals($firewallPolicy, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function removePacketMirroringRuleExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/removePacketMirroringRuleExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $firewallPolicy = 'firewallPolicy1035044177'; - $project = 'project-309310695'; - $response = $gapicClient->removePacketMirroringRule($firewallPolicy, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 removeRuleTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/removeRuleTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/removeRuleTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $firewallPolicy = 'firewallPolicy1035044177'; - $project = 'project-309310695'; - $response = $gapicClient->removeRule($firewallPolicy, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.NetworkFirewallPolicies/RemoveRule', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getFirewallPolicy(); - $this->assertProtobufEquals($firewallPolicy, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function removeRuleExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/removeRuleExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $firewallPolicy = 'firewallPolicy1035044177'; - $project = 'project-309310695'; - $response = $gapicClient->removeRule($firewallPolicy, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 - $etag = 'etag3123477'; - $iamOwned = false; - $version = 351608024; - $expectedResponse = new Policy(); - $expectedResponse->setEtag($etag); - $expectedResponse->setIamOwned($iamOwned); - $expectedResponse->setVersion($version); - $transport->addResponse($expectedResponse); - // Mock request - $globalSetPolicyRequestResource = new GlobalSetPolicyRequest(); - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $response = $gapicClient->setIamPolicy($globalSetPolicyRequestResource, $project, $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.compute.v1.NetworkFirewallPolicies/SetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getGlobalSetPolicyRequestResource(); - $this->assertProtobufEquals($globalSetPolicyRequestResource, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $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 - $globalSetPolicyRequestResource = new GlobalSetPolicyRequest(); - $project = 'project-309310695'; - $resource = 'resource-341064690'; - try { - $gapicClient->setIamPolicy($globalSetPolicyRequestResource, $project, $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 testIamPermissionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new TestPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $testPermissionsRequestResource = new TestPermissionsRequest(); - $response = $gapicClient->testIamPermissions($project, $resource, $testPermissionsRequestResource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.NetworkFirewallPolicies/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getTestPermissionsRequestResource(); - $this->assertProtobufEquals($testPermissionsRequestResource, $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 - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $testPermissionsRequestResource = new TestPermissionsRequest(); - try { - $gapicClient->testIamPermissions($project, $resource, $testPermissionsRequestResource); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->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/Compute/tests/Unit/V1/NetworkProfilesClientTest.php b/Compute/tests/Unit/V1/NetworkProfilesClientTest.php deleted file mode 100644 index 88ee02cd42b4..000000000000 --- a/Compute/tests/Unit/V1/NetworkProfilesClientTest.php +++ /dev/null @@ -1,208 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return NetworkProfilesClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new NetworkProfilesClient($options); - } - - /** @test */ - public function getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $id = 3355; - $kind = 'kind3292052'; - $name = 'name3373707'; - $selfLink = 'selfLink-1691268851'; - $selfLinkWithId = 'selfLinkWithId-1029220862'; - $zone = 'zone3744684'; - $expectedResponse = new NetworkProfile(); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setName($name); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setSelfLinkWithId($selfLinkWithId); - $expectedResponse->setZone($zone); - $transport->addResponse($expectedResponse); - // Mock request - $networkProfile = 'networkProfile709983384'; - $project = 'project-309310695'; - $response = $gapicClient->get($networkProfile, $project); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.NetworkProfiles/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getNetworkProfile(); - $this->assertProtobufEquals($networkProfile, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $networkProfile = 'networkProfile709983384'; - $project = 'project-309310695'; - try { - $gapicClient->get($networkProfile, $project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $etag = 'etag3123477'; - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = 'nextPageToken-1530815211'; - $selfLink = 'selfLink-1691268851'; - $expectedResponse = new NetworkProfilesListResponse(); - $expectedResponse->setEtag($etag); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->list($project); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.NetworkProfiles/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->list($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->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/Compute/tests/Unit/V1/NetworksClientTest.php b/Compute/tests/Unit/V1/NetworksClientTest.php deleted file mode 100644 index 931205cdd090..000000000000 --- a/Compute/tests/Unit/V1/NetworksClientTest.php +++ /dev/null @@ -1,1313 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return NetworksClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new NetworksClient($options); - } - - /** @test */ - public function addPeeringTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/addPeeringTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/addPeeringTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $network = 'network1843485230'; - $networksAddPeeringRequestResource = new NetworksAddPeeringRequest(); - $project = 'project-309310695'; - $response = $gapicClient->addPeering($network, $networksAddPeeringRequestResource, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.Networks/AddPeering', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getNetwork(); - $this->assertProtobufEquals($network, $actualValue); - $actualValue = $actualApiRequestObject->getNetworksAddPeeringRequestResource(); - $this->assertProtobufEquals($networksAddPeeringRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function addPeeringExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/addPeeringExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $network = 'network1843485230'; - $networksAddPeeringRequestResource = new NetworksAddPeeringRequest(); - $project = 'project-309310695'; - $response = $gapicClient->addPeering($network, $networksAddPeeringRequestResource, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $network = 'network1843485230'; - $project = 'project-309310695'; - $response = $gapicClient->delete($network, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.Networks/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getNetwork(); - $this->assertProtobufEquals($network, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $network = 'network1843485230'; - $project = 'project-309310695'; - $response = $gapicClient->delete($network, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $iPv4Range = 'iPv4Range1132976182'; - $autoCreateSubnetworks = true; - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $enableUlaInternalIpv6 = true; - $firewallPolicy = 'firewallPolicy1035044177'; - $gatewayIPv4 = 'gatewayIPv4-1431933859'; - $id = 3355; - $internalIpv6Range = 'internalIpv6Range277456807'; - $kind = 'kind3292052'; - $mtu = 108462; - $name = 'name3373707'; - $networkFirewallPolicyEnforcementOrder = 'networkFirewallPolicyEnforcementOrder1617117520'; - $networkProfile = 'networkProfile709983384'; - $selfLink = 'selfLink-1691268851'; - $selfLinkWithId = 'selfLinkWithId-1029220862'; - $expectedResponse = new Network(); - $expectedResponse->setIPv4Range($iPv4Range); - $expectedResponse->setAutoCreateSubnetworks($autoCreateSubnetworks); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setEnableUlaInternalIpv6($enableUlaInternalIpv6); - $expectedResponse->setFirewallPolicy($firewallPolicy); - $expectedResponse->setGatewayIPv4($gatewayIPv4); - $expectedResponse->setId($id); - $expectedResponse->setInternalIpv6Range($internalIpv6Range); - $expectedResponse->setKind($kind); - $expectedResponse->setMtu($mtu); - $expectedResponse->setName($name); - $expectedResponse->setNetworkFirewallPolicyEnforcementOrder($networkFirewallPolicyEnforcementOrder); - $expectedResponse->setNetworkProfile($networkProfile); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setSelfLinkWithId($selfLinkWithId); - $transport->addResponse($expectedResponse); - // Mock request - $network = 'network1843485230'; - $project = 'project-309310695'; - $response = $gapicClient->get($network, $project); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Networks/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getNetwork(); - $this->assertProtobufEquals($network, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $network = 'network1843485230'; - $project = 'project-309310695'; - try { - $gapicClient->get($network, $project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getEffectiveFirewallsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new NetworksGetEffectiveFirewallsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $network = 'network1843485230'; - $project = 'project-309310695'; - $response = $gapicClient->getEffectiveFirewalls($network, $project); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Networks/GetEffectiveFirewalls', $actualFuncCall); - $actualValue = $actualRequestObject->getNetwork(); - $this->assertProtobufEquals($network, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getEffectiveFirewallsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $network = 'network1843485230'; - $project = 'project-309310695'; - try { - $gapicClient->getEffectiveFirewalls($network, $project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $networkResource = new Network(); - $project = 'project-309310695'; - $response = $gapicClient->insert($networkResource, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.Networks/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getNetworkResource(); - $this->assertProtobufEquals($networkResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $networkResource = new Network(); - $project = 'project-309310695'; - $response = $gapicClient->insert($networkResource, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new Network(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new NetworkList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->list($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Networks/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->list($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $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 - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new ExchangedPeeringRoute(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new ExchangedPeeringRoutesList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $network = 'network1843485230'; - $project = 'project-309310695'; - $response = $gapicClient->listPeeringRoutes($network, $project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Networks/ListPeeringRoutes', $actualFuncCall); - $actualValue = $actualRequestObject->getNetwork(); - $this->assertProtobufEquals($network, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $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 - $network = 'network1843485230'; - $project = 'project-309310695'; - try { - $gapicClient->listPeeringRoutes($network, $project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function patchTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/patchTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $network = 'network1843485230'; - $networkResource = new Network(); - $project = 'project-309310695'; - $response = $gapicClient->patch($network, $networkResource, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.Networks/Patch', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getNetwork(); - $this->assertProtobufEquals($network, $actualValue); - $actualValue = $actualApiRequestObject->getNetworkResource(); - $this->assertProtobufEquals($networkResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function patchExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $network = 'network1843485230'; - $networkResource = new Network(); - $project = 'project-309310695'; - $response = $gapicClient->patch($network, $networkResource, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 removePeeringTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/removePeeringTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/removePeeringTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $network = 'network1843485230'; - $networksRemovePeeringRequestResource = new NetworksRemovePeeringRequest(); - $project = 'project-309310695'; - $response = $gapicClient->removePeering($network, $networksRemovePeeringRequestResource, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.Networks/RemovePeering', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getNetwork(); - $this->assertProtobufEquals($network, $actualValue); - $actualValue = $actualApiRequestObject->getNetworksRemovePeeringRequestResource(); - $this->assertProtobufEquals($networksRemovePeeringRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function removePeeringExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/removePeeringExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $network = 'network1843485230'; - $networksRemovePeeringRequestResource = new NetworksRemovePeeringRequest(); - $project = 'project-309310695'; - $response = $gapicClient->removePeering($network, $networksRemovePeeringRequestResource, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 requestRemovePeeringTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/requestRemovePeeringTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/requestRemovePeeringTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $network = 'network1843485230'; - $networksRequestRemovePeeringRequestResource = new NetworksRequestRemovePeeringRequest(); - $project = 'project-309310695'; - $response = $gapicClient->requestRemovePeering($network, $networksRequestRemovePeeringRequestResource, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.Networks/RequestRemovePeering', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getNetwork(); - $this->assertProtobufEquals($network, $actualValue); - $actualValue = $actualApiRequestObject->getNetworksRequestRemovePeeringRequestResource(); - $this->assertProtobufEquals($networksRequestRemovePeeringRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function requestRemovePeeringExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/requestRemovePeeringExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $network = 'network1843485230'; - $networksRequestRemovePeeringRequestResource = new NetworksRequestRemovePeeringRequest(); - $project = 'project-309310695'; - $response = $gapicClient->requestRemovePeering($network, $networksRequestRemovePeeringRequestResource, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 switchToCustomModeTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/switchToCustomModeTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/switchToCustomModeTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $network = 'network1843485230'; - $project = 'project-309310695'; - $response = $gapicClient->switchToCustomMode($network, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.Networks/SwitchToCustomMode', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getNetwork(); - $this->assertProtobufEquals($network, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function switchToCustomModeExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/switchToCustomModeExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $network = 'network1843485230'; - $project = 'project-309310695'; - $response = $gapicClient->switchToCustomMode($network, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 updatePeeringTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/updatePeeringTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/updatePeeringTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $network = 'network1843485230'; - $networksUpdatePeeringRequestResource = new NetworksUpdatePeeringRequest(); - $project = 'project-309310695'; - $response = $gapicClient->updatePeering($network, $networksUpdatePeeringRequestResource, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.Networks/UpdatePeering', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getNetwork(); - $this->assertProtobufEquals($network, $actualValue); - $actualValue = $actualApiRequestObject->getNetworksUpdatePeeringRequestResource(); - $this->assertProtobufEquals($networksUpdatePeeringRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function updatePeeringExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/updatePeeringExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $network = 'network1843485230'; - $networksUpdatePeeringRequestResource = new NetworksUpdatePeeringRequest(); - $project = 'project-309310695'; - $response = $gapicClient->updatePeering($network, $networksUpdatePeeringRequestResource, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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/Compute/tests/Unit/V1/NodeGroupsClientTest.php b/Compute/tests/Unit/V1/NodeGroupsClientTest.php deleted file mode 100644 index dc57bd54c692..000000000000 --- a/Compute/tests/Unit/V1/NodeGroupsClientTest.php +++ /dev/null @@ -1,1606 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return NodeGroupsClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new NodeGroupsClient($options); - } - - /** @test */ - public function addNodesTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/addNodesTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/addNodesTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $nodeGroup = 'nodeGroup1543699970'; - $nodeGroupsAddNodesRequestResource = new NodeGroupsAddNodesRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->addNodes($nodeGroup, $nodeGroupsAddNodesRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.NodeGroups/AddNodes', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getNodeGroup(); - $this->assertProtobufEquals($nodeGroup, $actualValue); - $actualValue = $actualApiRequestObject->getNodeGroupsAddNodesRequestResource(); - $this->assertProtobufEquals($nodeGroupsAddNodesRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function addNodesExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/addNodesExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $nodeGroup = 'nodeGroup1543699970'; - $nodeGroupsAddNodesRequestResource = new NodeGroupsAddNodesRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->addNodes($nodeGroup, $nodeGroupsAddNodesRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 aggregatedListTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $items = [ - 'itemsKey' => new NodeGroupsScopedList(), - ]; - $expectedResponse = new NodeGroupAggregatedList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->aggregatedList($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertArrayHasKey('itemsKey', $expectedResponse->getItems()); - $this->assertArrayHasKey('itemsKey', $resources); - $this->assertEquals($expectedResponse->getItems()['itemsKey'], $resources['itemsKey']); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.NodeGroups/AggregatedList', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function aggregatedListExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->aggregatedList($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $nodeGroup = 'nodeGroup1543699970'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->delete($nodeGroup, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.NodeGroups/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getNodeGroup(); - $this->assertProtobufEquals($nodeGroup, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $nodeGroup = 'nodeGroup1543699970'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->delete($nodeGroup, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 deleteNodesTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteNodesTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteNodesTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $nodeGroup = 'nodeGroup1543699970'; - $nodeGroupsDeleteNodesRequestResource = new NodeGroupsDeleteNodesRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->deleteNodes($nodeGroup, $nodeGroupsDeleteNodesRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.NodeGroups/DeleteNodes', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getNodeGroup(); - $this->assertProtobufEquals($nodeGroup, $actualValue); - $actualValue = $actualApiRequestObject->getNodeGroupsDeleteNodesRequestResource(); - $this->assertProtobufEquals($nodeGroupsDeleteNodesRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteNodesExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteNodesExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $nodeGroup = 'nodeGroup1543699970'; - $nodeGroupsDeleteNodesRequestResource = new NodeGroupsDeleteNodesRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->deleteNodes($nodeGroup, $nodeGroupsDeleteNodesRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $fingerprint = 'fingerprint-1375934236'; - $id = 3355; - $kind = 'kind3292052'; - $locationHint = 'locationHint-1796964143'; - $maintenanceInterval = 'maintenanceInterval1477109873'; - $maintenancePolicy = 'maintenancePolicy1065198558'; - $name = 'name3373707'; - $nodeTemplate = 'nodeTemplate323154455'; - $selfLink = 'selfLink-1691268851'; - $size = 3530753; - $status = 'status-892481550'; - $zone2 = 'zone2-696322977'; - $expectedResponse = new NodeGroup(); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setFingerprint($fingerprint); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setLocationHint($locationHint); - $expectedResponse->setMaintenanceInterval($maintenanceInterval); - $expectedResponse->setMaintenancePolicy($maintenancePolicy); - $expectedResponse->setName($name); - $expectedResponse->setNodeTemplate($nodeTemplate); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setSize($size); - $expectedResponse->setStatus($status); - $expectedResponse->setZone($zone2); - $transport->addResponse($expectedResponse); - // Mock request - $nodeGroup = 'nodeGroup1543699970'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->get($nodeGroup, $project, $zone); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.NodeGroups/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getNodeGroup(); - $this->assertProtobufEquals($nodeGroup, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $nodeGroup = 'nodeGroup1543699970'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - try { - $gapicClient->get($nodeGroup, $project, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $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 - $etag = 'etag3123477'; - $iamOwned = false; - $version = 351608024; - $expectedResponse = new Policy(); - $expectedResponse->setEtag($etag); - $expectedResponse->setIamOwned($iamOwned); - $expectedResponse->setVersion($version); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $zone = 'zone3744684'; - $response = $gapicClient->getIamPolicy($project, $resource, $zone); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.NodeGroups/GetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $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 - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $zone = 'zone3744684'; - try { - $gapicClient->getIamPolicy($project, $resource, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $initialNodeCount = 1682564205; - $nodeGroupResource = new NodeGroup(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->insert($initialNodeCount, $nodeGroupResource, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.NodeGroups/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInitialNodeCount(); - $this->assertProtobufEquals($initialNodeCount, $actualValue); - $actualValue = $actualApiRequestObject->getNodeGroupResource(); - $this->assertProtobufEquals($nodeGroupResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $initialNodeCount = 1682564205; - $nodeGroupResource = new NodeGroup(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->insert($initialNodeCount, $nodeGroupResource, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new NodeGroup(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new NodeGroupList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->list($project, $zone); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.NodeGroups/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $zone = 'zone3744684'; - try { - $gapicClient->list($project, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $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 - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new NodeGroupNode(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new NodeGroupsListNodes(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $nodeGroup = 'nodeGroup1543699970'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->listNodes($nodeGroup, $project, $zone); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.NodeGroups/ListNodes', $actualFuncCall); - $actualValue = $actualRequestObject->getNodeGroup(); - $this->assertProtobufEquals($nodeGroup, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $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 - $nodeGroup = 'nodeGroup1543699970'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - try { - $gapicClient->listNodes($nodeGroup, $project, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function patchTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/patchTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $nodeGroup = 'nodeGroup1543699970'; - $nodeGroupResource = new NodeGroup(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->patch($nodeGroup, $nodeGroupResource, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.NodeGroups/Patch', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getNodeGroup(); - $this->assertProtobufEquals($nodeGroup, $actualValue); - $actualValue = $actualApiRequestObject->getNodeGroupResource(); - $this->assertProtobufEquals($nodeGroupResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function patchExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $nodeGroup = 'nodeGroup1543699970'; - $nodeGroupResource = new NodeGroup(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->patch($nodeGroup, $nodeGroupResource, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 performMaintenanceTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/performMaintenanceTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/performMaintenanceTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $nodeGroup = 'nodeGroup1543699970'; - $nodeGroupsPerformMaintenanceRequestResource = new NodeGroupsPerformMaintenanceRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->performMaintenance($nodeGroup, $nodeGroupsPerformMaintenanceRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.NodeGroups/PerformMaintenance', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getNodeGroup(); - $this->assertProtobufEquals($nodeGroup, $actualValue); - $actualValue = $actualApiRequestObject->getNodeGroupsPerformMaintenanceRequestResource(); - $this->assertProtobufEquals($nodeGroupsPerformMaintenanceRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function performMaintenanceExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/performMaintenanceExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $nodeGroup = 'nodeGroup1543699970'; - $nodeGroupsPerformMaintenanceRequestResource = new NodeGroupsPerformMaintenanceRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->performMaintenance($nodeGroup, $nodeGroupsPerformMaintenanceRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 - $etag = 'etag3123477'; - $iamOwned = false; - $version = 351608024; - $expectedResponse = new Policy(); - $expectedResponse->setEtag($etag); - $expectedResponse->setIamOwned($iamOwned); - $expectedResponse->setVersion($version); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $zone = 'zone3744684'; - $zoneSetPolicyRequestResource = new ZoneSetPolicyRequest(); - $response = $gapicClient->setIamPolicy($project, $resource, $zone, $zoneSetPolicyRequestResource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.NodeGroups/SetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $actualValue = $actualRequestObject->getZoneSetPolicyRequestResource(); - $this->assertProtobufEquals($zoneSetPolicyRequestResource, $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 - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $zone = 'zone3744684'; - $zoneSetPolicyRequestResource = new ZoneSetPolicyRequest(); - try { - $gapicClient->setIamPolicy($project, $resource, $zone, $zoneSetPolicyRequestResource); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setNodeTemplateTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setNodeTemplateTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/setNodeTemplateTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $nodeGroup = 'nodeGroup1543699970'; - $nodeGroupsSetNodeTemplateRequestResource = new NodeGroupsSetNodeTemplateRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->setNodeTemplate($nodeGroup, $nodeGroupsSetNodeTemplateRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.NodeGroups/SetNodeTemplate', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getNodeGroup(); - $this->assertProtobufEquals($nodeGroup, $actualValue); - $actualValue = $actualApiRequestObject->getNodeGroupsSetNodeTemplateRequestResource(); - $this->assertProtobufEquals($nodeGroupsSetNodeTemplateRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setNodeTemplateExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setNodeTemplateExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $nodeGroup = 'nodeGroup1543699970'; - $nodeGroupsSetNodeTemplateRequestResource = new NodeGroupsSetNodeTemplateRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->setNodeTemplate($nodeGroup, $nodeGroupsSetNodeTemplateRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 simulateMaintenanceEventTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/simulateMaintenanceEventTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/simulateMaintenanceEventTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $nodeGroup = 'nodeGroup1543699970'; - $nodeGroupsSimulateMaintenanceEventRequestResource = new NodeGroupsSimulateMaintenanceEventRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->simulateMaintenanceEvent($nodeGroup, $nodeGroupsSimulateMaintenanceEventRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.NodeGroups/SimulateMaintenanceEvent', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getNodeGroup(); - $this->assertProtobufEquals($nodeGroup, $actualValue); - $actualValue = $actualApiRequestObject->getNodeGroupsSimulateMaintenanceEventRequestResource(); - $this->assertProtobufEquals($nodeGroupsSimulateMaintenanceEventRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function simulateMaintenanceEventExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/simulateMaintenanceEventExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $nodeGroup = 'nodeGroup1543699970'; - $nodeGroupsSimulateMaintenanceEventRequestResource = new NodeGroupsSimulateMaintenanceEventRequest(); - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->simulateMaintenanceEvent($nodeGroup, $nodeGroupsSimulateMaintenanceEventRequestResource, $project, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 testIamPermissionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new TestPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $testPermissionsRequestResource = new TestPermissionsRequest(); - $zone = 'zone3744684'; - $response = $gapicClient->testIamPermissions($project, $resource, $testPermissionsRequestResource, $zone); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.NodeGroups/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getTestPermissionsRequestResource(); - $this->assertProtobufEquals($testPermissionsRequestResource, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $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 - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $testPermissionsRequestResource = new TestPermissionsRequest(); - $zone = 'zone3744684'; - try { - $gapicClient->testIamPermissions($project, $resource, $testPermissionsRequestResource, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->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/Compute/tests/Unit/V1/NodeTemplatesClientTest.php b/Compute/tests/Unit/V1/NodeTemplatesClientTest.php deleted file mode 100644 index 584641d40e10..000000000000 --- a/Compute/tests/Unit/V1/NodeTemplatesClientTest.php +++ /dev/null @@ -1,769 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return NodeTemplatesClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new NodeTemplatesClient($options); - } - - /** @test */ - public function aggregatedListTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $items = [ - 'itemsKey' => new NodeTemplatesScopedList(), - ]; - $expectedResponse = new NodeTemplateAggregatedList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->aggregatedList($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertArrayHasKey('itemsKey', $expectedResponse->getItems()); - $this->assertArrayHasKey('itemsKey', $resources); - $this->assertEquals($expectedResponse->getItems()['itemsKey'], $resources['itemsKey']); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.NodeTemplates/AggregatedList', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function aggregatedListExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->aggregatedList($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $nodeTemplate = 'nodeTemplate323154455'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->delete($nodeTemplate, $project, $region); - $this->assertFalse($response->isDone()); - $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.compute.v1.NodeTemplates/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getNodeTemplate(); - $this->assertProtobufEquals($nodeTemplate, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $nodeTemplate = 'nodeTemplate323154455'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->delete($nodeTemplate, $project, $region); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $cpuOvercommitType = 'cpuOvercommitType247727959'; - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $id = 3355; - $kind = 'kind3292052'; - $name = 'name3373707'; - $nodeType = 'nodeType465832791'; - $region2 = 'region2-690338393'; - $selfLink = 'selfLink-1691268851'; - $status = 'status-892481550'; - $statusMessage = 'statusMessage-239442758'; - $expectedResponse = new NodeTemplate(); - $expectedResponse->setCpuOvercommitType($cpuOvercommitType); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setName($name); - $expectedResponse->setNodeType($nodeType); - $expectedResponse->setRegion($region2); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setStatus($status); - $expectedResponse->setStatusMessage($statusMessage); - $transport->addResponse($expectedResponse); - // Mock request - $nodeTemplate = 'nodeTemplate323154455'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->get($nodeTemplate, $project, $region); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.NodeTemplates/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getNodeTemplate(); - $this->assertProtobufEquals($nodeTemplate, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $nodeTemplate = 'nodeTemplate323154455'; - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->get($nodeTemplate, $project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $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 - $etag = 'etag3123477'; - $iamOwned = false; - $version = 351608024; - $expectedResponse = new Policy(); - $expectedResponse->setEtag($etag); - $expectedResponse->setIamOwned($iamOwned); - $expectedResponse->setVersion($version); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $resource = 'resource-341064690'; - $response = $gapicClient->getIamPolicy($project, $region, $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.compute.v1.NodeTemplates/GetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $resource = 'resource-341064690'; - try { - $gapicClient->getIamPolicy($project, $region, $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 insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $nodeTemplateResource = new NodeTemplate(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->insert($nodeTemplateResource, $project, $region); - $this->assertFalse($response->isDone()); - $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.compute.v1.NodeTemplates/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getNodeTemplateResource(); - $this->assertProtobufEquals($nodeTemplateResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $nodeTemplateResource = new NodeTemplate(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->insert($nodeTemplateResource, $project, $region); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new NodeTemplate(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new NodeTemplateList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->list($project, $region); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.NodeTemplates/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->list($project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $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 - $etag = 'etag3123477'; - $iamOwned = false; - $version = 351608024; - $expectedResponse = new Policy(); - $expectedResponse->setEtag($etag); - $expectedResponse->setIamOwned($iamOwned); - $expectedResponse->setVersion($version); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionSetPolicyRequestResource = new RegionSetPolicyRequest(); - $resource = 'resource-341064690'; - $response = $gapicClient->setIamPolicy($project, $region, $regionSetPolicyRequestResource, $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.compute.v1.NodeTemplates/SetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualRequestObject->getRegionSetPolicyRequestResource(); - $this->assertProtobufEquals($regionSetPolicyRequestResource, $actualValue); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionSetPolicyRequestResource = new RegionSetPolicyRequest(); - $resource = 'resource-341064690'; - try { - $gapicClient->setIamPolicy($project, $region, $regionSetPolicyRequestResource, $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 testIamPermissionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new TestPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $resource = 'resource-341064690'; - $testPermissionsRequestResource = new TestPermissionsRequest(); - $response = $gapicClient->testIamPermissions($project, $region, $resource, $testPermissionsRequestResource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.NodeTemplates/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getTestPermissionsRequestResource(); - $this->assertProtobufEquals($testPermissionsRequestResource, $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $resource = 'resource-341064690'; - $testPermissionsRequestResource = new TestPermissionsRequest(); - try { - $gapicClient->testIamPermissions($project, $region, $resource, $testPermissionsRequestResource); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->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/Compute/tests/Unit/V1/NodeTypesClientTest.php b/Compute/tests/Unit/V1/NodeTypesClientTest.php deleted file mode 100644 index ebadd77bec8c..000000000000 --- a/Compute/tests/Unit/V1/NodeTypesClientTest.php +++ /dev/null @@ -1,307 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return NodeTypesClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new NodeTypesClient($options); - } - - /** @test */ - public function aggregatedListTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $items = [ - 'itemsKey' => new NodeTypesScopedList(), - ]; - $expectedResponse = new NodeTypeAggregatedList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->aggregatedList($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertArrayHasKey('itemsKey', $expectedResponse->getItems()); - $this->assertArrayHasKey('itemsKey', $resources); - $this->assertEquals($expectedResponse->getItems()['itemsKey'], $resources['itemsKey']); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.NodeTypes/AggregatedList', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function aggregatedListExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->aggregatedList($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $cpuPlatform = 'cpuPlatform947156266'; - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $guestCpus = 1754126894; - $id = 3355; - $kind = 'kind3292052'; - $localSsdGb = 1281375158; - $maxVms = 844450625; - $memoryMb = 1726613907; - $name = 'name3373707'; - $selfLink = 'selfLink-1691268851'; - $zone2 = 'zone2-696322977'; - $expectedResponse = new NodeType(); - $expectedResponse->setCpuPlatform($cpuPlatform); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setGuestCpus($guestCpus); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setLocalSsdGb($localSsdGb); - $expectedResponse->setMaxVms($maxVms); - $expectedResponse->setMemoryMb($memoryMb); - $expectedResponse->setName($name); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setZone($zone2); - $transport->addResponse($expectedResponse); - // Mock request - $nodeType = 'nodeType465832791'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->get($nodeType, $project, $zone); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.NodeTypes/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getNodeType(); - $this->assertProtobufEquals($nodeType, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $nodeType = 'nodeType465832791'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - try { - $gapicClient->get($nodeType, $project, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new NodeType(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new NodeTypeList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->list($project, $zone); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.NodeTypes/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $zone = 'zone3744684'; - try { - $gapicClient->list($project, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->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/Compute/tests/Unit/V1/PacketMirroringsClientTest.php b/Compute/tests/Unit/V1/PacketMirroringsClientTest.php deleted file mode 100644 index c87f73365411..000000000000 --- a/Compute/tests/Unit/V1/PacketMirroringsClientTest.php +++ /dev/null @@ -1,738 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return PacketMirroringsClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new PacketMirroringsClient($options); - } - - /** @test */ - public function aggregatedListTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $items = [ - 'itemsKey' => new PacketMirroringsScopedList(), - ]; - $expectedResponse = new PacketMirroringAggregatedList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->aggregatedList($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertArrayHasKey('itemsKey', $expectedResponse->getItems()); - $this->assertArrayHasKey('itemsKey', $resources); - $this->assertEquals($expectedResponse->getItems()['itemsKey'], $resources['itemsKey']); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.PacketMirrorings/AggregatedList', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function aggregatedListExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->aggregatedList($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $packetMirroring = 'packetMirroring22305996'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->delete($packetMirroring, $project, $region); - $this->assertFalse($response->isDone()); - $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.compute.v1.PacketMirrorings/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getPacketMirroring(); - $this->assertProtobufEquals($packetMirroring, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $packetMirroring = 'packetMirroring22305996'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->delete($packetMirroring, $project, $region); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $enable = 'enable-1298848381'; - $id = 3355; - $kind = 'kind3292052'; - $name = 'name3373707'; - $priority = 1165461084; - $region2 = 'region2-690338393'; - $selfLink = 'selfLink-1691268851'; - $expectedResponse = new PacketMirroring(); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setEnable($enable); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setName($name); - $expectedResponse->setPriority($priority); - $expectedResponse->setRegion($region2); - $expectedResponse->setSelfLink($selfLink); - $transport->addResponse($expectedResponse); - // Mock request - $packetMirroring = 'packetMirroring22305996'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->get($packetMirroring, $project, $region); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.PacketMirrorings/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getPacketMirroring(); - $this->assertProtobufEquals($packetMirroring, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $packetMirroring = 'packetMirroring22305996'; - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->get($packetMirroring, $project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $packetMirroringResource = new PacketMirroring(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->insert($packetMirroringResource, $project, $region); - $this->assertFalse($response->isDone()); - $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.compute.v1.PacketMirrorings/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getPacketMirroringResource(); - $this->assertProtobufEquals($packetMirroringResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $packetMirroringResource = new PacketMirroring(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->insert($packetMirroringResource, $project, $region); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new PacketMirroring(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new PacketMirroringList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->list($project, $region); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.PacketMirrorings/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->list($project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function patchTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/patchTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $packetMirroring = 'packetMirroring22305996'; - $packetMirroringResource = new PacketMirroring(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->patch($packetMirroring, $packetMirroringResource, $project, $region); - $this->assertFalse($response->isDone()); - $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.compute.v1.PacketMirrorings/Patch', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getPacketMirroring(); - $this->assertProtobufEquals($packetMirroring, $actualValue); - $actualValue = $actualApiRequestObject->getPacketMirroringResource(); - $this->assertProtobufEquals($packetMirroringResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function patchExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $packetMirroring = 'packetMirroring22305996'; - $packetMirroringResource = new PacketMirroring(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->patch($packetMirroring, $packetMirroringResource, $project, $region); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 testIamPermissionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new TestPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $resource = 'resource-341064690'; - $testPermissionsRequestResource = new TestPermissionsRequest(); - $response = $gapicClient->testIamPermissions($project, $region, $resource, $testPermissionsRequestResource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.PacketMirrorings/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getTestPermissionsRequestResource(); - $this->assertProtobufEquals($testPermissionsRequestResource, $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $resource = 'resource-341064690'; - $testPermissionsRequestResource = new TestPermissionsRequest(); - try { - $gapicClient->testIamPermissions($project, $region, $resource, $testPermissionsRequestResource); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->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/Compute/tests/Unit/V1/ProjectsClientTest.php b/Compute/tests/Unit/V1/ProjectsClientTest.php deleted file mode 100644 index e87ecb33593c..000000000000 --- a/Compute/tests/Unit/V1/ProjectsClientTest.php +++ /dev/null @@ -1,1517 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return ProjectsClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new ProjectsClient($options); - } - - /** @test */ - public function disableXpnHostTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/disableXpnHostTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/disableXpnHostTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->disableXpnHost($project); - $this->assertFalse($response->isDone()); - $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.compute.v1.Projects/DisableXpnHost', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function disableXpnHostExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/disableXpnHostExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $response = $gapicClient->disableXpnHost($project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 disableXpnResourceTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/disableXpnResourceTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/disableXpnResourceTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $projectsDisableXpnResourceRequestResource = new ProjectsDisableXpnResourceRequest(); - $response = $gapicClient->disableXpnResource($project, $projectsDisableXpnResourceRequestResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.Projects/DisableXpnResource', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getProjectsDisableXpnResourceRequestResource(); - $this->assertProtobufEquals($projectsDisableXpnResourceRequestResource, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function disableXpnResourceExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/disableXpnResourceExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $projectsDisableXpnResourceRequestResource = new ProjectsDisableXpnResourceRequest(); - $response = $gapicClient->disableXpnResource($project, $projectsDisableXpnResourceRequestResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 enableXpnHostTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/enableXpnHostTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/enableXpnHostTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->enableXpnHost($project); - $this->assertFalse($response->isDone()); - $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.compute.v1.Projects/EnableXpnHost', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function enableXpnHostExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/enableXpnHostExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $response = $gapicClient->enableXpnHost($project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 enableXpnResourceTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/enableXpnResourceTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/enableXpnResourceTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $projectsEnableXpnResourceRequestResource = new ProjectsEnableXpnResourceRequest(); - $response = $gapicClient->enableXpnResource($project, $projectsEnableXpnResourceRequestResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.Projects/EnableXpnResource', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getProjectsEnableXpnResourceRequestResource(); - $this->assertProtobufEquals($projectsEnableXpnResourceRequestResource, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function enableXpnResourceExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/enableXpnResourceExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $projectsEnableXpnResourceRequestResource = new ProjectsEnableXpnResourceRequest(); - $response = $gapicClient->enableXpnResource($project, $projectsEnableXpnResourceRequestResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $cloudArmorTier = 'cloudArmorTier-532443860'; - $creationTimestamp = 'creationTimestamp567396278'; - $defaultNetworkTier = 'defaultNetworkTier1545495185'; - $defaultServiceAccount = 'defaultServiceAccount-1848771419'; - $description = 'description-1724546052'; - $id = 3355; - $kind = 'kind3292052'; - $name = 'name3373707'; - $selfLink = 'selfLink-1691268851'; - $vmDnsSetting = 'vmDnsSetting1132598194'; - $xpnProjectStatus = 'xpnProjectStatus-308451647'; - $expectedResponse = new Project(); - $expectedResponse->setCloudArmorTier($cloudArmorTier); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDefaultNetworkTier($defaultNetworkTier); - $expectedResponse->setDefaultServiceAccount($defaultServiceAccount); - $expectedResponse->setDescription($description); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setName($name); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setVmDnsSetting($vmDnsSetting); - $expectedResponse->setXpnProjectStatus($xpnProjectStatus); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->get($project); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Projects/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->get($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getXpnHostTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $cloudArmorTier = 'cloudArmorTier-532443860'; - $creationTimestamp = 'creationTimestamp567396278'; - $defaultNetworkTier = 'defaultNetworkTier1545495185'; - $defaultServiceAccount = 'defaultServiceAccount-1848771419'; - $description = 'description-1724546052'; - $id = 3355; - $kind = 'kind3292052'; - $name = 'name3373707'; - $selfLink = 'selfLink-1691268851'; - $vmDnsSetting = 'vmDnsSetting1132598194'; - $xpnProjectStatus = 'xpnProjectStatus-308451647'; - $expectedResponse = new Project(); - $expectedResponse->setCloudArmorTier($cloudArmorTier); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDefaultNetworkTier($defaultNetworkTier); - $expectedResponse->setDefaultServiceAccount($defaultServiceAccount); - $expectedResponse->setDescription($description); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setName($name); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setVmDnsSetting($vmDnsSetting); - $expectedResponse->setXpnProjectStatus($xpnProjectStatus); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->getXpnHost($project); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Projects/GetXpnHost', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getXpnHostExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->getXpnHost($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getXpnResourcesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $kind = 'kind3292052'; - $nextPageToken = ''; - $resourcesElement = new XpnResourceId(); - $resources = [ - $resourcesElement, - ]; - $expectedResponse = new ProjectsGetXpnResources(); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setResources($resources); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->getXpnResources($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getResources()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Projects/GetXpnResources', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getXpnResourcesExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->getXpnResources($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listXpnHostsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new Project(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new XpnHostList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $projectsListXpnHostsRequestResource = new ProjectsListXpnHostsRequest(); - $response = $gapicClient->listXpnHosts($project, $projectsListXpnHostsRequestResource); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Projects/ListXpnHosts', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getProjectsListXpnHostsRequestResource(); - $this->assertProtobufEquals($projectsListXpnHostsRequestResource, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listXpnHostsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $projectsListXpnHostsRequestResource = new ProjectsListXpnHostsRequest(); - try { - $gapicClient->listXpnHosts($project, $projectsListXpnHostsRequestResource); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function moveDiskTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/moveDiskTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/moveDiskTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $diskMoveRequestResource = new DiskMoveRequest(); - $project = 'project-309310695'; - $response = $gapicClient->moveDisk($diskMoveRequestResource, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.Projects/MoveDisk', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getDiskMoveRequestResource(); - $this->assertProtobufEquals($diskMoveRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function moveDiskExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/moveDiskExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $diskMoveRequestResource = new DiskMoveRequest(); - $project = 'project-309310695'; - $response = $gapicClient->moveDisk($diskMoveRequestResource, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 moveInstanceTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/moveInstanceTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/moveInstanceTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instanceMoveRequestResource = new InstanceMoveRequest(); - $project = 'project-309310695'; - $response = $gapicClient->moveInstance($instanceMoveRequestResource, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.Projects/MoveInstance', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstanceMoveRequestResource(); - $this->assertProtobufEquals($instanceMoveRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function moveInstanceExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/moveInstanceExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instanceMoveRequestResource = new InstanceMoveRequest(); - $project = 'project-309310695'; - $response = $gapicClient->moveInstance($instanceMoveRequestResource, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 setCloudArmorTierTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setCloudArmorTierTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/setCloudArmorTierTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $projectsSetCloudArmorTierRequestResource = new ProjectsSetCloudArmorTierRequest(); - $response = $gapicClient->setCloudArmorTier($project, $projectsSetCloudArmorTierRequestResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.Projects/SetCloudArmorTier', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getProjectsSetCloudArmorTierRequestResource(); - $this->assertProtobufEquals($projectsSetCloudArmorTierRequestResource, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setCloudArmorTierExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setCloudArmorTierExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $projectsSetCloudArmorTierRequestResource = new ProjectsSetCloudArmorTierRequest(); - $response = $gapicClient->setCloudArmorTier($project, $projectsSetCloudArmorTierRequestResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 setCommonInstanceMetadataTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setCommonInstanceMetadataTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/setCommonInstanceMetadataTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $metadataResource = new Metadata(); - $project = 'project-309310695'; - $response = $gapicClient->setCommonInstanceMetadata($metadataResource, $project); - $this->assertFalse($response->isDone()); - $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.compute.v1.Projects/SetCommonInstanceMetadata', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getMetadataResource(); - $this->assertProtobufEquals($metadataResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setCommonInstanceMetadataExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setCommonInstanceMetadataExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $metadataResource = new Metadata(); - $project = 'project-309310695'; - $response = $gapicClient->setCommonInstanceMetadata($metadataResource, $project); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 setDefaultNetworkTierTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setDefaultNetworkTierTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/setDefaultNetworkTierTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $projectsSetDefaultNetworkTierRequestResource = new ProjectsSetDefaultNetworkTierRequest(); - $response = $gapicClient->setDefaultNetworkTier($project, $projectsSetDefaultNetworkTierRequestResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.Projects/SetDefaultNetworkTier', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getProjectsSetDefaultNetworkTierRequestResource(); - $this->assertProtobufEquals($projectsSetDefaultNetworkTierRequestResource, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setDefaultNetworkTierExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setDefaultNetworkTierExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $projectsSetDefaultNetworkTierRequestResource = new ProjectsSetDefaultNetworkTierRequest(); - $response = $gapicClient->setDefaultNetworkTier($project, $projectsSetDefaultNetworkTierRequestResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 setUsageExportBucketTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setUsageExportBucketTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/setUsageExportBucketTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $usageExportLocationResource = new UsageExportLocation(); - $response = $gapicClient->setUsageExportBucket($project, $usageExportLocationResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.Projects/SetUsageExportBucket', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getUsageExportLocationResource(); - $this->assertProtobufEquals($usageExportLocationResource, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setUsageExportBucketExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setUsageExportBucketExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $usageExportLocationResource = new UsageExportLocation(); - $response = $gapicClient->setUsageExportBucket($project, $usageExportLocationResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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/Compute/tests/Unit/V1/PublicAdvertisedPrefixesClientTest.php b/Compute/tests/Unit/V1/PublicAdvertisedPrefixesClientTest.php deleted file mode 100644 index 8ffb0cdda266..000000000000 --- a/Compute/tests/Unit/V1/PublicAdvertisedPrefixesClientTest.php +++ /dev/null @@ -1,802 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return PublicAdvertisedPrefixesClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new PublicAdvertisedPrefixesClient($options); - } - - /** @test */ - public function announceTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/announceTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/announceTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $publicAdvertisedPrefix = 'publicAdvertisedPrefix-1508738146'; - $response = $gapicClient->announce($project, $publicAdvertisedPrefix); - $this->assertFalse($response->isDone()); - $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.compute.v1.PublicAdvertisedPrefixes/Announce', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getPublicAdvertisedPrefix(); - $this->assertProtobufEquals($publicAdvertisedPrefix, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function announceExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/announceExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $publicAdvertisedPrefix = 'publicAdvertisedPrefix-1508738146'; - $response = $gapicClient->announce($project, $publicAdvertisedPrefix); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $publicAdvertisedPrefix = 'publicAdvertisedPrefix-1508738146'; - $response = $gapicClient->delete($project, $publicAdvertisedPrefix); - $this->assertFalse($response->isDone()); - $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.compute.v1.PublicAdvertisedPrefixes/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getPublicAdvertisedPrefix(); - $this->assertProtobufEquals($publicAdvertisedPrefix, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $publicAdvertisedPrefix = 'publicAdvertisedPrefix-1508738146'; - $response = $gapicClient->delete($project, $publicAdvertisedPrefix); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $byoipApiVersion = 'byoipApiVersion162683283'; - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $dnsVerificationIp = 'dnsVerificationIp-1906472267'; - $fingerprint = 'fingerprint-1375934236'; - $id = 3355; - $ipCidrRange = 'ipCidrRange-2049366326'; - $kind = 'kind3292052'; - $name = 'name3373707'; - $pdpScope = 'pdpScope1061135697'; - $selfLink = 'selfLink-1691268851'; - $sharedSecret = 'sharedSecret-154938422'; - $status = 'status-892481550'; - $expectedResponse = new PublicAdvertisedPrefix(); - $expectedResponse->setByoipApiVersion($byoipApiVersion); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setDnsVerificationIp($dnsVerificationIp); - $expectedResponse->setFingerprint($fingerprint); - $expectedResponse->setId($id); - $expectedResponse->setIpCidrRange($ipCidrRange); - $expectedResponse->setKind($kind); - $expectedResponse->setName($name); - $expectedResponse->setPdpScope($pdpScope); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setSharedSecret($sharedSecret); - $expectedResponse->setStatus($status); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $publicAdvertisedPrefix = 'publicAdvertisedPrefix-1508738146'; - $response = $gapicClient->get($project, $publicAdvertisedPrefix); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.PublicAdvertisedPrefixes/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getPublicAdvertisedPrefix(); - $this->assertProtobufEquals($publicAdvertisedPrefix, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $publicAdvertisedPrefix = 'publicAdvertisedPrefix-1508738146'; - try { - $gapicClient->get($project, $publicAdvertisedPrefix); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $publicAdvertisedPrefixResource = new PublicAdvertisedPrefix(); - $response = $gapicClient->insert($project, $publicAdvertisedPrefixResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.PublicAdvertisedPrefixes/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getPublicAdvertisedPrefixResource(); - $this->assertProtobufEquals($publicAdvertisedPrefixResource, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $publicAdvertisedPrefixResource = new PublicAdvertisedPrefix(); - $response = $gapicClient->insert($project, $publicAdvertisedPrefixResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new PublicAdvertisedPrefix(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new PublicAdvertisedPrefixList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->list($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.PublicAdvertisedPrefixes/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->list($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function patchTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/patchTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $publicAdvertisedPrefix = 'publicAdvertisedPrefix-1508738146'; - $publicAdvertisedPrefixResource = new PublicAdvertisedPrefix(); - $response = $gapicClient->patch($project, $publicAdvertisedPrefix, $publicAdvertisedPrefixResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.PublicAdvertisedPrefixes/Patch', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getPublicAdvertisedPrefix(); - $this->assertProtobufEquals($publicAdvertisedPrefix, $actualValue); - $actualValue = $actualApiRequestObject->getPublicAdvertisedPrefixResource(); - $this->assertProtobufEquals($publicAdvertisedPrefixResource, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function patchExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $publicAdvertisedPrefix = 'publicAdvertisedPrefix-1508738146'; - $publicAdvertisedPrefixResource = new PublicAdvertisedPrefix(); - $response = $gapicClient->patch($project, $publicAdvertisedPrefix, $publicAdvertisedPrefixResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 withdrawTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/withdrawTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/withdrawTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $publicAdvertisedPrefix = 'publicAdvertisedPrefix-1508738146'; - $response = $gapicClient->withdraw($project, $publicAdvertisedPrefix); - $this->assertFalse($response->isDone()); - $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.compute.v1.PublicAdvertisedPrefixes/Withdraw', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getPublicAdvertisedPrefix(); - $this->assertProtobufEquals($publicAdvertisedPrefix, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function withdrawExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/withdrawExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $publicAdvertisedPrefix = 'publicAdvertisedPrefix-1508738146'; - $response = $gapicClient->withdraw($project, $publicAdvertisedPrefix); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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/Compute/tests/Unit/V1/PublicDelegatedPrefixesClientTest.php b/Compute/tests/Unit/V1/PublicDelegatedPrefixesClientTest.php deleted file mode 100644 index 4e8de23d26a6..000000000000 --- a/Compute/tests/Unit/V1/PublicDelegatedPrefixesClientTest.php +++ /dev/null @@ -1,916 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return PublicDelegatedPrefixesClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new PublicDelegatedPrefixesClient($options); - } - - /** @test */ - public function aggregatedListTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $items = [ - 'itemsKey' => new PublicDelegatedPrefixesScopedList(), - ]; - $expectedResponse = new PublicDelegatedPrefixAggregatedList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->aggregatedList($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertArrayHasKey('itemsKey', $expectedResponse->getItems()); - $this->assertArrayHasKey('itemsKey', $resources); - $this->assertEquals($expectedResponse->getItems()['itemsKey'], $resources['itemsKey']); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.PublicDelegatedPrefixes/AggregatedList', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function aggregatedListExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->aggregatedList($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function announceTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/announceTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/announceTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $publicDelegatedPrefix = 'publicDelegatedPrefix1814851176'; - $region = 'region-934795532'; - $response = $gapicClient->announce($project, $publicDelegatedPrefix, $region); - $this->assertFalse($response->isDone()); - $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.compute.v1.PublicDelegatedPrefixes/Announce', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getPublicDelegatedPrefix(); - $this->assertProtobufEquals($publicDelegatedPrefix, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function announceExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/announceExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $publicDelegatedPrefix = 'publicDelegatedPrefix1814851176'; - $region = 'region-934795532'; - $response = $gapicClient->announce($project, $publicDelegatedPrefix, $region); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $publicDelegatedPrefix = 'publicDelegatedPrefix1814851176'; - $region = 'region-934795532'; - $response = $gapicClient->delete($project, $publicDelegatedPrefix, $region); - $this->assertFalse($response->isDone()); - $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.compute.v1.PublicDelegatedPrefixes/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getPublicDelegatedPrefix(); - $this->assertProtobufEquals($publicDelegatedPrefix, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $publicDelegatedPrefix = 'publicDelegatedPrefix1814851176'; - $region = 'region-934795532'; - $response = $gapicClient->delete($project, $publicDelegatedPrefix, $region); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $allocatablePrefixLength = 1649040182; - $byoipApiVersion = 'byoipApiVersion162683283'; - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $fingerprint = 'fingerprint-1375934236'; - $id = 3355; - $ipCidrRange = 'ipCidrRange-2049366326'; - $isLiveMigration = true; - $kind = 'kind3292052'; - $mode = 'mode3357091'; - $name = 'name3373707'; - $parentPrefix = 'parentPrefix552104903'; - $region2 = 'region2-690338393'; - $selfLink = 'selfLink-1691268851'; - $status = 'status-892481550'; - $expectedResponse = new PublicDelegatedPrefix(); - $expectedResponse->setAllocatablePrefixLength($allocatablePrefixLength); - $expectedResponse->setByoipApiVersion($byoipApiVersion); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setFingerprint($fingerprint); - $expectedResponse->setId($id); - $expectedResponse->setIpCidrRange($ipCidrRange); - $expectedResponse->setIsLiveMigration($isLiveMigration); - $expectedResponse->setKind($kind); - $expectedResponse->setMode($mode); - $expectedResponse->setName($name); - $expectedResponse->setParentPrefix($parentPrefix); - $expectedResponse->setRegion($region2); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setStatus($status); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $publicDelegatedPrefix = 'publicDelegatedPrefix1814851176'; - $region = 'region-934795532'; - $response = $gapicClient->get($project, $publicDelegatedPrefix, $region); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.PublicDelegatedPrefixes/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getPublicDelegatedPrefix(); - $this->assertProtobufEquals($publicDelegatedPrefix, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $publicDelegatedPrefix = 'publicDelegatedPrefix1814851176'; - $region = 'region-934795532'; - try { - $gapicClient->get($project, $publicDelegatedPrefix, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $publicDelegatedPrefixResource = new PublicDelegatedPrefix(); - $region = 'region-934795532'; - $response = $gapicClient->insert($project, $publicDelegatedPrefixResource, $region); - $this->assertFalse($response->isDone()); - $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.compute.v1.PublicDelegatedPrefixes/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getPublicDelegatedPrefixResource(); - $this->assertProtobufEquals($publicDelegatedPrefixResource, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $publicDelegatedPrefixResource = new PublicDelegatedPrefix(); - $region = 'region-934795532'; - $response = $gapicClient->insert($project, $publicDelegatedPrefixResource, $region); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new PublicDelegatedPrefix(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new PublicDelegatedPrefixList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->list($project, $region); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.PublicDelegatedPrefixes/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->list($project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function patchTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/patchTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $publicDelegatedPrefix = 'publicDelegatedPrefix1814851176'; - $publicDelegatedPrefixResource = new PublicDelegatedPrefix(); - $region = 'region-934795532'; - $response = $gapicClient->patch($project, $publicDelegatedPrefix, $publicDelegatedPrefixResource, $region); - $this->assertFalse($response->isDone()); - $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.compute.v1.PublicDelegatedPrefixes/Patch', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getPublicDelegatedPrefix(); - $this->assertProtobufEquals($publicDelegatedPrefix, $actualValue); - $actualValue = $actualApiRequestObject->getPublicDelegatedPrefixResource(); - $this->assertProtobufEquals($publicDelegatedPrefixResource, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function patchExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $publicDelegatedPrefix = 'publicDelegatedPrefix1814851176'; - $publicDelegatedPrefixResource = new PublicDelegatedPrefix(); - $region = 'region-934795532'; - $response = $gapicClient->patch($project, $publicDelegatedPrefix, $publicDelegatedPrefixResource, $region); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 withdrawTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/withdrawTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/withdrawTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $publicDelegatedPrefix = 'publicDelegatedPrefix1814851176'; - $region = 'region-934795532'; - $response = $gapicClient->withdraw($project, $publicDelegatedPrefix, $region); - $this->assertFalse($response->isDone()); - $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.compute.v1.PublicDelegatedPrefixes/Withdraw', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getPublicDelegatedPrefix(); - $this->assertProtobufEquals($publicDelegatedPrefix, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function withdrawExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/withdrawExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $publicDelegatedPrefix = 'publicDelegatedPrefix1814851176'; - $region = 'region-934795532'; - $response = $gapicClient->withdraw($project, $publicDelegatedPrefix, $region); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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/Compute/tests/Unit/V1/RegionAutoscalersClientTest.php b/Compute/tests/Unit/V1/RegionAutoscalersClientTest.php deleted file mode 100644 index bed2e809a220..000000000000 --- a/Compute/tests/Unit/V1/RegionAutoscalersClientTest.php +++ /dev/null @@ -1,708 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return RegionAutoscalersClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new RegionAutoscalersClient($options); - } - - /** @test */ - public function deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $autoscaler = 'autoscaler517258967'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->delete($autoscaler, $project, $region); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionAutoscalers/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getAutoscaler(); - $this->assertProtobufEquals($autoscaler, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $autoscaler = 'autoscaler517258967'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->delete($autoscaler, $project, $region); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $id = 3355; - $kind = 'kind3292052'; - $name = 'name3373707'; - $recommendedSize = 1889567899; - $region2 = 'region2-690338393'; - $selfLink = 'selfLink-1691268851'; - $status = 'status-892481550'; - $target = 'target-880905839'; - $zone = 'zone3744684'; - $expectedResponse = new Autoscaler(); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setName($name); - $expectedResponse->setRecommendedSize($recommendedSize); - $expectedResponse->setRegion($region2); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setStatus($status); - $expectedResponse->setTarget($target); - $expectedResponse->setZone($zone); - $transport->addResponse($expectedResponse); - // Mock request - $autoscaler = 'autoscaler517258967'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->get($autoscaler, $project, $region); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionAutoscalers/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getAutoscaler(); - $this->assertProtobufEquals($autoscaler, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $autoscaler = 'autoscaler517258967'; - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->get($autoscaler, $project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $autoscalerResource = new Autoscaler(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->insert($autoscalerResource, $project, $region); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionAutoscalers/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getAutoscalerResource(); - $this->assertProtobufEquals($autoscalerResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $autoscalerResource = new Autoscaler(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->insert($autoscalerResource, $project, $region); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new Autoscaler(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new RegionAutoscalerList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->list($project, $region); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionAutoscalers/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->list($project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function patchTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/patchTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $autoscalerResource = new Autoscaler(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->patch($autoscalerResource, $project, $region); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionAutoscalers/Patch', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getAutoscalerResource(); - $this->assertProtobufEquals($autoscalerResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function patchExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $autoscalerResource = new Autoscaler(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->patch($autoscalerResource, $project, $region); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 updateTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/updateTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/updateTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $autoscalerResource = new Autoscaler(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->update($autoscalerResource, $project, $region); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionAutoscalers/Update', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getAutoscalerResource(); - $this->assertProtobufEquals($autoscalerResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function updateExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/updateExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $autoscalerResource = new Autoscaler(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->update($autoscalerResource, $project, $region); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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/Compute/tests/Unit/V1/RegionBackendServicesClientTest.php b/Compute/tests/Unit/V1/RegionBackendServicesClientTest.php deleted file mode 100644 index 76819ed2d96c..000000000000 --- a/Compute/tests/Unit/V1/RegionBackendServicesClientTest.php +++ /dev/null @@ -1,1243 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return RegionBackendServicesClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new RegionBackendServicesClient($options); - } - - /** @test */ - public function deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $backendService = 'backendService306946058'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->delete($backendService, $project, $region); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionBackendServices/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getBackendService(); - $this->assertProtobufEquals($backendService, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $backendService = 'backendService306946058'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->delete($backendService, $project, $region); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $affinityCookieTtlSec = 1777486694; - $compressionMode = 'compressionMode-2051962660'; - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $edgeSecurityPolicy = 'edgeSecurityPolicy-1032704881'; - $enableCDN = false; - $externalManagedMigrationState = 'externalManagedMigrationState-469923892'; - $externalManagedMigrationTestingPercentage = 3747041; - $fingerprint = 'fingerprint-1375934236'; - $id = 3355; - $ipAddressSelectionPolicy = 'ipAddressSelectionPolicy614471752'; - $kind = 'kind3292052'; - $loadBalancingScheme = 'loadBalancingScheme1974502980'; - $localityLbPolicy = 'localityLbPolicy-2016052161'; - $name = 'name3373707'; - $network = 'network1843485230'; - $port = 3446913; - $portName = 'portName1115276169'; - $protocol = 'protocol-989163880'; - $region2 = 'region2-690338393'; - $securityPolicy = 'securityPolicy1781695249'; - $selfLink = 'selfLink-1691268851'; - $serviceLbPolicy = 'serviceLbPolicy1168590609'; - $sessionAffinity = 'sessionAffinity1000759473'; - $timeoutSec = 2067488653; - $expectedResponse = new BackendService(); - $expectedResponse->setAffinityCookieTtlSec($affinityCookieTtlSec); - $expectedResponse->setCompressionMode($compressionMode); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setEdgeSecurityPolicy($edgeSecurityPolicy); - $expectedResponse->setEnableCDN($enableCDN); - $expectedResponse->setExternalManagedMigrationState($externalManagedMigrationState); - $expectedResponse->setExternalManagedMigrationTestingPercentage($externalManagedMigrationTestingPercentage); - $expectedResponse->setFingerprint($fingerprint); - $expectedResponse->setId($id); - $expectedResponse->setIpAddressSelectionPolicy($ipAddressSelectionPolicy); - $expectedResponse->setKind($kind); - $expectedResponse->setLoadBalancingScheme($loadBalancingScheme); - $expectedResponse->setLocalityLbPolicy($localityLbPolicy); - $expectedResponse->setName($name); - $expectedResponse->setNetwork($network); - $expectedResponse->setPort($port); - $expectedResponse->setPortName($portName); - $expectedResponse->setProtocol($protocol); - $expectedResponse->setRegion($region2); - $expectedResponse->setSecurityPolicy($securityPolicy); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setServiceLbPolicy($serviceLbPolicy); - $expectedResponse->setSessionAffinity($sessionAffinity); - $expectedResponse->setTimeoutSec($timeoutSec); - $transport->addResponse($expectedResponse); - // Mock request - $backendService = 'backendService306946058'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->get($backendService, $project, $region); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionBackendServices/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getBackendService(); - $this->assertProtobufEquals($backendService, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $backendService = 'backendService306946058'; - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->get($backendService, $project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getHealthTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $kind = 'kind3292052'; - $expectedResponse = new BackendServiceGroupHealth(); - $expectedResponse->setKind($kind); - $transport->addResponse($expectedResponse); - // Mock request - $backendService = 'backendService306946058'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $resourceGroupReferenceResource = new ResourceGroupReference(); - $response = $gapicClient->getHealth($backendService, $project, $region, $resourceGroupReferenceResource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionBackendServices/GetHealth', $actualFuncCall); - $actualValue = $actualRequestObject->getBackendService(); - $this->assertProtobufEquals($backendService, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualRequestObject->getResourceGroupReferenceResource(); - $this->assertProtobufEquals($resourceGroupReferenceResource, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getHealthExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $backendService = 'backendService306946058'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $resourceGroupReferenceResource = new ResourceGroupReference(); - try { - $gapicClient->getHealth($backendService, $project, $region, $resourceGroupReferenceResource); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $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 - $etag = 'etag3123477'; - $iamOwned = false; - $version = 351608024; - $expectedResponse = new Policy(); - $expectedResponse->setEtag($etag); - $expectedResponse->setIamOwned($iamOwned); - $expectedResponse->setVersion($version); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $resource = 'resource-341064690'; - $response = $gapicClient->getIamPolicy($project, $region, $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.compute.v1.RegionBackendServices/GetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $resource = 'resource-341064690'; - try { - $gapicClient->getIamPolicy($project, $region, $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 insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $backendServiceResource = new BackendService(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->insert($backendServiceResource, $project, $region); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionBackendServices/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getBackendServiceResource(); - $this->assertProtobufEquals($backendServiceResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $backendServiceResource = new BackendService(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->insert($backendServiceResource, $project, $region); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new BackendService(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new BackendServiceList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->list($project, $region); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionBackendServices/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->list($project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listUsableTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new BackendService(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new BackendServiceListUsable(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->listUsable($project, $region); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionBackendServices/ListUsable', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listUsableExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->listUsable($project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function patchTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/patchTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $backendService = 'backendService306946058'; - $backendServiceResource = new BackendService(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->patch($backendService, $backendServiceResource, $project, $region); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionBackendServices/Patch', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getBackendService(); - $this->assertProtobufEquals($backendService, $actualValue); - $actualValue = $actualApiRequestObject->getBackendServiceResource(); - $this->assertProtobufEquals($backendServiceResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function patchExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $backendService = 'backendService306946058'; - $backendServiceResource = new BackendService(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->patch($backendService, $backendServiceResource, $project, $region); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 - $etag = 'etag3123477'; - $iamOwned = false; - $version = 351608024; - $expectedResponse = new Policy(); - $expectedResponse->setEtag($etag); - $expectedResponse->setIamOwned($iamOwned); - $expectedResponse->setVersion($version); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionSetPolicyRequestResource = new RegionSetPolicyRequest(); - $resource = 'resource-341064690'; - $response = $gapicClient->setIamPolicy($project, $region, $regionSetPolicyRequestResource, $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.compute.v1.RegionBackendServices/SetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualRequestObject->getRegionSetPolicyRequestResource(); - $this->assertProtobufEquals($regionSetPolicyRequestResource, $actualValue); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionSetPolicyRequestResource = new RegionSetPolicyRequest(); - $resource = 'resource-341064690'; - try { - $gapicClient->setIamPolicy($project, $region, $regionSetPolicyRequestResource, $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 setSecurityPolicyTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setSecurityPolicyTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/setSecurityPolicyTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $backendService = 'backendService306946058'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $securityPolicyReferenceResource = new SecurityPolicyReference(); - $response = $gapicClient->setSecurityPolicy($backendService, $project, $region, $securityPolicyReferenceResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionBackendServices/SetSecurityPolicy', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getBackendService(); - $this->assertProtobufEquals($backendService, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getSecurityPolicyReferenceResource(); - $this->assertProtobufEquals($securityPolicyReferenceResource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setSecurityPolicyExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setSecurityPolicyExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $backendService = 'backendService306946058'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $securityPolicyReferenceResource = new SecurityPolicyReference(); - $response = $gapicClient->setSecurityPolicy($backendService, $project, $region, $securityPolicyReferenceResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 testIamPermissionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new TestPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $resource = 'resource-341064690'; - $testPermissionsRequestResource = new TestPermissionsRequest(); - $response = $gapicClient->testIamPermissions($project, $region, $resource, $testPermissionsRequestResource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionBackendServices/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getTestPermissionsRequestResource(); - $this->assertProtobufEquals($testPermissionsRequestResource, $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $resource = 'resource-341064690'; - $testPermissionsRequestResource = new TestPermissionsRequest(); - try { - $gapicClient->testIamPermissions($project, $region, $resource, $testPermissionsRequestResource); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/updateTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/updateTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $backendService = 'backendService306946058'; - $backendServiceResource = new BackendService(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->update($backendService, $backendServiceResource, $project, $region); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionBackendServices/Update', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getBackendService(); - $this->assertProtobufEquals($backendService, $actualValue); - $actualValue = $actualApiRequestObject->getBackendServiceResource(); - $this->assertProtobufEquals($backendServiceResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function updateExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/updateExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $backendService = 'backendService306946058'; - $backendServiceResource = new BackendService(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->update($backendService, $backendServiceResource, $project, $region); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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/Compute/tests/Unit/V1/RegionCommitmentsClientTest.php b/Compute/tests/Unit/V1/RegionCommitmentsClientTest.php deleted file mode 100644 index 6d65bd11f0bb..000000000000 --- a/Compute/tests/Unit/V1/RegionCommitmentsClientTest.php +++ /dev/null @@ -1,563 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return RegionCommitmentsClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new RegionCommitmentsClient($options); - } - - /** @test */ - public function aggregatedListTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $items = [ - 'itemsKey' => new CommitmentsScopedList(), - ]; - $expectedResponse = new CommitmentAggregatedList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->aggregatedList($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertArrayHasKey('itemsKey', $expectedResponse->getItems()); - $this->assertArrayHasKey('itemsKey', $resources); - $this->assertEquals($expectedResponse->getItems()['itemsKey'], $resources['itemsKey']); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionCommitments/AggregatedList', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function aggregatedListExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->aggregatedList($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $autoRenew = false; - $category = 'category50511102'; - $creationTimestamp = 'creationTimestamp567396278'; - $customEndTimestamp = 'customEndTimestamp-1965712796'; - $description = 'description-1724546052'; - $endTimestamp = 'endTimestamp1004967602'; - $id = 3355; - $kind = 'kind3292052'; - $name = 'name3373707'; - $plan = 'plan3443497'; - $region2 = 'region2-690338393'; - $selfLink = 'selfLink-1691268851'; - $splitSourceCommitment = 'splitSourceCommitment402611156'; - $startTimestamp = 'startTimestamp-1526966919'; - $status = 'status-892481550'; - $statusMessage = 'statusMessage-239442758'; - $type = 'type3575610'; - $expectedResponse = new Commitment(); - $expectedResponse->setAutoRenew($autoRenew); - $expectedResponse->setCategory($category); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setCustomEndTimestamp($customEndTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setEndTimestamp($endTimestamp); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setName($name); - $expectedResponse->setPlan($plan); - $expectedResponse->setRegion($region2); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setSplitSourceCommitment($splitSourceCommitment); - $expectedResponse->setStartTimestamp($startTimestamp); - $expectedResponse->setStatus($status); - $expectedResponse->setStatusMessage($statusMessage); - $expectedResponse->setType($type); - $transport->addResponse($expectedResponse); - // Mock request - $commitment = 'commitment1019005717'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->get($commitment, $project, $region); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionCommitments/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getCommitment(); - $this->assertProtobufEquals($commitment, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $commitment = 'commitment1019005717'; - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->get($commitment, $project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $commitmentResource = new Commitment(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->insert($commitmentResource, $project, $region); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionCommitments/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getCommitmentResource(); - $this->assertProtobufEquals($commitmentResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $commitmentResource = new Commitment(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->insert($commitmentResource, $project, $region); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new Commitment(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new CommitmentList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->list($project, $region); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionCommitments/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->list($project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/updateTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/updateTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $commitment = 'commitment1019005717'; - $commitmentResource = new Commitment(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->update($commitment, $commitmentResource, $project, $region); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionCommitments/Update', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getCommitment(); - $this->assertProtobufEquals($commitment, $actualValue); - $actualValue = $actualApiRequestObject->getCommitmentResource(); - $this->assertProtobufEquals($commitmentResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function updateExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/updateExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $commitment = 'commitment1019005717'; - $commitmentResource = new Commitment(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->update($commitment, $commitmentResource, $project, $region); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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/Compute/tests/Unit/V1/RegionDiskTypesClientTest.php b/Compute/tests/Unit/V1/RegionDiskTypesClientTest.php deleted file mode 100644 index 08c4ee619b3b..000000000000 --- a/Compute/tests/Unit/V1/RegionDiskTypesClientTest.php +++ /dev/null @@ -1,226 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return RegionDiskTypesClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new RegionDiskTypesClient($options); - } - - /** @test */ - public function getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $creationTimestamp = 'creationTimestamp567396278'; - $defaultDiskSizeGb = 807490165; - $description = 'description-1724546052'; - $id = 3355; - $kind = 'kind3292052'; - $name = 'name3373707'; - $region2 = 'region2-690338393'; - $selfLink = 'selfLink-1691268851'; - $validDiskSize = 'validDiskSize-1653521184'; - $zone = 'zone3744684'; - $expectedResponse = new DiskType(); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDefaultDiskSizeGb($defaultDiskSizeGb); - $expectedResponse->setDescription($description); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setName($name); - $expectedResponse->setRegion($region2); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setValidDiskSize($validDiskSize); - $expectedResponse->setZone($zone); - $transport->addResponse($expectedResponse); - // Mock request - $diskType = 'diskType93009052'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->get($diskType, $project, $region); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionDiskTypes/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getDiskType(); - $this->assertProtobufEquals($diskType, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $diskType = 'diskType93009052'; - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->get($diskType, $project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new DiskType(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new RegionDiskTypeList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->list($project, $region); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionDiskTypes/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->list($project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->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/Compute/tests/Unit/V1/RegionDisksClientTest.php b/Compute/tests/Unit/V1/RegionDisksClientTest.php deleted file mode 100644 index cf2869b246ab..000000000000 --- a/Compute/tests/Unit/V1/RegionDisksClientTest.php +++ /dev/null @@ -1,1968 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return RegionDisksClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new RegionDisksClient($options); - } - - /** @test */ - public function addResourcePoliciesTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/addResourcePoliciesTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/addResourcePoliciesTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $disk = 'disk3083677'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionDisksAddResourcePoliciesRequestResource = new RegionDisksAddResourcePoliciesRequest(); - $response = $gapicClient->addResourcePolicies($disk, $project, $region, $regionDisksAddResourcePoliciesRequestResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionDisks/AddResourcePolicies', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getDisk(); - $this->assertProtobufEquals($disk, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getRegionDisksAddResourcePoliciesRequestResource(); - $this->assertProtobufEquals($regionDisksAddResourcePoliciesRequestResource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function addResourcePoliciesExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/addResourcePoliciesExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $disk = 'disk3083677'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionDisksAddResourcePoliciesRequestResource = new RegionDisksAddResourcePoliciesRequest(); - $response = $gapicClient->addResourcePolicies($disk, $project, $region, $regionDisksAddResourcePoliciesRequestResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 bulkInsertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/bulkInsertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/bulkInsertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $bulkInsertDiskResourceResource = new BulkInsertDiskResource(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->bulkInsert($bulkInsertDiskResourceResource, $project, $region); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionDisks/BulkInsert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getBulkInsertDiskResourceResource(); - $this->assertProtobufEquals($bulkInsertDiskResourceResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function bulkInsertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/bulkInsertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $bulkInsertDiskResourceResource = new BulkInsertDiskResource(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->bulkInsert($bulkInsertDiskResourceResource, $project, $region); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 createSnapshotTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/createSnapshotTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/createSnapshotTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $disk = 'disk3083677'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $snapshotResource = new Snapshot(); - $response = $gapicClient->createSnapshot($disk, $project, $region, $snapshotResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionDisks/CreateSnapshot', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getDisk(); - $this->assertProtobufEquals($disk, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getSnapshotResource(); - $this->assertProtobufEquals($snapshotResource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function createSnapshotExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/createSnapshotExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $disk = 'disk3083677'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $snapshotResource = new Snapshot(); - $response = $gapicClient->createSnapshot($disk, $project, $region, $snapshotResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $disk = 'disk3083677'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->delete($disk, $project, $region); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionDisks/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getDisk(); - $this->assertProtobufEquals($disk, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $disk = 'disk3083677'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->delete($disk, $project, $region); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $accessMode = 'accessMode-1032586338'; - $architecture = 'architecture839674195'; - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $enableConfidentialCompute = true; - $id = 3355; - $kind = 'kind3292052'; - $labelFingerprint = 'labelFingerprint714995737'; - $lastAttachTimestamp = 'lastAttachTimestamp-2105323995'; - $lastDetachTimestamp = 'lastDetachTimestamp-480399885'; - $locationHint = 'locationHint-1796964143'; - $name = 'name3373707'; - $options = 'options-1249474914'; - $physicalBlockSizeBytes = 1190604793; - $provisionedIops = 1260510932; - $provisionedThroughput = 1600266005; - $region2 = 'region2-690338393'; - $satisfiesPzi = false; - $satisfiesPzs = false; - $selfLink = 'selfLink-1691268851'; - $sizeGb = 2105542105; - $sourceConsistencyGroupPolicy = 'sourceConsistencyGroupPolicy19616093'; - $sourceConsistencyGroupPolicyId = 'sourceConsistencyGroupPolicyId267568957'; - $sourceDisk = 'sourceDisk-85117119'; - $sourceDiskId = 'sourceDiskId-1693292839'; - $sourceImage = 'sourceImage1661056055'; - $sourceImageId = 'sourceImageId-2092155357'; - $sourceInstantSnapshot = 'sourceInstantSnapshot-317668858'; - $sourceInstantSnapshotId = 'sourceInstantSnapshotId-1859900940'; - $sourceSnapshot = 'sourceSnapshot-947679896'; - $sourceSnapshotId = 'sourceSnapshotId-1511650478'; - $sourceStorageObject = 'sourceStorageObject-303818201'; - $status = 'status-892481550'; - $storagePool = 'storagePool897344352'; - $type = 'type3575610'; - $zone = 'zone3744684'; - $expectedResponse = new Disk(); - $expectedResponse->setAccessMode($accessMode); - $expectedResponse->setArchitecture($architecture); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setEnableConfidentialCompute($enableConfidentialCompute); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setLabelFingerprint($labelFingerprint); - $expectedResponse->setLastAttachTimestamp($lastAttachTimestamp); - $expectedResponse->setLastDetachTimestamp($lastDetachTimestamp); - $expectedResponse->setLocationHint($locationHint); - $expectedResponse->setName($name); - $expectedResponse->setOptions($options); - $expectedResponse->setPhysicalBlockSizeBytes($physicalBlockSizeBytes); - $expectedResponse->setProvisionedIops($provisionedIops); - $expectedResponse->setProvisionedThroughput($provisionedThroughput); - $expectedResponse->setRegion($region2); - $expectedResponse->setSatisfiesPzi($satisfiesPzi); - $expectedResponse->setSatisfiesPzs($satisfiesPzs); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setSizeGb($sizeGb); - $expectedResponse->setSourceConsistencyGroupPolicy($sourceConsistencyGroupPolicy); - $expectedResponse->setSourceConsistencyGroupPolicyId($sourceConsistencyGroupPolicyId); - $expectedResponse->setSourceDisk($sourceDisk); - $expectedResponse->setSourceDiskId($sourceDiskId); - $expectedResponse->setSourceImage($sourceImage); - $expectedResponse->setSourceImageId($sourceImageId); - $expectedResponse->setSourceInstantSnapshot($sourceInstantSnapshot); - $expectedResponse->setSourceInstantSnapshotId($sourceInstantSnapshotId); - $expectedResponse->setSourceSnapshot($sourceSnapshot); - $expectedResponse->setSourceSnapshotId($sourceSnapshotId); - $expectedResponse->setSourceStorageObject($sourceStorageObject); - $expectedResponse->setStatus($status); - $expectedResponse->setStoragePool($storagePool); - $expectedResponse->setType($type); - $expectedResponse->setZone($zone); - $transport->addResponse($expectedResponse); - // Mock request - $disk = 'disk3083677'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->get($disk, $project, $region); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionDisks/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getDisk(); - $this->assertProtobufEquals($disk, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $disk = 'disk3083677'; - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->get($disk, $project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $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 - $etag = 'etag3123477'; - $iamOwned = false; - $version = 351608024; - $expectedResponse = new Policy(); - $expectedResponse->setEtag($etag); - $expectedResponse->setIamOwned($iamOwned); - $expectedResponse->setVersion($version); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $resource = 'resource-341064690'; - $response = $gapicClient->getIamPolicy($project, $region, $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.compute.v1.RegionDisks/GetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $resource = 'resource-341064690'; - try { - $gapicClient->getIamPolicy($project, $region, $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 insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $diskResource = new Disk(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->insert($diskResource, $project, $region); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionDisks/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getDiskResource(); - $this->assertProtobufEquals($diskResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $diskResource = new Disk(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->insert($diskResource, $project, $region); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new Disk(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new DiskList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->list($project, $region); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionDisks/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->list($project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function removeResourcePoliciesTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/removeResourcePoliciesTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/removeResourcePoliciesTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $disk = 'disk3083677'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionDisksRemoveResourcePoliciesRequestResource = new RegionDisksRemoveResourcePoliciesRequest(); - $response = $gapicClient->removeResourcePolicies($disk, $project, $region, $regionDisksRemoveResourcePoliciesRequestResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionDisks/RemoveResourcePolicies', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getDisk(); - $this->assertProtobufEquals($disk, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getRegionDisksRemoveResourcePoliciesRequestResource(); - $this->assertProtobufEquals($regionDisksRemoveResourcePoliciesRequestResource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function removeResourcePoliciesExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/removeResourcePoliciesExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $disk = 'disk3083677'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionDisksRemoveResourcePoliciesRequestResource = new RegionDisksRemoveResourcePoliciesRequest(); - $response = $gapicClient->removeResourcePolicies($disk, $project, $region, $regionDisksRemoveResourcePoliciesRequestResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 resizeTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/resizeTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/resizeTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $disk = 'disk3083677'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionDisksResizeRequestResource = new RegionDisksResizeRequest(); - $response = $gapicClient->resize($disk, $project, $region, $regionDisksResizeRequestResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionDisks/Resize', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getDisk(); - $this->assertProtobufEquals($disk, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getRegionDisksResizeRequestResource(); - $this->assertProtobufEquals($regionDisksResizeRequestResource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function resizeExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/resizeExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $disk = 'disk3083677'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionDisksResizeRequestResource = new RegionDisksResizeRequest(); - $response = $gapicClient->resize($disk, $project, $region, $regionDisksResizeRequestResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 - $etag = 'etag3123477'; - $iamOwned = false; - $version = 351608024; - $expectedResponse = new Policy(); - $expectedResponse->setEtag($etag); - $expectedResponse->setIamOwned($iamOwned); - $expectedResponse->setVersion($version); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionSetPolicyRequestResource = new RegionSetPolicyRequest(); - $resource = 'resource-341064690'; - $response = $gapicClient->setIamPolicy($project, $region, $regionSetPolicyRequestResource, $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.compute.v1.RegionDisks/SetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualRequestObject->getRegionSetPolicyRequestResource(); - $this->assertProtobufEquals($regionSetPolicyRequestResource, $actualValue); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionSetPolicyRequestResource = new RegionSetPolicyRequest(); - $resource = 'resource-341064690'; - try { - $gapicClient->setIamPolicy($project, $region, $regionSetPolicyRequestResource, $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 setLabelsTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setLabelsTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/setLabelsTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionSetLabelsRequestResource = new RegionSetLabelsRequest(); - $resource = 'resource-341064690'; - $response = $gapicClient->setLabels($project, $region, $regionSetLabelsRequestResource, $resource); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionDisks/SetLabels', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getRegionSetLabelsRequestResource(); - $this->assertProtobufEquals($regionSetLabelsRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setLabelsExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setLabelsExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionSetLabelsRequestResource = new RegionSetLabelsRequest(); - $resource = 'resource-341064690'; - $response = $gapicClient->setLabels($project, $region, $regionSetLabelsRequestResource, $resource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 startAsyncReplicationTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/startAsyncReplicationTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/startAsyncReplicationTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $disk = 'disk3083677'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionDisksStartAsyncReplicationRequestResource = new RegionDisksStartAsyncReplicationRequest(); - $response = $gapicClient->startAsyncReplication($disk, $project, $region, $regionDisksStartAsyncReplicationRequestResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionDisks/StartAsyncReplication', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getDisk(); - $this->assertProtobufEquals($disk, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getRegionDisksStartAsyncReplicationRequestResource(); - $this->assertProtobufEquals($regionDisksStartAsyncReplicationRequestResource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function startAsyncReplicationExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/startAsyncReplicationExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $disk = 'disk3083677'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionDisksStartAsyncReplicationRequestResource = new RegionDisksStartAsyncReplicationRequest(); - $response = $gapicClient->startAsyncReplication($disk, $project, $region, $regionDisksStartAsyncReplicationRequestResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 stopAsyncReplicationTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/stopAsyncReplicationTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/stopAsyncReplicationTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $disk = 'disk3083677'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->stopAsyncReplication($disk, $project, $region); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionDisks/StopAsyncReplication', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getDisk(); - $this->assertProtobufEquals($disk, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function stopAsyncReplicationExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/stopAsyncReplicationExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $disk = 'disk3083677'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->stopAsyncReplication($disk, $project, $region); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 stopGroupAsyncReplicationTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/stopGroupAsyncReplicationTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/stopGroupAsyncReplicationTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $disksStopGroupAsyncReplicationResourceResource = new DisksStopGroupAsyncReplicationResource(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->stopGroupAsyncReplication($disksStopGroupAsyncReplicationResourceResource, $project, $region); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionDisks/StopGroupAsyncReplication', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getDisksStopGroupAsyncReplicationResourceResource(); - $this->assertProtobufEquals($disksStopGroupAsyncReplicationResourceResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function stopGroupAsyncReplicationExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/stopGroupAsyncReplicationExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $disksStopGroupAsyncReplicationResourceResource = new DisksStopGroupAsyncReplicationResource(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->stopGroupAsyncReplication($disksStopGroupAsyncReplicationResourceResource, $project, $region); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 testIamPermissionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new TestPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $resource = 'resource-341064690'; - $testPermissionsRequestResource = new TestPermissionsRequest(); - $response = $gapicClient->testIamPermissions($project, $region, $resource, $testPermissionsRequestResource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionDisks/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getTestPermissionsRequestResource(); - $this->assertProtobufEquals($testPermissionsRequestResource, $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $resource = 'resource-341064690'; - $testPermissionsRequestResource = new TestPermissionsRequest(); - try { - $gapicClient->testIamPermissions($project, $region, $resource, $testPermissionsRequestResource); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/updateTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/updateTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $disk = 'disk3083677'; - $diskResource = new Disk(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->update($disk, $diskResource, $project, $region); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionDisks/Update', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getDisk(); - $this->assertProtobufEquals($disk, $actualValue); - $actualValue = $actualApiRequestObject->getDiskResource(); - $this->assertProtobufEquals($diskResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function updateExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/updateExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $disk = 'disk3083677'; - $diskResource = new Disk(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->update($disk, $diskResource, $project, $region); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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/Compute/tests/Unit/V1/RegionHealthCheckServicesClientTest.php b/Compute/tests/Unit/V1/RegionHealthCheckServicesClientTest.php deleted file mode 100644 index 2f370e2ca7d4..000000000000 --- a/Compute/tests/Unit/V1/RegionHealthCheckServicesClientTest.php +++ /dev/null @@ -1,589 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return RegionHealthCheckServicesClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new RegionHealthCheckServicesClient($options); - } - - /** @test */ - public function deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $healthCheckService = 'healthCheckService-665367077'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->delete($healthCheckService, $project, $region); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionHealthCheckServices/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getHealthCheckService(); - $this->assertProtobufEquals($healthCheckService, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $healthCheckService = 'healthCheckService-665367077'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->delete($healthCheckService, $project, $region); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $fingerprint = 'fingerprint-1375934236'; - $healthStatusAggregationPolicy = 'healthStatusAggregationPolicy-820578695'; - $id = 3355; - $kind = 'kind3292052'; - $name = 'name3373707'; - $region2 = 'region2-690338393'; - $selfLink = 'selfLink-1691268851'; - $expectedResponse = new HealthCheckService(); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setFingerprint($fingerprint); - $expectedResponse->setHealthStatusAggregationPolicy($healthStatusAggregationPolicy); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setName($name); - $expectedResponse->setRegion($region2); - $expectedResponse->setSelfLink($selfLink); - $transport->addResponse($expectedResponse); - // Mock request - $healthCheckService = 'healthCheckService-665367077'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->get($healthCheckService, $project, $region); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionHealthCheckServices/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getHealthCheckService(); - $this->assertProtobufEquals($healthCheckService, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $healthCheckService = 'healthCheckService-665367077'; - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->get($healthCheckService, $project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $healthCheckServiceResource = new HealthCheckService(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->insert($healthCheckServiceResource, $project, $region); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionHealthCheckServices/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getHealthCheckServiceResource(); - $this->assertProtobufEquals($healthCheckServiceResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $healthCheckServiceResource = new HealthCheckService(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->insert($healthCheckServiceResource, $project, $region); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new HealthCheckService(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new HealthCheckServicesList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->list($project, $region); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionHealthCheckServices/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->list($project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function patchTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/patchTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $healthCheckService = 'healthCheckService-665367077'; - $healthCheckServiceResource = new HealthCheckService(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->patch($healthCheckService, $healthCheckServiceResource, $project, $region); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionHealthCheckServices/Patch', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getHealthCheckService(); - $this->assertProtobufEquals($healthCheckService, $actualValue); - $actualValue = $actualApiRequestObject->getHealthCheckServiceResource(); - $this->assertProtobufEquals($healthCheckServiceResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function patchExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $healthCheckService = 'healthCheckService-665367077'; - $healthCheckServiceResource = new HealthCheckService(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->patch($healthCheckService, $healthCheckServiceResource, $project, $region); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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/Compute/tests/Unit/V1/RegionHealthChecksClientTest.php b/Compute/tests/Unit/V1/RegionHealthChecksClientTest.php deleted file mode 100644 index 2a710c78f51b..000000000000 --- a/Compute/tests/Unit/V1/RegionHealthChecksClientTest.php +++ /dev/null @@ -1,718 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return RegionHealthChecksClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new RegionHealthChecksClient($options); - } - - /** @test */ - public function deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $healthCheck = 'healthCheck845747557'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->delete($healthCheck, $project, $region); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionHealthChecks/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getHealthCheck(); - $this->assertProtobufEquals($healthCheck, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $healthCheck = 'healthCheck845747557'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->delete($healthCheck, $project, $region); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $checkIntervalSec = 345561006; - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $healthyThreshold = 133658551; - $id = 3355; - $kind = 'kind3292052'; - $name = 'name3373707'; - $region2 = 'region2-690338393'; - $selfLink = 'selfLink-1691268851'; - $timeoutSec = 2067488653; - $type = 'type3575610'; - $unhealthyThreshold = 1838571216; - $expectedResponse = new HealthCheck(); - $expectedResponse->setCheckIntervalSec($checkIntervalSec); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setHealthyThreshold($healthyThreshold); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setName($name); - $expectedResponse->setRegion($region2); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setTimeoutSec($timeoutSec); - $expectedResponse->setType($type); - $expectedResponse->setUnhealthyThreshold($unhealthyThreshold); - $transport->addResponse($expectedResponse); - // Mock request - $healthCheck = 'healthCheck845747557'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->get($healthCheck, $project, $region); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionHealthChecks/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getHealthCheck(); - $this->assertProtobufEquals($healthCheck, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $healthCheck = 'healthCheck845747557'; - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->get($healthCheck, $project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $healthCheckResource = new HealthCheck(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->insert($healthCheckResource, $project, $region); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionHealthChecks/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getHealthCheckResource(); - $this->assertProtobufEquals($healthCheckResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $healthCheckResource = new HealthCheck(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->insert($healthCheckResource, $project, $region); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new HealthCheck(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new HealthCheckList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->list($project, $region); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionHealthChecks/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->list($project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function patchTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/patchTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $healthCheck = 'healthCheck845747557'; - $healthCheckResource = new HealthCheck(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->patch($healthCheck, $healthCheckResource, $project, $region); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionHealthChecks/Patch', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getHealthCheck(); - $this->assertProtobufEquals($healthCheck, $actualValue); - $actualValue = $actualApiRequestObject->getHealthCheckResource(); - $this->assertProtobufEquals($healthCheckResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function patchExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $healthCheck = 'healthCheck845747557'; - $healthCheckResource = new HealthCheck(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->patch($healthCheck, $healthCheckResource, $project, $region); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 updateTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/updateTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/updateTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $healthCheck = 'healthCheck845747557'; - $healthCheckResource = new HealthCheck(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->update($healthCheck, $healthCheckResource, $project, $region); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionHealthChecks/Update', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getHealthCheck(); - $this->assertProtobufEquals($healthCheck, $actualValue); - $actualValue = $actualApiRequestObject->getHealthCheckResource(); - $this->assertProtobufEquals($healthCheckResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function updateExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/updateExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $healthCheck = 'healthCheck845747557'; - $healthCheckResource = new HealthCheck(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->update($healthCheck, $healthCheckResource, $project, $region); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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/Compute/tests/Unit/V1/RegionInstanceGroupManagersClientTest.php b/Compute/tests/Unit/V1/RegionInstanceGroupManagersClientTest.php deleted file mode 100644 index d656f4189ef4..000000000000 --- a/Compute/tests/Unit/V1/RegionInstanceGroupManagersClientTest.php +++ /dev/null @@ -1,2700 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return RegionInstanceGroupManagersClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new RegionInstanceGroupManagersClient($options); - } - - /** @test */ - public function abandonInstancesTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/abandonInstancesTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/abandonInstancesTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionInstanceGroupManagersAbandonInstancesRequestResource = new RegionInstanceGroupManagersAbandonInstancesRequest(); - $response = $gapicClient->abandonInstances($instanceGroupManager, $project, $region, $regionInstanceGroupManagersAbandonInstancesRequestResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionInstanceGroupManagers/AbandonInstances', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstanceGroupManager(); - $this->assertProtobufEquals($instanceGroupManager, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getRegionInstanceGroupManagersAbandonInstancesRequestResource(); - $this->assertProtobufEquals($regionInstanceGroupManagersAbandonInstancesRequestResource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function abandonInstancesExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/abandonInstancesExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionInstanceGroupManagersAbandonInstancesRequestResource = new RegionInstanceGroupManagersAbandonInstancesRequest(); - $response = $gapicClient->abandonInstances($instanceGroupManager, $project, $region, $regionInstanceGroupManagersAbandonInstancesRequestResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 applyUpdatesToInstancesTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/applyUpdatesToInstancesTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/applyUpdatesToInstancesTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionInstanceGroupManagersApplyUpdatesRequestResource = new RegionInstanceGroupManagersApplyUpdatesRequest(); - $response = $gapicClient->applyUpdatesToInstances($instanceGroupManager, $project, $region, $regionInstanceGroupManagersApplyUpdatesRequestResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionInstanceGroupManagers/ApplyUpdatesToInstances', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstanceGroupManager(); - $this->assertProtobufEquals($instanceGroupManager, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getRegionInstanceGroupManagersApplyUpdatesRequestResource(); - $this->assertProtobufEquals($regionInstanceGroupManagersApplyUpdatesRequestResource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function applyUpdatesToInstancesExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/applyUpdatesToInstancesExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionInstanceGroupManagersApplyUpdatesRequestResource = new RegionInstanceGroupManagersApplyUpdatesRequest(); - $response = $gapicClient->applyUpdatesToInstances($instanceGroupManager, $project, $region, $regionInstanceGroupManagersApplyUpdatesRequestResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 createInstancesTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/createInstancesTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/createInstancesTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionInstanceGroupManagersCreateInstancesRequestResource = new RegionInstanceGroupManagersCreateInstancesRequest(); - $response = $gapicClient->createInstances($instanceGroupManager, $project, $region, $regionInstanceGroupManagersCreateInstancesRequestResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionInstanceGroupManagers/CreateInstances', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstanceGroupManager(); - $this->assertProtobufEquals($instanceGroupManager, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getRegionInstanceGroupManagersCreateInstancesRequestResource(); - $this->assertProtobufEquals($regionInstanceGroupManagersCreateInstancesRequestResource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function createInstancesExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/createInstancesExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionInstanceGroupManagersCreateInstancesRequestResource = new RegionInstanceGroupManagersCreateInstancesRequest(); - $response = $gapicClient->createInstances($instanceGroupManager, $project, $region, $regionInstanceGroupManagersCreateInstancesRequestResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->delete($instanceGroupManager, $project, $region); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionInstanceGroupManagers/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstanceGroupManager(); - $this->assertProtobufEquals($instanceGroupManager, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->delete($instanceGroupManager, $project, $region); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 deleteInstancesTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteInstancesTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteInstancesTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionInstanceGroupManagersDeleteInstancesRequestResource = new RegionInstanceGroupManagersDeleteInstancesRequest(); - $response = $gapicClient->deleteInstances($instanceGroupManager, $project, $region, $regionInstanceGroupManagersDeleteInstancesRequestResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionInstanceGroupManagers/DeleteInstances', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstanceGroupManager(); - $this->assertProtobufEquals($instanceGroupManager, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getRegionInstanceGroupManagersDeleteInstancesRequestResource(); - $this->assertProtobufEquals($regionInstanceGroupManagersDeleteInstancesRequestResource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteInstancesExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteInstancesExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionInstanceGroupManagersDeleteInstancesRequestResource = new RegionInstanceGroupManagersDeleteInstancesRequest(); - $response = $gapicClient->deleteInstances($instanceGroupManager, $project, $region, $regionInstanceGroupManagersDeleteInstancesRequestResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 deletePerInstanceConfigsTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deletePerInstanceConfigsTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deletePerInstanceConfigsTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionInstanceGroupManagerDeleteInstanceConfigReqResource = new RegionInstanceGroupManagerDeleteInstanceConfigReq(); - $response = $gapicClient->deletePerInstanceConfigs($instanceGroupManager, $project, $region, $regionInstanceGroupManagerDeleteInstanceConfigReqResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionInstanceGroupManagers/DeletePerInstanceConfigs', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstanceGroupManager(); - $this->assertProtobufEquals($instanceGroupManager, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getRegionInstanceGroupManagerDeleteInstanceConfigReqResource(); - $this->assertProtobufEquals($regionInstanceGroupManagerDeleteInstanceConfigReqResource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deletePerInstanceConfigsExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deletePerInstanceConfigsExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionInstanceGroupManagerDeleteInstanceConfigReqResource = new RegionInstanceGroupManagerDeleteInstanceConfigReq(); - $response = $gapicClient->deletePerInstanceConfigs($instanceGroupManager, $project, $region, $regionInstanceGroupManagerDeleteInstanceConfigReqResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $baseInstanceName = 'baseInstanceName389106439'; - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $fingerprint = 'fingerprint-1375934236'; - $id = 3355; - $instanceGroup = 'instanceGroup81095253'; - $instanceTemplate = 'instanceTemplate309248228'; - $kind = 'kind3292052'; - $listManagedInstancesResults = 'listManagedInstancesResults832918068'; - $name = 'name3373707'; - $region2 = 'region2-690338393'; - $satisfiesPzi = false; - $satisfiesPzs = false; - $selfLink = 'selfLink-1691268851'; - $targetSize = 2084603409; - $targetStoppedSize = 1613032225; - $targetSuspendedSize = 765655981; - $zone = 'zone3744684'; - $expectedResponse = new InstanceGroupManager(); - $expectedResponse->setBaseInstanceName($baseInstanceName); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setFingerprint($fingerprint); - $expectedResponse->setId($id); - $expectedResponse->setInstanceGroup($instanceGroup); - $expectedResponse->setInstanceTemplate($instanceTemplate); - $expectedResponse->setKind($kind); - $expectedResponse->setListManagedInstancesResults($listManagedInstancesResults); - $expectedResponse->setName($name); - $expectedResponse->setRegion($region2); - $expectedResponse->setSatisfiesPzi($satisfiesPzi); - $expectedResponse->setSatisfiesPzs($satisfiesPzs); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setTargetSize($targetSize); - $expectedResponse->setTargetStoppedSize($targetStoppedSize); - $expectedResponse->setTargetSuspendedSize($targetSuspendedSize); - $expectedResponse->setZone($zone); - $transport->addResponse($expectedResponse); - // Mock request - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->get($instanceGroupManager, $project, $region); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionInstanceGroupManagers/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getInstanceGroupManager(); - $this->assertProtobufEquals($instanceGroupManager, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->get($instanceGroupManager, $project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instanceGroupManagerResource = new InstanceGroupManager(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->insert($instanceGroupManagerResource, $project, $region); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionInstanceGroupManagers/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstanceGroupManagerResource(); - $this->assertProtobufEquals($instanceGroupManagerResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instanceGroupManagerResource = new InstanceGroupManager(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->insert($instanceGroupManagerResource, $project, $region); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new InstanceGroupManager(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new RegionInstanceGroupManagerList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->list($project, $region); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionInstanceGroupManagers/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->list($project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listErrorsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $itemsElement = new InstanceManagedByIgmError(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new RegionInstanceGroupManagersListErrorsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->listErrors($instanceGroupManager, $project, $region); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionInstanceGroupManagers/ListErrors', $actualFuncCall); - $actualValue = $actualRequestObject->getInstanceGroupManager(); - $this->assertProtobufEquals($instanceGroupManager, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listErrorsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->listErrors($instanceGroupManager, $project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listManagedInstancesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $managedInstancesElement = new ManagedInstance(); - $managedInstances = [ - $managedInstancesElement, - ]; - $expectedResponse = new RegionInstanceGroupManagersListInstancesResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setManagedInstances($managedInstances); - $transport->addResponse($expectedResponse); - // Mock request - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->listManagedInstances($instanceGroupManager, $project, $region); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getManagedInstances()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionInstanceGroupManagers/ListManagedInstances', $actualFuncCall); - $actualValue = $actualRequestObject->getInstanceGroupManager(); - $this->assertProtobufEquals($instanceGroupManager, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listManagedInstancesExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->listManagedInstances($instanceGroupManager, $project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listPerInstanceConfigsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $itemsElement = new PerInstanceConfig(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new RegionInstanceGroupManagersListInstanceConfigsResp(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->listPerInstanceConfigs($instanceGroupManager, $project, $region); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionInstanceGroupManagers/ListPerInstanceConfigs', $actualFuncCall); - $actualValue = $actualRequestObject->getInstanceGroupManager(); - $this->assertProtobufEquals($instanceGroupManager, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listPerInstanceConfigsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->listPerInstanceConfigs($instanceGroupManager, $project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function patchTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/patchTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $instanceGroupManagerResource = new InstanceGroupManager(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->patch($instanceGroupManager, $instanceGroupManagerResource, $project, $region); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionInstanceGroupManagers/Patch', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstanceGroupManager(); - $this->assertProtobufEquals($instanceGroupManager, $actualValue); - $actualValue = $actualApiRequestObject->getInstanceGroupManagerResource(); - $this->assertProtobufEquals($instanceGroupManagerResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function patchExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $instanceGroupManagerResource = new InstanceGroupManager(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->patch($instanceGroupManager, $instanceGroupManagerResource, $project, $region); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 patchPerInstanceConfigsTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchPerInstanceConfigsTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/patchPerInstanceConfigsTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionInstanceGroupManagerPatchInstanceConfigReqResource = new RegionInstanceGroupManagerPatchInstanceConfigReq(); - $response = $gapicClient->patchPerInstanceConfigs($instanceGroupManager, $project, $region, $regionInstanceGroupManagerPatchInstanceConfigReqResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionInstanceGroupManagers/PatchPerInstanceConfigs', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstanceGroupManager(); - $this->assertProtobufEquals($instanceGroupManager, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getRegionInstanceGroupManagerPatchInstanceConfigReqResource(); - $this->assertProtobufEquals($regionInstanceGroupManagerPatchInstanceConfigReqResource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function patchPerInstanceConfigsExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchPerInstanceConfigsExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionInstanceGroupManagerPatchInstanceConfigReqResource = new RegionInstanceGroupManagerPatchInstanceConfigReq(); - $response = $gapicClient->patchPerInstanceConfigs($instanceGroupManager, $project, $region, $regionInstanceGroupManagerPatchInstanceConfigReqResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 recreateInstancesTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/recreateInstancesTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/recreateInstancesTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionInstanceGroupManagersRecreateRequestResource = new RegionInstanceGroupManagersRecreateRequest(); - $response = $gapicClient->recreateInstances($instanceGroupManager, $project, $region, $regionInstanceGroupManagersRecreateRequestResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionInstanceGroupManagers/RecreateInstances', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstanceGroupManager(); - $this->assertProtobufEquals($instanceGroupManager, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getRegionInstanceGroupManagersRecreateRequestResource(); - $this->assertProtobufEquals($regionInstanceGroupManagersRecreateRequestResource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function recreateInstancesExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/recreateInstancesExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionInstanceGroupManagersRecreateRequestResource = new RegionInstanceGroupManagersRecreateRequest(); - $response = $gapicClient->recreateInstances($instanceGroupManager, $project, $region, $regionInstanceGroupManagersRecreateRequestResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 resizeTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/resizeTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/resizeTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $size = 3530753; - $response = $gapicClient->resize($instanceGroupManager, $project, $region, $size); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionInstanceGroupManagers/Resize', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstanceGroupManager(); - $this->assertProtobufEquals($instanceGroupManager, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getSize(); - $this->assertProtobufEquals($size, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function resizeExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/resizeExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $size = 3530753; - $response = $gapicClient->resize($instanceGroupManager, $project, $region, $size); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 resumeInstancesTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/resumeInstancesTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/resumeInstancesTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionInstanceGroupManagersResumeInstancesRequestResource = new RegionInstanceGroupManagersResumeInstancesRequest(); - $response = $gapicClient->resumeInstances($instanceGroupManager, $project, $region, $regionInstanceGroupManagersResumeInstancesRequestResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionInstanceGroupManagers/ResumeInstances', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstanceGroupManager(); - $this->assertProtobufEquals($instanceGroupManager, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getRegionInstanceGroupManagersResumeInstancesRequestResource(); - $this->assertProtobufEquals($regionInstanceGroupManagersResumeInstancesRequestResource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function resumeInstancesExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/resumeInstancesExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionInstanceGroupManagersResumeInstancesRequestResource = new RegionInstanceGroupManagersResumeInstancesRequest(); - $response = $gapicClient->resumeInstances($instanceGroupManager, $project, $region, $regionInstanceGroupManagersResumeInstancesRequestResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 setInstanceTemplateTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setInstanceTemplateTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/setInstanceTemplateTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionInstanceGroupManagersSetTemplateRequestResource = new RegionInstanceGroupManagersSetTemplateRequest(); - $response = $gapicClient->setInstanceTemplate($instanceGroupManager, $project, $region, $regionInstanceGroupManagersSetTemplateRequestResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionInstanceGroupManagers/SetInstanceTemplate', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstanceGroupManager(); - $this->assertProtobufEquals($instanceGroupManager, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getRegionInstanceGroupManagersSetTemplateRequestResource(); - $this->assertProtobufEquals($regionInstanceGroupManagersSetTemplateRequestResource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setInstanceTemplateExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setInstanceTemplateExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionInstanceGroupManagersSetTemplateRequestResource = new RegionInstanceGroupManagersSetTemplateRequest(); - $response = $gapicClient->setInstanceTemplate($instanceGroupManager, $project, $region, $regionInstanceGroupManagersSetTemplateRequestResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 setTargetPoolsTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setTargetPoolsTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/setTargetPoolsTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionInstanceGroupManagersSetTargetPoolsRequestResource = new RegionInstanceGroupManagersSetTargetPoolsRequest(); - $response = $gapicClient->setTargetPools($instanceGroupManager, $project, $region, $regionInstanceGroupManagersSetTargetPoolsRequestResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionInstanceGroupManagers/SetTargetPools', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstanceGroupManager(); - $this->assertProtobufEquals($instanceGroupManager, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getRegionInstanceGroupManagersSetTargetPoolsRequestResource(); - $this->assertProtobufEquals($regionInstanceGroupManagersSetTargetPoolsRequestResource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setTargetPoolsExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setTargetPoolsExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionInstanceGroupManagersSetTargetPoolsRequestResource = new RegionInstanceGroupManagersSetTargetPoolsRequest(); - $response = $gapicClient->setTargetPools($instanceGroupManager, $project, $region, $regionInstanceGroupManagersSetTargetPoolsRequestResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 startInstancesTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/startInstancesTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/startInstancesTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionInstanceGroupManagersStartInstancesRequestResource = new RegionInstanceGroupManagersStartInstancesRequest(); - $response = $gapicClient->startInstances($instanceGroupManager, $project, $region, $regionInstanceGroupManagersStartInstancesRequestResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionInstanceGroupManagers/StartInstances', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstanceGroupManager(); - $this->assertProtobufEquals($instanceGroupManager, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getRegionInstanceGroupManagersStartInstancesRequestResource(); - $this->assertProtobufEquals($regionInstanceGroupManagersStartInstancesRequestResource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function startInstancesExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/startInstancesExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionInstanceGroupManagersStartInstancesRequestResource = new RegionInstanceGroupManagersStartInstancesRequest(); - $response = $gapicClient->startInstances($instanceGroupManager, $project, $region, $regionInstanceGroupManagersStartInstancesRequestResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 stopInstancesTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/stopInstancesTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/stopInstancesTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionInstanceGroupManagersStopInstancesRequestResource = new RegionInstanceGroupManagersStopInstancesRequest(); - $response = $gapicClient->stopInstances($instanceGroupManager, $project, $region, $regionInstanceGroupManagersStopInstancesRequestResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionInstanceGroupManagers/StopInstances', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstanceGroupManager(); - $this->assertProtobufEquals($instanceGroupManager, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getRegionInstanceGroupManagersStopInstancesRequestResource(); - $this->assertProtobufEquals($regionInstanceGroupManagersStopInstancesRequestResource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function stopInstancesExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/stopInstancesExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionInstanceGroupManagersStopInstancesRequestResource = new RegionInstanceGroupManagersStopInstancesRequest(); - $response = $gapicClient->stopInstances($instanceGroupManager, $project, $region, $regionInstanceGroupManagersStopInstancesRequestResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 suspendInstancesTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/suspendInstancesTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/suspendInstancesTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionInstanceGroupManagersSuspendInstancesRequestResource = new RegionInstanceGroupManagersSuspendInstancesRequest(); - $response = $gapicClient->suspendInstances($instanceGroupManager, $project, $region, $regionInstanceGroupManagersSuspendInstancesRequestResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionInstanceGroupManagers/SuspendInstances', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstanceGroupManager(); - $this->assertProtobufEquals($instanceGroupManager, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getRegionInstanceGroupManagersSuspendInstancesRequestResource(); - $this->assertProtobufEquals($regionInstanceGroupManagersSuspendInstancesRequestResource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function suspendInstancesExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/suspendInstancesExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionInstanceGroupManagersSuspendInstancesRequestResource = new RegionInstanceGroupManagersSuspendInstancesRequest(); - $response = $gapicClient->suspendInstances($instanceGroupManager, $project, $region, $regionInstanceGroupManagersSuspendInstancesRequestResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 updatePerInstanceConfigsTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/updatePerInstanceConfigsTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/updatePerInstanceConfigsTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionInstanceGroupManagerUpdateInstanceConfigReqResource = new RegionInstanceGroupManagerUpdateInstanceConfigReq(); - $response = $gapicClient->updatePerInstanceConfigs($instanceGroupManager, $project, $region, $regionInstanceGroupManagerUpdateInstanceConfigReqResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionInstanceGroupManagers/UpdatePerInstanceConfigs', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstanceGroupManager(); - $this->assertProtobufEquals($instanceGroupManager, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getRegionInstanceGroupManagerUpdateInstanceConfigReqResource(); - $this->assertProtobufEquals($regionInstanceGroupManagerUpdateInstanceConfigReqResource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function updatePerInstanceConfigsExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/updatePerInstanceConfigsExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instanceGroupManager = 'instanceGroupManager-1361249341'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionInstanceGroupManagerUpdateInstanceConfigReqResource = new RegionInstanceGroupManagerUpdateInstanceConfigReq(); - $response = $gapicClient->updatePerInstanceConfigs($instanceGroupManager, $project, $region, $regionInstanceGroupManagerUpdateInstanceConfigReqResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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/Compute/tests/Unit/V1/RegionInstanceGroupsClientTest.php b/Compute/tests/Unit/V1/RegionInstanceGroupsClientTest.php deleted file mode 100644 index 81eb191655ce..000000000000 --- a/Compute/tests/Unit/V1/RegionInstanceGroupsClientTest.php +++ /dev/null @@ -1,447 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return RegionInstanceGroupsClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new RegionInstanceGroupsClient($options); - } - - /** @test */ - public function getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $fingerprint = 'fingerprint-1375934236'; - $id = 3355; - $kind = 'kind3292052'; - $name = 'name3373707'; - $network = 'network1843485230'; - $region2 = 'region2-690338393'; - $selfLink = 'selfLink-1691268851'; - $size = 3530753; - $subnetwork = 'subnetwork-1302785042'; - $zone = 'zone3744684'; - $expectedResponse = new InstanceGroup(); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setFingerprint($fingerprint); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setName($name); - $expectedResponse->setNetwork($network); - $expectedResponse->setRegion($region2); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setSize($size); - $expectedResponse->setSubnetwork($subnetwork); - $expectedResponse->setZone($zone); - $transport->addResponse($expectedResponse); - // Mock request - $instanceGroup = 'instanceGroup81095253'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->get($instanceGroup, $project, $region); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionInstanceGroups/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getInstanceGroup(); - $this->assertProtobufEquals($instanceGroup, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $instanceGroup = 'instanceGroup81095253'; - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->get($instanceGroup, $project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new InstanceGroup(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new RegionInstanceGroupList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->list($project, $region); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionInstanceGroups/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->list($project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listInstancesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new InstanceWithNamedPorts(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new RegionInstanceGroupsListInstances(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $instanceGroup = 'instanceGroup81095253'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionInstanceGroupsListInstancesRequestResource = new RegionInstanceGroupsListInstancesRequest(); - $response = $gapicClient->listInstances($instanceGroup, $project, $region, $regionInstanceGroupsListInstancesRequestResource); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionInstanceGroups/ListInstances', $actualFuncCall); - $actualValue = $actualRequestObject->getInstanceGroup(); - $this->assertProtobufEquals($instanceGroup, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualRequestObject->getRegionInstanceGroupsListInstancesRequestResource(); - $this->assertProtobufEquals($regionInstanceGroupsListInstancesRequestResource, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listInstancesExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $instanceGroup = 'instanceGroup81095253'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionInstanceGroupsListInstancesRequestResource = new RegionInstanceGroupsListInstancesRequest(); - try { - $gapicClient->listInstances($instanceGroup, $project, $region, $regionInstanceGroupsListInstancesRequestResource); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setNamedPortsTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setNamedPortsTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/setNamedPortsTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instanceGroup = 'instanceGroup81095253'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionInstanceGroupsSetNamedPortsRequestResource = new RegionInstanceGroupsSetNamedPortsRequest(); - $response = $gapicClient->setNamedPorts($instanceGroup, $project, $region, $regionInstanceGroupsSetNamedPortsRequestResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionInstanceGroups/SetNamedPorts', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstanceGroup(); - $this->assertProtobufEquals($instanceGroup, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getRegionInstanceGroupsSetNamedPortsRequestResource(); - $this->assertProtobufEquals($regionInstanceGroupsSetNamedPortsRequestResource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setNamedPortsExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setNamedPortsExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instanceGroup = 'instanceGroup81095253'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionInstanceGroupsSetNamedPortsRequestResource = new RegionInstanceGroupsSetNamedPortsRequest(); - $response = $gapicClient->setNamedPorts($instanceGroup, $project, $region, $regionInstanceGroupsSetNamedPortsRequestResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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/Compute/tests/Unit/V1/RegionInstanceTemplatesClientTest.php b/Compute/tests/Unit/V1/RegionInstanceTemplatesClientTest.php deleted file mode 100644 index bea93c9829c2..000000000000 --- a/Compute/tests/Unit/V1/RegionInstanceTemplatesClientTest.php +++ /dev/null @@ -1,464 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return RegionInstanceTemplatesClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new RegionInstanceTemplatesClient($options); - } - - /** @test */ - public function deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instanceTemplate = 'instanceTemplate309248228'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->delete($instanceTemplate, $project, $region); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionInstanceTemplates/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstanceTemplate(); - $this->assertProtobufEquals($instanceTemplate, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instanceTemplate = 'instanceTemplate309248228'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->delete($instanceTemplate, $project, $region); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $id = 3355; - $kind = 'kind3292052'; - $name = 'name3373707'; - $region2 = 'region2-690338393'; - $selfLink = 'selfLink-1691268851'; - $sourceInstance = 'sourceInstance-677426119'; - $expectedResponse = new InstanceTemplate(); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setName($name); - $expectedResponse->setRegion($region2); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setSourceInstance($sourceInstance); - $transport->addResponse($expectedResponse); - // Mock request - $instanceTemplate = 'instanceTemplate309248228'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->get($instanceTemplate, $project, $region); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionInstanceTemplates/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getInstanceTemplate(); - $this->assertProtobufEquals($instanceTemplate, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $instanceTemplate = 'instanceTemplate309248228'; - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->get($instanceTemplate, $project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instanceTemplateResource = new InstanceTemplate(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->insert($instanceTemplateResource, $project, $region); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionInstanceTemplates/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstanceTemplateResource(); - $this->assertProtobufEquals($instanceTemplateResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instanceTemplateResource = new InstanceTemplate(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->insert($instanceTemplateResource, $project, $region); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new InstanceTemplate(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new InstanceTemplateList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->list($project, $region); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionInstanceTemplates/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->list($project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->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/Compute/tests/Unit/V1/RegionInstancesClientTest.php b/Compute/tests/Unit/V1/RegionInstancesClientTest.php deleted file mode 100644 index 1bcc1bae75c9..000000000000 --- a/Compute/tests/Unit/V1/RegionInstancesClientTest.php +++ /dev/null @@ -1,184 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return RegionInstancesClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new RegionInstancesClient($options); - } - - /** @test */ - public function bulkInsertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/bulkInsertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/bulkInsertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $bulkInsertInstanceResourceResource = new BulkInsertInstanceResource(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->bulkInsert($bulkInsertInstanceResourceResource, $project, $region); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionInstances/BulkInsert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getBulkInsertInstanceResourceResource(); - $this->assertProtobufEquals($bulkInsertInstanceResourceResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function bulkInsertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/bulkInsertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $bulkInsertInstanceResourceResource = new BulkInsertInstanceResource(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->bulkInsert($bulkInsertInstanceResourceResource, $project, $region); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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/Compute/tests/Unit/V1/RegionInstantSnapshotsClientTest.php b/Compute/tests/Unit/V1/RegionInstantSnapshotsClientTest.php deleted file mode 100644 index 27ad19ee65e8..000000000000 --- a/Compute/tests/Unit/V1/RegionInstantSnapshotsClientTest.php +++ /dev/null @@ -1,828 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return RegionInstantSnapshotsClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new RegionInstantSnapshotsClient($options); - } - - /** @test */ - public function deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instantSnapshot = 'instantSnapshot1465380450'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->delete($instantSnapshot, $project, $region); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionInstantSnapshots/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstantSnapshot(); - $this->assertProtobufEquals($instantSnapshot, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instantSnapshot = 'instantSnapshot1465380450'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->delete($instantSnapshot, $project, $region); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $architecture = 'architecture839674195'; - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $diskSizeGb = 757478089; - $id = 3355; - $kind = 'kind3292052'; - $labelFingerprint = 'labelFingerprint714995737'; - $name = 'name3373707'; - $region2 = 'region2-690338393'; - $satisfiesPzi = false; - $satisfiesPzs = false; - $selfLink = 'selfLink-1691268851'; - $selfLinkWithId = 'selfLinkWithId-1029220862'; - $sourceDisk = 'sourceDisk-85117119'; - $sourceDiskId = 'sourceDiskId-1693292839'; - $status = 'status-892481550'; - $zone = 'zone3744684'; - $expectedResponse = new InstantSnapshot(); - $expectedResponse->setArchitecture($architecture); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setDiskSizeGb($diskSizeGb); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setLabelFingerprint($labelFingerprint); - $expectedResponse->setName($name); - $expectedResponse->setRegion($region2); - $expectedResponse->setSatisfiesPzi($satisfiesPzi); - $expectedResponse->setSatisfiesPzs($satisfiesPzs); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setSelfLinkWithId($selfLinkWithId); - $expectedResponse->setSourceDisk($sourceDisk); - $expectedResponse->setSourceDiskId($sourceDiskId); - $expectedResponse->setStatus($status); - $expectedResponse->setZone($zone); - $transport->addResponse($expectedResponse); - // Mock request - $instantSnapshot = 'instantSnapshot1465380450'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->get($instantSnapshot, $project, $region); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionInstantSnapshots/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getInstantSnapshot(); - $this->assertProtobufEquals($instantSnapshot, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $instantSnapshot = 'instantSnapshot1465380450'; - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->get($instantSnapshot, $project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $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 - $etag = 'etag3123477'; - $iamOwned = false; - $version = 351608024; - $expectedResponse = new Policy(); - $expectedResponse->setEtag($etag); - $expectedResponse->setIamOwned($iamOwned); - $expectedResponse->setVersion($version); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $resource = 'resource-341064690'; - $response = $gapicClient->getIamPolicy($project, $region, $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.compute.v1.RegionInstantSnapshots/GetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $resource = 'resource-341064690'; - try { - $gapicClient->getIamPolicy($project, $region, $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 insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $instantSnapshotResource = new InstantSnapshot(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->insert($instantSnapshotResource, $project, $region); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionInstantSnapshots/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getInstantSnapshotResource(); - $this->assertProtobufEquals($instantSnapshotResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $instantSnapshotResource = new InstantSnapshot(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->insert($instantSnapshotResource, $project, $region); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new InstantSnapshot(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new InstantSnapshotList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->list($project, $region); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionInstantSnapshots/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->list($project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $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 - $etag = 'etag3123477'; - $iamOwned = false; - $version = 351608024; - $expectedResponse = new Policy(); - $expectedResponse->setEtag($etag); - $expectedResponse->setIamOwned($iamOwned); - $expectedResponse->setVersion($version); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionSetPolicyRequestResource = new RegionSetPolicyRequest(); - $resource = 'resource-341064690'; - $response = $gapicClient->setIamPolicy($project, $region, $regionSetPolicyRequestResource, $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.compute.v1.RegionInstantSnapshots/SetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualRequestObject->getRegionSetPolicyRequestResource(); - $this->assertProtobufEquals($regionSetPolicyRequestResource, $actualValue); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionSetPolicyRequestResource = new RegionSetPolicyRequest(); - $resource = 'resource-341064690'; - try { - $gapicClient->setIamPolicy($project, $region, $regionSetPolicyRequestResource, $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 setLabelsTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setLabelsTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/setLabelsTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionSetLabelsRequestResource = new RegionSetLabelsRequest(); - $resource = 'resource-341064690'; - $response = $gapicClient->setLabels($project, $region, $regionSetLabelsRequestResource, $resource); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionInstantSnapshots/SetLabels', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getRegionSetLabelsRequestResource(); - $this->assertProtobufEquals($regionSetLabelsRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setLabelsExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setLabelsExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionSetLabelsRequestResource = new RegionSetLabelsRequest(); - $resource = 'resource-341064690'; - $response = $gapicClient->setLabels($project, $region, $regionSetLabelsRequestResource, $resource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 testIamPermissionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new TestPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $resource = 'resource-341064690'; - $testPermissionsRequestResource = new TestPermissionsRequest(); - $response = $gapicClient->testIamPermissions($project, $region, $resource, $testPermissionsRequestResource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionInstantSnapshots/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getTestPermissionsRequestResource(); - $this->assertProtobufEquals($testPermissionsRequestResource, $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $resource = 'resource-341064690'; - $testPermissionsRequestResource = new TestPermissionsRequest(); - try { - $gapicClient->testIamPermissions($project, $region, $resource, $testPermissionsRequestResource); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->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/Compute/tests/Unit/V1/RegionNetworkEndpointGroupsClientTest.php b/Compute/tests/Unit/V1/RegionNetworkEndpointGroupsClientTest.php deleted file mode 100644 index 7868aec9b42d..000000000000 --- a/Compute/tests/Unit/V1/RegionNetworkEndpointGroupsClientTest.php +++ /dev/null @@ -1,806 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return RegionNetworkEndpointGroupsClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new RegionNetworkEndpointGroupsClient($options); - } - - /** @test */ - public function attachNetworkEndpointsTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/attachNetworkEndpointsTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/attachNetworkEndpointsTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $networkEndpointGroup = 'networkEndpointGroup-639834746'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionNetworkEndpointGroupsAttachEndpointsRequestResource = new RegionNetworkEndpointGroupsAttachEndpointsRequest(); - $response = $gapicClient->attachNetworkEndpoints($networkEndpointGroup, $project, $region, $regionNetworkEndpointGroupsAttachEndpointsRequestResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionNetworkEndpointGroups/AttachNetworkEndpoints', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getNetworkEndpointGroup(); - $this->assertProtobufEquals($networkEndpointGroup, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getRegionNetworkEndpointGroupsAttachEndpointsRequestResource(); - $this->assertProtobufEquals($regionNetworkEndpointGroupsAttachEndpointsRequestResource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function attachNetworkEndpointsExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/attachNetworkEndpointsExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $networkEndpointGroup = 'networkEndpointGroup-639834746'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionNetworkEndpointGroupsAttachEndpointsRequestResource = new RegionNetworkEndpointGroupsAttachEndpointsRequest(); - $response = $gapicClient->attachNetworkEndpoints($networkEndpointGroup, $project, $region, $regionNetworkEndpointGroupsAttachEndpointsRequestResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $networkEndpointGroup = 'networkEndpointGroup-639834746'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->delete($networkEndpointGroup, $project, $region); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionNetworkEndpointGroups/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getNetworkEndpointGroup(); - $this->assertProtobufEquals($networkEndpointGroup, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $networkEndpointGroup = 'networkEndpointGroup-639834746'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->delete($networkEndpointGroup, $project, $region); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 detachNetworkEndpointsTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/detachNetworkEndpointsTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/detachNetworkEndpointsTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $networkEndpointGroup = 'networkEndpointGroup-639834746'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionNetworkEndpointGroupsDetachEndpointsRequestResource = new RegionNetworkEndpointGroupsDetachEndpointsRequest(); - $response = $gapicClient->detachNetworkEndpoints($networkEndpointGroup, $project, $region, $regionNetworkEndpointGroupsDetachEndpointsRequestResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionNetworkEndpointGroups/DetachNetworkEndpoints', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getNetworkEndpointGroup(); - $this->assertProtobufEquals($networkEndpointGroup, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getRegionNetworkEndpointGroupsDetachEndpointsRequestResource(); - $this->assertProtobufEquals($regionNetworkEndpointGroupsDetachEndpointsRequestResource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function detachNetworkEndpointsExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/detachNetworkEndpointsExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $networkEndpointGroup = 'networkEndpointGroup-639834746'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionNetworkEndpointGroupsDetachEndpointsRequestResource = new RegionNetworkEndpointGroupsDetachEndpointsRequest(); - $response = $gapicClient->detachNetworkEndpoints($networkEndpointGroup, $project, $region, $regionNetworkEndpointGroupsDetachEndpointsRequestResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $creationTimestamp = 'creationTimestamp567396278'; - $defaultPort = 650363969; - $description = 'description-1724546052'; - $id = 3355; - $kind = 'kind3292052'; - $name = 'name3373707'; - $network = 'network1843485230'; - $networkEndpointType = 'networkEndpointType118301523'; - $pscTargetService = 'pscTargetService1879744870'; - $region2 = 'region2-690338393'; - $selfLink = 'selfLink-1691268851'; - $size = 3530753; - $subnetwork = 'subnetwork-1302785042'; - $zone = 'zone3744684'; - $expectedResponse = new NetworkEndpointGroup(); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDefaultPort($defaultPort); - $expectedResponse->setDescription($description); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setName($name); - $expectedResponse->setNetwork($network); - $expectedResponse->setNetworkEndpointType($networkEndpointType); - $expectedResponse->setPscTargetService($pscTargetService); - $expectedResponse->setRegion($region2); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setSize($size); - $expectedResponse->setSubnetwork($subnetwork); - $expectedResponse->setZone($zone); - $transport->addResponse($expectedResponse); - // Mock request - $networkEndpointGroup = 'networkEndpointGroup-639834746'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->get($networkEndpointGroup, $project, $region); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionNetworkEndpointGroups/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getNetworkEndpointGroup(); - $this->assertProtobufEquals($networkEndpointGroup, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $networkEndpointGroup = 'networkEndpointGroup-639834746'; - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->get($networkEndpointGroup, $project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $networkEndpointGroupResource = new NetworkEndpointGroup(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->insert($networkEndpointGroupResource, $project, $region); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionNetworkEndpointGroups/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getNetworkEndpointGroupResource(); - $this->assertProtobufEquals($networkEndpointGroupResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $networkEndpointGroupResource = new NetworkEndpointGroup(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->insert($networkEndpointGroupResource, $project, $region); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new NetworkEndpointGroup(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new NetworkEndpointGroupList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->list($project, $region); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionNetworkEndpointGroups/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->list($project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listNetworkEndpointsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $itemsElement = new NetworkEndpointWithHealthStatus(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new NetworkEndpointGroupsListNetworkEndpoints(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $networkEndpointGroup = 'networkEndpointGroup-639834746'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->listNetworkEndpoints($networkEndpointGroup, $project, $region); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionNetworkEndpointGroups/ListNetworkEndpoints', $actualFuncCall); - $actualValue = $actualRequestObject->getNetworkEndpointGroup(); - $this->assertProtobufEquals($networkEndpointGroup, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listNetworkEndpointsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $networkEndpointGroup = 'networkEndpointGroup-639834746'; - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->listNetworkEndpoints($networkEndpointGroup, $project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->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/Compute/tests/Unit/V1/RegionNetworkFirewallPoliciesClientTest.php b/Compute/tests/Unit/V1/RegionNetworkFirewallPoliciesClientTest.php deleted file mode 100644 index 66925b76b7c0..000000000000 --- a/Compute/tests/Unit/V1/RegionNetworkFirewallPoliciesClientTest.php +++ /dev/null @@ -1,1776 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return RegionNetworkFirewallPoliciesClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new RegionNetworkFirewallPoliciesClient($options); - } - - /** @test */ - public function addAssociationTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/addAssociationTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/addAssociationTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $firewallPolicy = 'firewallPolicy1035044177'; - $firewallPolicyAssociationResource = new FirewallPolicyAssociation(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->addAssociation($firewallPolicy, $firewallPolicyAssociationResource, $project, $region); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionNetworkFirewallPolicies/AddAssociation', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getFirewallPolicy(); - $this->assertProtobufEquals($firewallPolicy, $actualValue); - $actualValue = $actualApiRequestObject->getFirewallPolicyAssociationResource(); - $this->assertProtobufEquals($firewallPolicyAssociationResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function addAssociationExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/addAssociationExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $firewallPolicy = 'firewallPolicy1035044177'; - $firewallPolicyAssociationResource = new FirewallPolicyAssociation(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->addAssociation($firewallPolicy, $firewallPolicyAssociationResource, $project, $region); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 addRuleTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/addRuleTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/addRuleTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $firewallPolicy = 'firewallPolicy1035044177'; - $firewallPolicyRuleResource = new FirewallPolicyRule(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->addRule($firewallPolicy, $firewallPolicyRuleResource, $project, $region); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionNetworkFirewallPolicies/AddRule', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getFirewallPolicy(); - $this->assertProtobufEquals($firewallPolicy, $actualValue); - $actualValue = $actualApiRequestObject->getFirewallPolicyRuleResource(); - $this->assertProtobufEquals($firewallPolicyRuleResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function addRuleExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/addRuleExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $firewallPolicy = 'firewallPolicy1035044177'; - $firewallPolicyRuleResource = new FirewallPolicyRule(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->addRule($firewallPolicy, $firewallPolicyRuleResource, $project, $region); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 cloneRulesTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/cloneRulesTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/cloneRulesTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $firewallPolicy = 'firewallPolicy1035044177'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->cloneRules($firewallPolicy, $project, $region); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionNetworkFirewallPolicies/CloneRules', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getFirewallPolicy(); - $this->assertProtobufEquals($firewallPolicy, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function cloneRulesExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/cloneRulesExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $firewallPolicy = 'firewallPolicy1035044177'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->cloneRules($firewallPolicy, $project, $region); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $firewallPolicy = 'firewallPolicy1035044177'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->delete($firewallPolicy, $project, $region); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionNetworkFirewallPolicies/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getFirewallPolicy(); - $this->assertProtobufEquals($firewallPolicy, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $firewallPolicy = 'firewallPolicy1035044177'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->delete($firewallPolicy, $project, $region); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $displayName = 'displayName1615086568'; - $fingerprint = 'fingerprint-1375934236'; - $id = 3355; - $kind = 'kind3292052'; - $name = 'name3373707'; - $parent = 'parent-995424086'; - $region2 = 'region2-690338393'; - $ruleTupleCount = 388342037; - $selfLink = 'selfLink-1691268851'; - $selfLinkWithId = 'selfLinkWithId-1029220862'; - $shortName = 'shortName1565793390'; - $expectedResponse = new FirewallPolicy(); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setFingerprint($fingerprint); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setName($name); - $expectedResponse->setParent($parent); - $expectedResponse->setRegion($region2); - $expectedResponse->setRuleTupleCount($ruleTupleCount); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setSelfLinkWithId($selfLinkWithId); - $expectedResponse->setShortName($shortName); - $transport->addResponse($expectedResponse); - // Mock request - $firewallPolicy = 'firewallPolicy1035044177'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->get($firewallPolicy, $project, $region); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionNetworkFirewallPolicies/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getFirewallPolicy(); - $this->assertProtobufEquals($firewallPolicy, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $firewallPolicy = 'firewallPolicy1035044177'; - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->get($firewallPolicy, $project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getAssociationTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $attachmentTarget = 'attachmentTarget1786386477'; - $displayName = 'displayName1615086568'; - $firewallPolicyId = 'firewallPolicyId1430953673'; - $name2 = 'name2-1052831874'; - $shortName = 'shortName1565793390'; - $expectedResponse = new FirewallPolicyAssociation(); - $expectedResponse->setAttachmentTarget($attachmentTarget); - $expectedResponse->setDisplayName($displayName); - $expectedResponse->setFirewallPolicyId($firewallPolicyId); - $expectedResponse->setName($name2); - $expectedResponse->setShortName($shortName); - $transport->addResponse($expectedResponse); - // Mock request - $firewallPolicy = 'firewallPolicy1035044177'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->getAssociation($firewallPolicy, $project, $region); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionNetworkFirewallPolicies/GetAssociation', $actualFuncCall); - $actualValue = $actualRequestObject->getFirewallPolicy(); - $this->assertProtobufEquals($firewallPolicy, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getAssociationExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $firewallPolicy = 'firewallPolicy1035044177'; - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->getAssociation($firewallPolicy, $project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getEffectiveFirewallsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new RegionNetworkFirewallPoliciesGetEffectiveFirewallsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $network = 'network1843485230'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->getEffectiveFirewalls($network, $project, $region); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionNetworkFirewallPolicies/GetEffectiveFirewalls', $actualFuncCall); - $actualValue = $actualRequestObject->getNetwork(); - $this->assertProtobufEquals($network, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getEffectiveFirewallsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $network = 'network1843485230'; - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->getEffectiveFirewalls($network, $project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $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 - $etag = 'etag3123477'; - $iamOwned = false; - $version = 351608024; - $expectedResponse = new Policy(); - $expectedResponse->setEtag($etag); - $expectedResponse->setIamOwned($iamOwned); - $expectedResponse->setVersion($version); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $resource = 'resource-341064690'; - $response = $gapicClient->getIamPolicy($project, $region, $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.compute.v1.RegionNetworkFirewallPolicies/GetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $resource = 'resource-341064690'; - try { - $gapicClient->getIamPolicy($project, $region, $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 getRuleTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $action = 'action-1422950858'; - $description = 'description-1724546052'; - $direction = 'direction-962590849'; - $disabled = true; - $enableLogging = false; - $kind = 'kind3292052'; - $priority2 = 978365527; - $ruleName = 'ruleName-2092197394'; - $ruleTupleCount = 388342037; - $securityProfileGroup = 'securityProfileGroup-329459286'; - $tlsInspect = true; - $expectedResponse = new FirewallPolicyRule(); - $expectedResponse->setAction($action); - $expectedResponse->setDescription($description); - $expectedResponse->setDirection($direction); - $expectedResponse->setDisabled($disabled); - $expectedResponse->setEnableLogging($enableLogging); - $expectedResponse->setKind($kind); - $expectedResponse->setPriority($priority2); - $expectedResponse->setRuleName($ruleName); - $expectedResponse->setRuleTupleCount($ruleTupleCount); - $expectedResponse->setSecurityProfileGroup($securityProfileGroup); - $expectedResponse->setTlsInspect($tlsInspect); - $transport->addResponse($expectedResponse); - // Mock request - $firewallPolicy = 'firewallPolicy1035044177'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->getRule($firewallPolicy, $project, $region); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionNetworkFirewallPolicies/GetRule', $actualFuncCall); - $actualValue = $actualRequestObject->getFirewallPolicy(); - $this->assertProtobufEquals($firewallPolicy, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getRuleExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $firewallPolicy = 'firewallPolicy1035044177'; - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->getRule($firewallPolicy, $project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $firewallPolicyResource = new FirewallPolicy(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->insert($firewallPolicyResource, $project, $region); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionNetworkFirewallPolicies/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getFirewallPolicyResource(); - $this->assertProtobufEquals($firewallPolicyResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $firewallPolicyResource = new FirewallPolicy(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->insert($firewallPolicyResource, $project, $region); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $itemsElement = new FirewallPolicy(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new FirewallPolicyList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->list($project, $region); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionNetworkFirewallPolicies/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->list($project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function patchTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/patchTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $firewallPolicy = 'firewallPolicy1035044177'; - $firewallPolicyResource = new FirewallPolicy(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->patch($firewallPolicy, $firewallPolicyResource, $project, $region); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionNetworkFirewallPolicies/Patch', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getFirewallPolicy(); - $this->assertProtobufEquals($firewallPolicy, $actualValue); - $actualValue = $actualApiRequestObject->getFirewallPolicyResource(); - $this->assertProtobufEquals($firewallPolicyResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function patchExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $firewallPolicy = 'firewallPolicy1035044177'; - $firewallPolicyResource = new FirewallPolicy(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->patch($firewallPolicy, $firewallPolicyResource, $project, $region); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 patchRuleTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchRuleTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/patchRuleTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $firewallPolicy = 'firewallPolicy1035044177'; - $firewallPolicyRuleResource = new FirewallPolicyRule(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->patchRule($firewallPolicy, $firewallPolicyRuleResource, $project, $region); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionNetworkFirewallPolicies/PatchRule', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getFirewallPolicy(); - $this->assertProtobufEquals($firewallPolicy, $actualValue); - $actualValue = $actualApiRequestObject->getFirewallPolicyRuleResource(); - $this->assertProtobufEquals($firewallPolicyRuleResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function patchRuleExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchRuleExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $firewallPolicy = 'firewallPolicy1035044177'; - $firewallPolicyRuleResource = new FirewallPolicyRule(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->patchRule($firewallPolicy, $firewallPolicyRuleResource, $project, $region); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 removeAssociationTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/removeAssociationTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/removeAssociationTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $firewallPolicy = 'firewallPolicy1035044177'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->removeAssociation($firewallPolicy, $project, $region); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionNetworkFirewallPolicies/RemoveAssociation', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getFirewallPolicy(); - $this->assertProtobufEquals($firewallPolicy, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function removeAssociationExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/removeAssociationExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $firewallPolicy = 'firewallPolicy1035044177'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->removeAssociation($firewallPolicy, $project, $region); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 removeRuleTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/removeRuleTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/removeRuleTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $firewallPolicy = 'firewallPolicy1035044177'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->removeRule($firewallPolicy, $project, $region); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionNetworkFirewallPolicies/RemoveRule', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getFirewallPolicy(); - $this->assertProtobufEquals($firewallPolicy, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function removeRuleExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/removeRuleExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $firewallPolicy = 'firewallPolicy1035044177'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->removeRule($firewallPolicy, $project, $region); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 - $etag = 'etag3123477'; - $iamOwned = false; - $version = 351608024; - $expectedResponse = new Policy(); - $expectedResponse->setEtag($etag); - $expectedResponse->setIamOwned($iamOwned); - $expectedResponse->setVersion($version); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionSetPolicyRequestResource = new RegionSetPolicyRequest(); - $resource = 'resource-341064690'; - $response = $gapicClient->setIamPolicy($project, $region, $regionSetPolicyRequestResource, $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.compute.v1.RegionNetworkFirewallPolicies/SetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualRequestObject->getRegionSetPolicyRequestResource(); - $this->assertProtobufEquals($regionSetPolicyRequestResource, $actualValue); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionSetPolicyRequestResource = new RegionSetPolicyRequest(); - $resource = 'resource-341064690'; - try { - $gapicClient->setIamPolicy($project, $region, $regionSetPolicyRequestResource, $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 testIamPermissionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new TestPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $resource = 'resource-341064690'; - $testPermissionsRequestResource = new TestPermissionsRequest(); - $response = $gapicClient->testIamPermissions($project, $region, $resource, $testPermissionsRequestResource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionNetworkFirewallPolicies/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getTestPermissionsRequestResource(); - $this->assertProtobufEquals($testPermissionsRequestResource, $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $resource = 'resource-341064690'; - $testPermissionsRequestResource = new TestPermissionsRequest(); - try { - $gapicClient->testIamPermissions($project, $region, $resource, $testPermissionsRequestResource); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->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/Compute/tests/Unit/V1/RegionNotificationEndpointsClientTest.php b/Compute/tests/Unit/V1/RegionNotificationEndpointsClientTest.php deleted file mode 100644 index 83179eb2ed1e..000000000000 --- a/Compute/tests/Unit/V1/RegionNotificationEndpointsClientTest.php +++ /dev/null @@ -1,462 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return RegionNotificationEndpointsClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new RegionNotificationEndpointsClient($options); - } - - /** @test */ - public function deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $notificationEndpoint = 'notificationEndpoint-696934807'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->delete($notificationEndpoint, $project, $region); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionNotificationEndpoints/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getNotificationEndpoint(); - $this->assertProtobufEquals($notificationEndpoint, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $notificationEndpoint = 'notificationEndpoint-696934807'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->delete($notificationEndpoint, $project, $region); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $id = 3355; - $kind = 'kind3292052'; - $name = 'name3373707'; - $region2 = 'region2-690338393'; - $selfLink = 'selfLink-1691268851'; - $expectedResponse = new NotificationEndpoint(); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setName($name); - $expectedResponse->setRegion($region2); - $expectedResponse->setSelfLink($selfLink); - $transport->addResponse($expectedResponse); - // Mock request - $notificationEndpoint = 'notificationEndpoint-696934807'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->get($notificationEndpoint, $project, $region); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionNotificationEndpoints/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getNotificationEndpoint(); - $this->assertProtobufEquals($notificationEndpoint, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $notificationEndpoint = 'notificationEndpoint-696934807'; - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->get($notificationEndpoint, $project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $notificationEndpointResource = new NotificationEndpoint(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->insert($notificationEndpointResource, $project, $region); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionNotificationEndpoints/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getNotificationEndpointResource(); - $this->assertProtobufEquals($notificationEndpointResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $notificationEndpointResource = new NotificationEndpoint(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->insert($notificationEndpointResource, $project, $region); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new NotificationEndpoint(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new NotificationEndpointList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->list($project, $region); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionNotificationEndpoints/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->list($project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->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/Compute/tests/Unit/V1/RegionOperationsClientTest.php b/Compute/tests/Unit/V1/RegionOperationsClientTest.php deleted file mode 100644 index a5422c86b965..000000000000 --- a/Compute/tests/Unit/V1/RegionOperationsClientTest.php +++ /dev/null @@ -1,423 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return RegionOperationsClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new RegionOperationsClient($options); - } - - /** @test */ - public function deleteTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new DeleteRegionOperationResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $operation = 'operation1662702951'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->delete($operation, $project, $region); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionOperations/Delete', $actualFuncCall); - $actualValue = $actualRequestObject->getOperation(); - $this->assertProtobufEquals($operation, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $operation = 'operation1662702951'; - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->delete($operation, $project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $clientOperationId = 'clientOperationId-239630617'; - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $endTime = 'endTime1725551537'; - $httpErrorMessage = 'httpErrorMessage1276263769'; - $httpErrorStatusCode = 1386087020; - $id = 3355; - $insertTime = 'insertTime-103148397'; - $kind = 'kind3292052'; - $name = 'name3373707'; - $operationGroupId = 'operationGroupId40171187'; - $operationType = 'operationType-1432962286'; - $progress = 1001078227; - $region2 = 'region2-690338393'; - $selfLink = 'selfLink-1691268851'; - $startTime = 'startTime-1573145462'; - $statusMessage = 'statusMessage-239442758'; - $targetId = 815576439; - $targetLink = 'targetLink-2084812312'; - $user = 'user3599307'; - $zone = 'zone3744684'; - $expectedResponse = new Operation(); - $expectedResponse->setClientOperationId($clientOperationId); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setEndTime($endTime); - $expectedResponse->setHttpErrorMessage($httpErrorMessage); - $expectedResponse->setHttpErrorStatusCode($httpErrorStatusCode); - $expectedResponse->setId($id); - $expectedResponse->setInsertTime($insertTime); - $expectedResponse->setKind($kind); - $expectedResponse->setName($name); - $expectedResponse->setOperationGroupId($operationGroupId); - $expectedResponse->setOperationType($operationType); - $expectedResponse->setProgress($progress); - $expectedResponse->setRegion($region2); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setStartTime($startTime); - $expectedResponse->setStatusMessage($statusMessage); - $expectedResponse->setTargetId($targetId); - $expectedResponse->setTargetLink($targetLink); - $expectedResponse->setUser($user); - $expectedResponse->setZone($zone); - $transport->addResponse($expectedResponse); - // Mock request - $operation = 'operation1662702951'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->get($operation, $project, $region); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionOperations/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getOperation(); - $this->assertProtobufEquals($operation, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $operation = 'operation1662702951'; - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->get($operation, $project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new Operation(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new OperationList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->list($project, $region); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionOperations/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->list($project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function waitTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $clientOperationId = 'clientOperationId-239630617'; - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $endTime = 'endTime1725551537'; - $httpErrorMessage = 'httpErrorMessage1276263769'; - $httpErrorStatusCode = 1386087020; - $id = 3355; - $insertTime = 'insertTime-103148397'; - $kind = 'kind3292052'; - $name = 'name3373707'; - $operationGroupId = 'operationGroupId40171187'; - $operationType = 'operationType-1432962286'; - $progress = 1001078227; - $region2 = 'region2-690338393'; - $selfLink = 'selfLink-1691268851'; - $startTime = 'startTime-1573145462'; - $statusMessage = 'statusMessage-239442758'; - $targetId = 815576439; - $targetLink = 'targetLink-2084812312'; - $user = 'user3599307'; - $zone = 'zone3744684'; - $expectedResponse = new Operation(); - $expectedResponse->setClientOperationId($clientOperationId); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setEndTime($endTime); - $expectedResponse->setHttpErrorMessage($httpErrorMessage); - $expectedResponse->setHttpErrorStatusCode($httpErrorStatusCode); - $expectedResponse->setId($id); - $expectedResponse->setInsertTime($insertTime); - $expectedResponse->setKind($kind); - $expectedResponse->setName($name); - $expectedResponse->setOperationGroupId($operationGroupId); - $expectedResponse->setOperationType($operationType); - $expectedResponse->setProgress($progress); - $expectedResponse->setRegion($region2); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setStartTime($startTime); - $expectedResponse->setStatusMessage($statusMessage); - $expectedResponse->setTargetId($targetId); - $expectedResponse->setTargetLink($targetLink); - $expectedResponse->setUser($user); - $expectedResponse->setZone($zone); - $transport->addResponse($expectedResponse); - // Mock request - $operation = 'operation1662702951'; - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->wait($operation, $project, $region); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionOperations/Wait', $actualFuncCall); - $actualValue = $actualRequestObject->getOperation(); - $this->assertProtobufEquals($operation, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function waitExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $operation = 'operation1662702951'; - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->wait($operation, $project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->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/Compute/tests/Unit/V1/RegionSecurityPoliciesClientTest.php b/Compute/tests/Unit/V1/RegionSecurityPoliciesClientTest.php deleted file mode 100644 index 1352b11fe99b..000000000000 --- a/Compute/tests/Unit/V1/RegionSecurityPoliciesClientTest.php +++ /dev/null @@ -1,1155 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return RegionSecurityPoliciesClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new RegionSecurityPoliciesClient($options); - } - - /** @test */ - public function addRuleTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/addRuleTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/addRuleTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $securityPolicy = 'securityPolicy1781695249'; - $securityPolicyRuleResource = new SecurityPolicyRule(); - $response = $gapicClient->addRule($project, $region, $securityPolicy, $securityPolicyRuleResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionSecurityPolicies/AddRule', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getSecurityPolicy(); - $this->assertProtobufEquals($securityPolicy, $actualValue); - $actualValue = $actualApiRequestObject->getSecurityPolicyRuleResource(); - $this->assertProtobufEquals($securityPolicyRuleResource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function addRuleExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/addRuleExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $securityPolicy = 'securityPolicy1781695249'; - $securityPolicyRuleResource = new SecurityPolicyRule(); - $response = $gapicClient->addRule($project, $region, $securityPolicy, $securityPolicyRuleResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $securityPolicy = 'securityPolicy1781695249'; - $response = $gapicClient->delete($project, $region, $securityPolicy); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionSecurityPolicies/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getSecurityPolicy(); - $this->assertProtobufEquals($securityPolicy, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $securityPolicy = 'securityPolicy1781695249'; - $response = $gapicClient->delete($project, $region, $securityPolicy); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $fingerprint = 'fingerprint-1375934236'; - $id = 3355; - $kind = 'kind3292052'; - $labelFingerprint = 'labelFingerprint714995737'; - $name = 'name3373707'; - $region2 = 'region2-690338393'; - $selfLink = 'selfLink-1691268851'; - $type = 'type3575610'; - $expectedResponse = new SecurityPolicy(); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setFingerprint($fingerprint); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setLabelFingerprint($labelFingerprint); - $expectedResponse->setName($name); - $expectedResponse->setRegion($region2); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setType($type); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $securityPolicy = 'securityPolicy1781695249'; - $response = $gapicClient->get($project, $region, $securityPolicy); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionSecurityPolicies/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualRequestObject->getSecurityPolicy(); - $this->assertProtobufEquals($securityPolicy, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $securityPolicy = 'securityPolicy1781695249'; - try { - $gapicClient->get($project, $region, $securityPolicy); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getRuleTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $action = 'action-1422950858'; - $description = 'description-1724546052'; - $kind = 'kind3292052'; - $preview = true; - $priority2 = 978365527; - $expectedResponse = new SecurityPolicyRule(); - $expectedResponse->setAction($action); - $expectedResponse->setDescription($description); - $expectedResponse->setKind($kind); - $expectedResponse->setPreview($preview); - $expectedResponse->setPriority($priority2); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $securityPolicy = 'securityPolicy1781695249'; - $response = $gapicClient->getRule($project, $region, $securityPolicy); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionSecurityPolicies/GetRule', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualRequestObject->getSecurityPolicy(); - $this->assertProtobufEquals($securityPolicy, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getRuleExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $securityPolicy = 'securityPolicy1781695249'; - try { - $gapicClient->getRule($project, $region, $securityPolicy); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $securityPolicyResource = new SecurityPolicy(); - $response = $gapicClient->insert($project, $region, $securityPolicyResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionSecurityPolicies/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getSecurityPolicyResource(); - $this->assertProtobufEquals($securityPolicyResource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $securityPolicyResource = new SecurityPolicy(); - $response = $gapicClient->insert($project, $region, $securityPolicyResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $itemsElement = new SecurityPolicy(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new SecurityPolicyList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->list($project, $region); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionSecurityPolicies/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->list($project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function patchTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/patchTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $securityPolicy = 'securityPolicy1781695249'; - $securityPolicyResource = new SecurityPolicy(); - $response = $gapicClient->patch($project, $region, $securityPolicy, $securityPolicyResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionSecurityPolicies/Patch', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getSecurityPolicy(); - $this->assertProtobufEquals($securityPolicy, $actualValue); - $actualValue = $actualApiRequestObject->getSecurityPolicyResource(); - $this->assertProtobufEquals($securityPolicyResource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function patchExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $securityPolicy = 'securityPolicy1781695249'; - $securityPolicyResource = new SecurityPolicy(); - $response = $gapicClient->patch($project, $region, $securityPolicy, $securityPolicyResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 patchRuleTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchRuleTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/patchRuleTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $securityPolicy = 'securityPolicy1781695249'; - $securityPolicyRuleResource = new SecurityPolicyRule(); - $response = $gapicClient->patchRule($project, $region, $securityPolicy, $securityPolicyRuleResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionSecurityPolicies/PatchRule', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getSecurityPolicy(); - $this->assertProtobufEquals($securityPolicy, $actualValue); - $actualValue = $actualApiRequestObject->getSecurityPolicyRuleResource(); - $this->assertProtobufEquals($securityPolicyRuleResource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function patchRuleExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchRuleExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $securityPolicy = 'securityPolicy1781695249'; - $securityPolicyRuleResource = new SecurityPolicyRule(); - $response = $gapicClient->patchRule($project, $region, $securityPolicy, $securityPolicyRuleResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 removeRuleTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/removeRuleTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/removeRuleTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $securityPolicy = 'securityPolicy1781695249'; - $response = $gapicClient->removeRule($project, $region, $securityPolicy); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionSecurityPolicies/RemoveRule', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getSecurityPolicy(); - $this->assertProtobufEquals($securityPolicy, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function removeRuleExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/removeRuleExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $securityPolicy = 'securityPolicy1781695249'; - $response = $gapicClient->removeRule($project, $region, $securityPolicy); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 setLabelsTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setLabelsTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/setLabelsTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionSetLabelsRequestResource = new RegionSetLabelsRequest(); - $resource = 'resource-341064690'; - $response = $gapicClient->setLabels($project, $region, $regionSetLabelsRequestResource, $resource); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionSecurityPolicies/SetLabels', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getRegionSetLabelsRequestResource(); - $this->assertProtobufEquals($regionSetLabelsRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setLabelsExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setLabelsExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionSetLabelsRequestResource = new RegionSetLabelsRequest(); - $resource = 'resource-341064690'; - $response = $gapicClient->setLabels($project, $region, $regionSetLabelsRequestResource, $resource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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/Compute/tests/Unit/V1/RegionSslCertificatesClientTest.php b/Compute/tests/Unit/V1/RegionSslCertificatesClientTest.php deleted file mode 100644 index 720d9e31c410..000000000000 --- a/Compute/tests/Unit/V1/RegionSslCertificatesClientTest.php +++ /dev/null @@ -1,470 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return RegionSslCertificatesClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new RegionSslCertificatesClient($options); - } - - /** @test */ - public function deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $sslCertificate = 'sslCertificate-1027298332'; - $response = $gapicClient->delete($project, $region, $sslCertificate); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionSslCertificates/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getSslCertificate(); - $this->assertProtobufEquals($sslCertificate, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $sslCertificate = 'sslCertificate-1027298332'; - $response = $gapicClient->delete($project, $region, $sslCertificate); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $certificate = 'certificate1952399767'; - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $expireTime = 'expireTime-96179731'; - $id = 3355; - $kind = 'kind3292052'; - $name = 'name3373707'; - $privateKey = 'privateKey1971943843'; - $region2 = 'region2-690338393'; - $selfLink = 'selfLink-1691268851'; - $type = 'type3575610'; - $expectedResponse = new SslCertificate(); - $expectedResponse->setCertificate($certificate); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setExpireTime($expireTime); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setName($name); - $expectedResponse->setPrivateKey($privateKey); - $expectedResponse->setRegion($region2); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setType($type); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $sslCertificate = 'sslCertificate-1027298332'; - $response = $gapicClient->get($project, $region, $sslCertificate); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionSslCertificates/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualRequestObject->getSslCertificate(); - $this->assertProtobufEquals($sslCertificate, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $sslCertificate = 'sslCertificate-1027298332'; - try { - $gapicClient->get($project, $region, $sslCertificate); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $sslCertificateResource = new SslCertificate(); - $response = $gapicClient->insert($project, $region, $sslCertificateResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionSslCertificates/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getSslCertificateResource(); - $this->assertProtobufEquals($sslCertificateResource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $sslCertificateResource = new SslCertificate(); - $response = $gapicClient->insert($project, $region, $sslCertificateResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new SslCertificate(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new SslCertificateList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->list($project, $region); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionSslCertificates/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->list($project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->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/Compute/tests/Unit/V1/RegionSslPoliciesClientTest.php b/Compute/tests/Unit/V1/RegionSslPoliciesClientTest.php deleted file mode 100644 index 746527c6b0ea..000000000000 --- a/Compute/tests/Unit/V1/RegionSslPoliciesClientTest.php +++ /dev/null @@ -1,654 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return RegionSslPoliciesClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new RegionSslPoliciesClient($options); - } - - /** @test */ - public function deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $sslPolicy = 'sslPolicy-1852293435'; - $response = $gapicClient->delete($project, $region, $sslPolicy); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionSslPolicies/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getSslPolicy(); - $this->assertProtobufEquals($sslPolicy, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $sslPolicy = 'sslPolicy-1852293435'; - $response = $gapicClient->delete($project, $region, $sslPolicy); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $fingerprint = 'fingerprint-1375934236'; - $id = 3355; - $kind = 'kind3292052'; - $minTlsVersion = 'minTlsVersion8155943'; - $name = 'name3373707'; - $profile = 'profile-309425751'; - $region2 = 'region2-690338393'; - $selfLink = 'selfLink-1691268851'; - $expectedResponse = new SslPolicy(); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setFingerprint($fingerprint); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setMinTlsVersion($minTlsVersion); - $expectedResponse->setName($name); - $expectedResponse->setProfile($profile); - $expectedResponse->setRegion($region2); - $expectedResponse->setSelfLink($selfLink); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $sslPolicy = 'sslPolicy-1852293435'; - $response = $gapicClient->get($project, $region, $sslPolicy); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionSslPolicies/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualRequestObject->getSslPolicy(); - $this->assertProtobufEquals($sslPolicy, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $sslPolicy = 'sslPolicy-1852293435'; - try { - $gapicClient->get($project, $region, $sslPolicy); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $sslPolicyResource = new SslPolicy(); - $response = $gapicClient->insert($project, $region, $sslPolicyResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionSslPolicies/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getSslPolicyResource(); - $this->assertProtobufEquals($sslPolicyResource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $sslPolicyResource = new SslPolicy(); - $response = $gapicClient->insert($project, $region, $sslPolicyResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new SslPolicy(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new SslPoliciesList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->list($project, $region); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionSslPolicies/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->list($project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listAvailableFeaturesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new SslPoliciesListAvailableFeaturesResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->listAvailableFeatures($project, $region); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionSslPolicies/ListAvailableFeatures', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listAvailableFeaturesExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->listAvailableFeatures($project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function patchTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/patchTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $sslPolicy = 'sslPolicy-1852293435'; - $sslPolicyResource = new SslPolicy(); - $response = $gapicClient->patch($project, $region, $sslPolicy, $sslPolicyResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionSslPolicies/Patch', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getSslPolicy(); - $this->assertProtobufEquals($sslPolicy, $actualValue); - $actualValue = $actualApiRequestObject->getSslPolicyResource(); - $this->assertProtobufEquals($sslPolicyResource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function patchExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $sslPolicy = 'sslPolicy-1852293435'; - $sslPolicyResource = new SslPolicy(); - $response = $gapicClient->patch($project, $region, $sslPolicy, $sslPolicyResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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/Compute/tests/Unit/V1/RegionTargetHttpProxiesClientTest.php b/Compute/tests/Unit/V1/RegionTargetHttpProxiesClientTest.php deleted file mode 100644 index 861ad146d3f5..000000000000 --- a/Compute/tests/Unit/V1/RegionTargetHttpProxiesClientTest.php +++ /dev/null @@ -1,594 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return RegionTargetHttpProxiesClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new RegionTargetHttpProxiesClient($options); - } - - /** @test */ - public function deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $targetHttpProxy = 'targetHttpProxy206872421'; - $response = $gapicClient->delete($project, $region, $targetHttpProxy); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionTargetHttpProxies/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getTargetHttpProxy(); - $this->assertProtobufEquals($targetHttpProxy, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $targetHttpProxy = 'targetHttpProxy206872421'; - $response = $gapicClient->delete($project, $region, $targetHttpProxy); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $fingerprint = 'fingerprint-1375934236'; - $httpKeepAliveTimeoutSec = 2057938782; - $id = 3355; - $kind = 'kind3292052'; - $name = 'name3373707'; - $proxyBind = true; - $region2 = 'region2-690338393'; - $selfLink = 'selfLink-1691268851'; - $urlMap = 'urlMap-169850228'; - $expectedResponse = new TargetHttpProxy(); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setFingerprint($fingerprint); - $expectedResponse->setHttpKeepAliveTimeoutSec($httpKeepAliveTimeoutSec); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setName($name); - $expectedResponse->setProxyBind($proxyBind); - $expectedResponse->setRegion($region2); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setUrlMap($urlMap); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $targetHttpProxy = 'targetHttpProxy206872421'; - $response = $gapicClient->get($project, $region, $targetHttpProxy); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionTargetHttpProxies/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualRequestObject->getTargetHttpProxy(); - $this->assertProtobufEquals($targetHttpProxy, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $targetHttpProxy = 'targetHttpProxy206872421'; - try { - $gapicClient->get($project, $region, $targetHttpProxy); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $targetHttpProxyResource = new TargetHttpProxy(); - $response = $gapicClient->insert($project, $region, $targetHttpProxyResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionTargetHttpProxies/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getTargetHttpProxyResource(); - $this->assertProtobufEquals($targetHttpProxyResource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $targetHttpProxyResource = new TargetHttpProxy(); - $response = $gapicClient->insert($project, $region, $targetHttpProxyResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new TargetHttpProxy(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new TargetHttpProxyList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->list($project, $region); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionTargetHttpProxies/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->list($project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setUrlMapTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setUrlMapTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/setUrlMapTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $targetHttpProxy = 'targetHttpProxy206872421'; - $urlMapReferenceResource = new UrlMapReference(); - $response = $gapicClient->setUrlMap($project, $region, $targetHttpProxy, $urlMapReferenceResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionTargetHttpProxies/SetUrlMap', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getTargetHttpProxy(); - $this->assertProtobufEquals($targetHttpProxy, $actualValue); - $actualValue = $actualApiRequestObject->getUrlMapReferenceResource(); - $this->assertProtobufEquals($urlMapReferenceResource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setUrlMapExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setUrlMapExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $targetHttpProxy = 'targetHttpProxy206872421'; - $urlMapReferenceResource = new UrlMapReference(); - $response = $gapicClient->setUrlMap($project, $region, $targetHttpProxy, $urlMapReferenceResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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/Compute/tests/Unit/V1/RegionTargetHttpsProxiesClientTest.php b/Compute/tests/Unit/V1/RegionTargetHttpsProxiesClientTest.php deleted file mode 100644 index 79ed0933f7ce..000000000000 --- a/Compute/tests/Unit/V1/RegionTargetHttpsProxiesClientTest.php +++ /dev/null @@ -1,853 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return RegionTargetHttpsProxiesClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new RegionTargetHttpsProxiesClient($options); - } - - /** @test */ - public function deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $targetHttpsProxy = 'targetHttpsProxy-2095146900'; - $response = $gapicClient->delete($project, $region, $targetHttpsProxy); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionTargetHttpsProxies/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getTargetHttpsProxy(); - $this->assertProtobufEquals($targetHttpsProxy, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $targetHttpsProxy = 'targetHttpsProxy-2095146900'; - $response = $gapicClient->delete($project, $region, $targetHttpsProxy); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $authorizationPolicy = 'authorizationPolicy-1576667208'; - $certificateMap = 'certificateMap-917278028'; - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $fingerprint = 'fingerprint-1375934236'; - $httpKeepAliveTimeoutSec = 2057938782; - $id = 3355; - $kind = 'kind3292052'; - $name = 'name3373707'; - $proxyBind = true; - $quicOverride = 'quicOverride2067189933'; - $region2 = 'region2-690338393'; - $selfLink = 'selfLink-1691268851'; - $serverTlsPolicy = 'serverTlsPolicy1906438002'; - $sslPolicy = 'sslPolicy-1852293435'; - $tlsEarlyData = 'tlsEarlyData-1549504310'; - $urlMap = 'urlMap-169850228'; - $expectedResponse = new TargetHttpsProxy(); - $expectedResponse->setAuthorizationPolicy($authorizationPolicy); - $expectedResponse->setCertificateMap($certificateMap); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setFingerprint($fingerprint); - $expectedResponse->setHttpKeepAliveTimeoutSec($httpKeepAliveTimeoutSec); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setName($name); - $expectedResponse->setProxyBind($proxyBind); - $expectedResponse->setQuicOverride($quicOverride); - $expectedResponse->setRegion($region2); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setServerTlsPolicy($serverTlsPolicy); - $expectedResponse->setSslPolicy($sslPolicy); - $expectedResponse->setTlsEarlyData($tlsEarlyData); - $expectedResponse->setUrlMap($urlMap); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $targetHttpsProxy = 'targetHttpsProxy-2095146900'; - $response = $gapicClient->get($project, $region, $targetHttpsProxy); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionTargetHttpsProxies/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualRequestObject->getTargetHttpsProxy(); - $this->assertProtobufEquals($targetHttpsProxy, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $targetHttpsProxy = 'targetHttpsProxy-2095146900'; - try { - $gapicClient->get($project, $region, $targetHttpsProxy); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $targetHttpsProxyResource = new TargetHttpsProxy(); - $response = $gapicClient->insert($project, $region, $targetHttpsProxyResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionTargetHttpsProxies/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getTargetHttpsProxyResource(); - $this->assertProtobufEquals($targetHttpsProxyResource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $targetHttpsProxyResource = new TargetHttpsProxy(); - $response = $gapicClient->insert($project, $region, $targetHttpsProxyResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new TargetHttpsProxy(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new TargetHttpsProxyList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->list($project, $region); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionTargetHttpsProxies/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->list($project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function patchTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/patchTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $targetHttpsProxy = 'targetHttpsProxy-2095146900'; - $targetHttpsProxyResource = new TargetHttpsProxy(); - $response = $gapicClient->patch($project, $region, $targetHttpsProxy, $targetHttpsProxyResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionTargetHttpsProxies/Patch', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getTargetHttpsProxy(); - $this->assertProtobufEquals($targetHttpsProxy, $actualValue); - $actualValue = $actualApiRequestObject->getTargetHttpsProxyResource(); - $this->assertProtobufEquals($targetHttpsProxyResource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function patchExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $targetHttpsProxy = 'targetHttpsProxy-2095146900'; - $targetHttpsProxyResource = new TargetHttpsProxy(); - $response = $gapicClient->patch($project, $region, $targetHttpsProxy, $targetHttpsProxyResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 setSslCertificatesTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setSslCertificatesTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/setSslCertificatesTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionTargetHttpsProxiesSetSslCertificatesRequestResource = new RegionTargetHttpsProxiesSetSslCertificatesRequest(); - $targetHttpsProxy = 'targetHttpsProxy-2095146900'; - $response = $gapicClient->setSslCertificates($project, $region, $regionTargetHttpsProxiesSetSslCertificatesRequestResource, $targetHttpsProxy); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionTargetHttpsProxies/SetSslCertificates', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getRegionTargetHttpsProxiesSetSslCertificatesRequestResource(); - $this->assertProtobufEquals($regionTargetHttpsProxiesSetSslCertificatesRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getTargetHttpsProxy(); - $this->assertProtobufEquals($targetHttpsProxy, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setSslCertificatesExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setSslCertificatesExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionTargetHttpsProxiesSetSslCertificatesRequestResource = new RegionTargetHttpsProxiesSetSslCertificatesRequest(); - $targetHttpsProxy = 'targetHttpsProxy-2095146900'; - $response = $gapicClient->setSslCertificates($project, $region, $regionTargetHttpsProxiesSetSslCertificatesRequestResource, $targetHttpsProxy); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 setUrlMapTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setUrlMapTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/setUrlMapTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $targetHttpsProxy = 'targetHttpsProxy-2095146900'; - $urlMapReferenceResource = new UrlMapReference(); - $response = $gapicClient->setUrlMap($project, $region, $targetHttpsProxy, $urlMapReferenceResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionTargetHttpsProxies/SetUrlMap', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getTargetHttpsProxy(); - $this->assertProtobufEquals($targetHttpsProxy, $actualValue); - $actualValue = $actualApiRequestObject->getUrlMapReferenceResource(); - $this->assertProtobufEquals($urlMapReferenceResource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setUrlMapExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setUrlMapExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $targetHttpsProxy = 'targetHttpsProxy-2095146900'; - $urlMapReferenceResource = new UrlMapReference(); - $response = $gapicClient->setUrlMap($project, $region, $targetHttpsProxy, $urlMapReferenceResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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/Compute/tests/Unit/V1/RegionTargetTcpProxiesClientTest.php b/Compute/tests/Unit/V1/RegionTargetTcpProxiesClientTest.php deleted file mode 100644 index b0a5a243370f..000000000000 --- a/Compute/tests/Unit/V1/RegionTargetTcpProxiesClientTest.php +++ /dev/null @@ -1,468 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return RegionTargetTcpProxiesClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new RegionTargetTcpProxiesClient($options); - } - - /** @test */ - public function deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $targetTcpProxy = 'targetTcpProxy503065442'; - $response = $gapicClient->delete($project, $region, $targetTcpProxy); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionTargetTcpProxies/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getTargetTcpProxy(); - $this->assertProtobufEquals($targetTcpProxy, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $targetTcpProxy = 'targetTcpProxy503065442'; - $response = $gapicClient->delete($project, $region, $targetTcpProxy); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $id = 3355; - $kind = 'kind3292052'; - $name = 'name3373707'; - $proxyBind = true; - $proxyHeader = 'proxyHeader-1987109506'; - $region2 = 'region2-690338393'; - $selfLink = 'selfLink-1691268851'; - $service = 'service1984153269'; - $expectedResponse = new TargetTcpProxy(); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setName($name); - $expectedResponse->setProxyBind($proxyBind); - $expectedResponse->setProxyHeader($proxyHeader); - $expectedResponse->setRegion($region2); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setService($service); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $targetTcpProxy = 'targetTcpProxy503065442'; - $response = $gapicClient->get($project, $region, $targetTcpProxy); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionTargetTcpProxies/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualRequestObject->getTargetTcpProxy(); - $this->assertProtobufEquals($targetTcpProxy, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $targetTcpProxy = 'targetTcpProxy503065442'; - try { - $gapicClient->get($project, $region, $targetTcpProxy); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $targetTcpProxyResource = new TargetTcpProxy(); - $response = $gapicClient->insert($project, $region, $targetTcpProxyResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionTargetTcpProxies/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getTargetTcpProxyResource(); - $this->assertProtobufEquals($targetTcpProxyResource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $targetTcpProxyResource = new TargetTcpProxy(); - $response = $gapicClient->insert($project, $region, $targetTcpProxyResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new TargetTcpProxy(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new TargetTcpProxyList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->list($project, $region); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionTargetTcpProxies/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->list($project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->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/Compute/tests/Unit/V1/RegionUrlMapsClientTest.php b/Compute/tests/Unit/V1/RegionUrlMapsClientTest.php deleted file mode 100644 index fae2c5dcc3fd..000000000000 --- a/Compute/tests/Unit/V1/RegionUrlMapsClientTest.php +++ /dev/null @@ -1,784 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return RegionUrlMapsClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new RegionUrlMapsClient($options); - } - - /** @test */ - public function deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $urlMap = 'urlMap-169850228'; - $response = $gapicClient->delete($project, $region, $urlMap); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionUrlMaps/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getUrlMap(); - $this->assertProtobufEquals($urlMap, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $urlMap = 'urlMap-169850228'; - $response = $gapicClient->delete($project, $region, $urlMap); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $creationTimestamp = 'creationTimestamp567396278'; - $defaultService = 'defaultService1980854967'; - $description = 'description-1724546052'; - $fingerprint = 'fingerprint-1375934236'; - $id = 3355; - $kind = 'kind3292052'; - $name = 'name3373707'; - $region2 = 'region2-690338393'; - $selfLink = 'selfLink-1691268851'; - $expectedResponse = new UrlMap(); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDefaultService($defaultService); - $expectedResponse->setDescription($description); - $expectedResponse->setFingerprint($fingerprint); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setName($name); - $expectedResponse->setRegion($region2); - $expectedResponse->setSelfLink($selfLink); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $urlMap = 'urlMap-169850228'; - $response = $gapicClient->get($project, $region, $urlMap); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionUrlMaps/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualRequestObject->getUrlMap(); - $this->assertProtobufEquals($urlMap, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $urlMap = 'urlMap-169850228'; - try { - $gapicClient->get($project, $region, $urlMap); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $urlMapResource = new UrlMap(); - $response = $gapicClient->insert($project, $region, $urlMapResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionUrlMaps/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getUrlMapResource(); - $this->assertProtobufEquals($urlMapResource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $urlMapResource = new UrlMap(); - $response = $gapicClient->insert($project, $region, $urlMapResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new UrlMap(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new UrlMapList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->list($project, $region); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionUrlMaps/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->list($project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function patchTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/patchTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $urlMap = 'urlMap-169850228'; - $urlMapResource = new UrlMap(); - $response = $gapicClient->patch($project, $region, $urlMap, $urlMapResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionUrlMaps/Patch', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getUrlMap(); - $this->assertProtobufEquals($urlMap, $actualValue); - $actualValue = $actualApiRequestObject->getUrlMapResource(); - $this->assertProtobufEquals($urlMapResource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function patchExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $urlMap = 'urlMap-169850228'; - $urlMapResource = new UrlMap(); - $response = $gapicClient->patch($project, $region, $urlMap, $urlMapResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 updateTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/updateTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/updateTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $urlMap = 'urlMap-169850228'; - $urlMapResource = new UrlMap(); - $response = $gapicClient->update($project, $region, $urlMap, $urlMapResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.RegionUrlMaps/Update', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getUrlMap(); - $this->assertProtobufEquals($urlMap, $actualValue); - $actualValue = $actualApiRequestObject->getUrlMapResource(); - $this->assertProtobufEquals($urlMapResource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function updateExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/updateExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $urlMap = 'urlMap-169850228'; - $urlMapResource = new UrlMap(); - $response = $gapicClient->update($project, $region, $urlMap, $urlMapResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 validateTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new UrlMapsValidateResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionUrlMapsValidateRequestResource = new RegionUrlMapsValidateRequest(); - $urlMap = 'urlMap-169850228'; - $response = $gapicClient->validate($project, $region, $regionUrlMapsValidateRequestResource, $urlMap); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionUrlMaps/Validate', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualRequestObject->getRegionUrlMapsValidateRequestResource(); - $this->assertProtobufEquals($regionUrlMapsValidateRequestResource, $actualValue); - $actualValue = $actualRequestObject->getUrlMap(); - $this->assertProtobufEquals($urlMap, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function validateExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionUrlMapsValidateRequestResource = new RegionUrlMapsValidateRequest(); - $urlMap = 'urlMap-169850228'; - try { - $gapicClient->validate($project, $region, $regionUrlMapsValidateRequestResource, $urlMap); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->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/Compute/tests/Unit/V1/RegionZonesClientTest.php b/Compute/tests/Unit/V1/RegionZonesClientTest.php deleted file mode 100644 index 2ee0e1f5614d..000000000000 --- a/Compute/tests/Unit/V1/RegionZonesClientTest.php +++ /dev/null @@ -1,140 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return RegionZonesClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new RegionZonesClient($options); - } - - /** @test */ - public function listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new Zone(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new ZoneList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->list($project, $region); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.RegionZones/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->list($project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->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/Compute/tests/Unit/V1/RegionsClientTest.php b/Compute/tests/Unit/V1/RegionsClientTest.php deleted file mode 100644 index 11487f20af7d..000000000000 --- a/Compute/tests/Unit/V1/RegionsClientTest.php +++ /dev/null @@ -1,214 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return RegionsClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new RegionsClient($options); - } - - /** @test */ - public function getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $id = 3355; - $kind = 'kind3292052'; - $name = 'name3373707'; - $selfLink = 'selfLink-1691268851'; - $status = 'status-892481550'; - $supportsPzs = true; - $expectedResponse = new Region(); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setName($name); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setStatus($status); - $expectedResponse->setSupportsPzs($supportsPzs); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->get($project, $region); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Regions/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->get($project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new Region(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new RegionList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->list($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Regions/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->list($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->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/Compute/tests/Unit/V1/ReservationBlocksClientTest.php b/Compute/tests/Unit/V1/ReservationBlocksClientTest.php deleted file mode 100644 index 81c20203d932..000000000000 --- a/Compute/tests/Unit/V1/ReservationBlocksClientTest.php +++ /dev/null @@ -1,347 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return ReservationBlocksClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new ReservationBlocksClient($options); - } - - /** @test */ - public function getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new ReservationBlocksGetResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $reservation = 'reservation-1563081780'; - $reservationBlock = 'reservationBlock2143445594'; - $zone = 'zone3744684'; - $response = $gapicClient->get($project, $reservation, $reservationBlock, $zone); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.ReservationBlocks/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getReservation(); - $this->assertProtobufEquals($reservation, $actualValue); - $actualValue = $actualRequestObject->getReservationBlock(); - $this->assertProtobufEquals($reservationBlock, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $reservation = 'reservation-1563081780'; - $reservationBlock = 'reservationBlock2143445594'; - $zone = 'zone3744684'; - try { - $gapicClient->get($project, $reservation, $reservationBlock, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new ReservationBlock(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new ReservationBlocksListResponse(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $reservation = 'reservation-1563081780'; - $zone = 'zone3744684'; - $response = $gapicClient->list($project, $reservation, $zone); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.ReservationBlocks/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getReservation(); - $this->assertProtobufEquals($reservation, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $reservation = 'reservation-1563081780'; - $zone = 'zone3744684'; - try { - $gapicClient->list($project, $reservation, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function performMaintenanceTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/performMaintenanceTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/performMaintenanceTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $reservation = 'reservation-1563081780'; - $reservationBlock = 'reservationBlock2143445594'; - $reservationsBlocksPerformMaintenanceRequestResource = new ReservationsBlocksPerformMaintenanceRequest(); - $zone = 'zone3744684'; - $response = $gapicClient->performMaintenance($project, $reservation, $reservationBlock, $reservationsBlocksPerformMaintenanceRequestResource, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.ReservationBlocks/PerformMaintenance', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getReservation(); - $this->assertProtobufEquals($reservation, $actualValue); - $actualValue = $actualApiRequestObject->getReservationBlock(); - $this->assertProtobufEquals($reservationBlock, $actualValue); - $actualValue = $actualApiRequestObject->getReservationsBlocksPerformMaintenanceRequestResource(); - $this->assertProtobufEquals($reservationsBlocksPerformMaintenanceRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function performMaintenanceExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/performMaintenanceExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $reservation = 'reservation-1563081780'; - $reservationBlock = 'reservationBlock2143445594'; - $reservationsBlocksPerformMaintenanceRequestResource = new ReservationsBlocksPerformMaintenanceRequest(); - $zone = 'zone3744684'; - $response = $gapicClient->performMaintenance($project, $reservation, $reservationBlock, $reservationsBlocksPerformMaintenanceRequestResource, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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/Compute/tests/Unit/V1/ReservationSubBlocksClientTest.php b/Compute/tests/Unit/V1/ReservationSubBlocksClientTest.php deleted file mode 100644 index e69a421a9e41..000000000000 --- a/Compute/tests/Unit/V1/ReservationSubBlocksClientTest.php +++ /dev/null @@ -1,342 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return ReservationSubBlocksClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new ReservationSubBlocksClient($options); - } - - /** @test */ - public function getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new ReservationSubBlocksGetResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $parentName = 'parentName1015022848'; - $project = 'project-309310695'; - $reservationSubBlock = 'reservationSubBlock22750491'; - $zone = 'zone3744684'; - $response = $gapicClient->get($parentName, $project, $reservationSubBlock, $zone); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.ReservationSubBlocks/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getParentName(); - $this->assertProtobufEquals($parentName, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getReservationSubBlock(); - $this->assertProtobufEquals($reservationSubBlock, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $parentName = 'parentName1015022848'; - $project = 'project-309310695'; - $reservationSubBlock = 'reservationSubBlock22750491'; - $zone = 'zone3744684'; - try { - $gapicClient->get($parentName, $project, $reservationSubBlock, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new ReservationSubBlock(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new ReservationSubBlocksListResponse(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $parentName = 'parentName1015022848'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->list($parentName, $project, $zone); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.ReservationSubBlocks/List', $actualFuncCall); - $actualValue = $actualRequestObject->getParentName(); - $this->assertProtobufEquals($parentName, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $parentName = 'parentName1015022848'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - try { - $gapicClient->list($parentName, $project, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function performMaintenanceTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/performMaintenanceTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/performMaintenanceTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $parentName = 'parentName1015022848'; - $project = 'project-309310695'; - $reservationSubBlock = 'reservationSubBlock22750491'; - $zone = 'zone3744684'; - $response = $gapicClient->performMaintenance($parentName, $project, $reservationSubBlock, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.ReservationSubBlocks/PerformMaintenance', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParentName(); - $this->assertProtobufEquals($parentName, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getReservationSubBlock(); - $this->assertProtobufEquals($reservationSubBlock, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function performMaintenanceExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/performMaintenanceExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $parentName = 'parentName1015022848'; - $project = 'project-309310695'; - $reservationSubBlock = 'reservationSubBlock22750491'; - $zone = 'zone3744684'; - $response = $gapicClient->performMaintenance($parentName, $project, $reservationSubBlock, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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/Compute/tests/Unit/V1/ReservationsClientTest.php b/Compute/tests/Unit/V1/ReservationsClientTest.php deleted file mode 100644 index 988dc0bf31bd..000000000000 --- a/Compute/tests/Unit/V1/ReservationsClientTest.php +++ /dev/null @@ -1,1148 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return ReservationsClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new ReservationsClient($options); - } - - /** @test */ - public function aggregatedListTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $items = [ - 'itemsKey' => new ReservationsScopedList(), - ]; - $expectedResponse = new ReservationAggregatedList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->aggregatedList($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertArrayHasKey('itemsKey', $expectedResponse->getItems()); - $this->assertArrayHasKey('itemsKey', $resources); - $this->assertEquals($expectedResponse->getItems()['itemsKey'], $resources['itemsKey']); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Reservations/AggregatedList', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function aggregatedListExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->aggregatedList($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $reservation = 'reservation-1563081780'; - $zone = 'zone3744684'; - $response = $gapicClient->delete($project, $reservation, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.Reservations/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getReservation(); - $this->assertProtobufEquals($reservation, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $reservation = 'reservation-1563081780'; - $zone = 'zone3744684'; - $response = $gapicClient->delete($project, $reservation, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $commitment = 'commitment1019005717'; - $creationTimestamp = 'creationTimestamp567396278'; - $deleteAtTime = 'deleteAtTime-453576507'; - $deploymentType = 'deploymentType2007335028'; - $description = 'description-1724546052'; - $enableEmergentMaintenance = false; - $id = 3355; - $kind = 'kind3292052'; - $name = 'name3373707'; - $satisfiesPzs = false; - $schedulingType = 'schedulingType199835397'; - $selfLink = 'selfLink-1691268851'; - $specificReservationRequired = false; - $status = 'status-892481550'; - $zone2 = 'zone2-696322977'; - $expectedResponse = new Reservation(); - $expectedResponse->setCommitment($commitment); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDeleteAtTime($deleteAtTime); - $expectedResponse->setDeploymentType($deploymentType); - $expectedResponse->setDescription($description); - $expectedResponse->setEnableEmergentMaintenance($enableEmergentMaintenance); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setName($name); - $expectedResponse->setSatisfiesPzs($satisfiesPzs); - $expectedResponse->setSchedulingType($schedulingType); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setSpecificReservationRequired($specificReservationRequired); - $expectedResponse->setStatus($status); - $expectedResponse->setZone($zone2); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $reservation = 'reservation-1563081780'; - $zone = 'zone3744684'; - $response = $gapicClient->get($project, $reservation, $zone); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Reservations/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getReservation(); - $this->assertProtobufEquals($reservation, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $reservation = 'reservation-1563081780'; - $zone = 'zone3744684'; - try { - $gapicClient->get($project, $reservation, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $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 - $etag = 'etag3123477'; - $iamOwned = false; - $version = 351608024; - $expectedResponse = new Policy(); - $expectedResponse->setEtag($etag); - $expectedResponse->setIamOwned($iamOwned); - $expectedResponse->setVersion($version); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $zone = 'zone3744684'; - $response = $gapicClient->getIamPolicy($project, $resource, $zone); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Reservations/GetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $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 - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $zone = 'zone3744684'; - try { - $gapicClient->getIamPolicy($project, $resource, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $reservationResource = new Reservation(); - $zone = 'zone3744684'; - $response = $gapicClient->insert($project, $reservationResource, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.Reservations/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getReservationResource(); - $this->assertProtobufEquals($reservationResource, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $reservationResource = new Reservation(); - $zone = 'zone3744684'; - $response = $gapicClient->insert($project, $reservationResource, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new Reservation(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new ReservationList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->list($project, $zone); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Reservations/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $zone = 'zone3744684'; - try { - $gapicClient->list($project, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function performMaintenanceTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/performMaintenanceTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/performMaintenanceTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $reservation = 'reservation-1563081780'; - $reservationsPerformMaintenanceRequestResource = new ReservationsPerformMaintenanceRequest(); - $zone = 'zone3744684'; - $response = $gapicClient->performMaintenance($project, $reservation, $reservationsPerformMaintenanceRequestResource, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.Reservations/PerformMaintenance', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getReservation(); - $this->assertProtobufEquals($reservation, $actualValue); - $actualValue = $actualApiRequestObject->getReservationsPerformMaintenanceRequestResource(); - $this->assertProtobufEquals($reservationsPerformMaintenanceRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function performMaintenanceExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/performMaintenanceExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $reservation = 'reservation-1563081780'; - $reservationsPerformMaintenanceRequestResource = new ReservationsPerformMaintenanceRequest(); - $zone = 'zone3744684'; - $response = $gapicClient->performMaintenance($project, $reservation, $reservationsPerformMaintenanceRequestResource, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 resizeTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/resizeTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/resizeTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $reservation = 'reservation-1563081780'; - $reservationsResizeRequestResource = new ReservationsResizeRequest(); - $zone = 'zone3744684'; - $response = $gapicClient->resize($project, $reservation, $reservationsResizeRequestResource, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.Reservations/Resize', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getReservation(); - $this->assertProtobufEquals($reservation, $actualValue); - $actualValue = $actualApiRequestObject->getReservationsResizeRequestResource(); - $this->assertProtobufEquals($reservationsResizeRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function resizeExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/resizeExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $reservation = 'reservation-1563081780'; - $reservationsResizeRequestResource = new ReservationsResizeRequest(); - $zone = 'zone3744684'; - $response = $gapicClient->resize($project, $reservation, $reservationsResizeRequestResource, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 - $etag = 'etag3123477'; - $iamOwned = false; - $version = 351608024; - $expectedResponse = new Policy(); - $expectedResponse->setEtag($etag); - $expectedResponse->setIamOwned($iamOwned); - $expectedResponse->setVersion($version); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $zone = 'zone3744684'; - $zoneSetPolicyRequestResource = new ZoneSetPolicyRequest(); - $response = $gapicClient->setIamPolicy($project, $resource, $zone, $zoneSetPolicyRequestResource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Reservations/SetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $actualValue = $actualRequestObject->getZoneSetPolicyRequestResource(); - $this->assertProtobufEquals($zoneSetPolicyRequestResource, $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 - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $zone = 'zone3744684'; - $zoneSetPolicyRequestResource = new ZoneSetPolicyRequest(); - try { - $gapicClient->setIamPolicy($project, $resource, $zone, $zoneSetPolicyRequestResource); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $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 TestPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $testPermissionsRequestResource = new TestPermissionsRequest(); - $zone = 'zone3744684'; - $response = $gapicClient->testIamPermissions($project, $resource, $testPermissionsRequestResource, $zone); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Reservations/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getTestPermissionsRequestResource(); - $this->assertProtobufEquals($testPermissionsRequestResource, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $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 - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $testPermissionsRequestResource = new TestPermissionsRequest(); - $zone = 'zone3744684'; - try { - $gapicClient->testIamPermissions($project, $resource, $testPermissionsRequestResource, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/updateTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/updateTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $reservation = 'reservation-1563081780'; - $reservationResource = new Reservation(); - $zone = 'zone3744684'; - $response = $gapicClient->update($project, $reservation, $reservationResource, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.Reservations/Update', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getReservation(); - $this->assertProtobufEquals($reservation, $actualValue); - $actualValue = $actualApiRequestObject->getReservationResource(); - $this->assertProtobufEquals($reservationResource, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function updateExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/updateExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $reservation = 'reservation-1563081780'; - $reservationResource = new Reservation(); - $zone = 'zone3744684'; - $response = $gapicClient->update($project, $reservation, $reservationResource, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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/Compute/tests/Unit/V1/ResourcePoliciesClientTest.php b/Compute/tests/Unit/V1/ResourcePoliciesClientTest.php deleted file mode 100644 index 21692bedd2c6..000000000000 --- a/Compute/tests/Unit/V1/ResourcePoliciesClientTest.php +++ /dev/null @@ -1,890 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return ResourcePoliciesClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new ResourcePoliciesClient($options); - } - - /** @test */ - public function aggregatedListTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $etag = 'etag3123477'; - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $items = [ - 'itemsKey' => new ResourcePoliciesScopedList(), - ]; - $expectedResponse = new ResourcePolicyAggregatedList(); - $expectedResponse->setEtag($etag); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->aggregatedList($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertArrayHasKey('itemsKey', $expectedResponse->getItems()); - $this->assertArrayHasKey('itemsKey', $resources); - $this->assertEquals($expectedResponse->getItems()['itemsKey'], $resources['itemsKey']); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.ResourcePolicies/AggregatedList', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function aggregatedListExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->aggregatedList($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $resourcePolicy = 'resourcePolicy696111747'; - $response = $gapicClient->delete($project, $region, $resourcePolicy); - $this->assertFalse($response->isDone()); - $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.compute.v1.ResourcePolicies/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getResourcePolicy(); - $this->assertProtobufEquals($resourcePolicy, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $resourcePolicy = 'resourcePolicy696111747'; - $response = $gapicClient->delete($project, $region, $resourcePolicy); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $id = 3355; - $kind = 'kind3292052'; - $name = 'name3373707'; - $region2 = 'region2-690338393'; - $selfLink = 'selfLink-1691268851'; - $status = 'status-892481550'; - $expectedResponse = new ResourcePolicy(); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setName($name); - $expectedResponse->setRegion($region2); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setStatus($status); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $resourcePolicy = 'resourcePolicy696111747'; - $response = $gapicClient->get($project, $region, $resourcePolicy); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.ResourcePolicies/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualRequestObject->getResourcePolicy(); - $this->assertProtobufEquals($resourcePolicy, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $resourcePolicy = 'resourcePolicy696111747'; - try { - $gapicClient->get($project, $region, $resourcePolicy); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $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 - $etag = 'etag3123477'; - $iamOwned = false; - $version = 351608024; - $expectedResponse = new Policy(); - $expectedResponse->setEtag($etag); - $expectedResponse->setIamOwned($iamOwned); - $expectedResponse->setVersion($version); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $resource = 'resource-341064690'; - $response = $gapicClient->getIamPolicy($project, $region, $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.compute.v1.ResourcePolicies/GetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $resource = 'resource-341064690'; - try { - $gapicClient->getIamPolicy($project, $region, $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 insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $resourcePolicyResource = new ResourcePolicy(); - $response = $gapicClient->insert($project, $region, $resourcePolicyResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.ResourcePolicies/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getResourcePolicyResource(); - $this->assertProtobufEquals($resourcePolicyResource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $resourcePolicyResource = new ResourcePolicy(); - $response = $gapicClient->insert($project, $region, $resourcePolicyResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $etag = 'etag3123477'; - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new ResourcePolicy(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new ResourcePolicyList(); - $expectedResponse->setEtag($etag); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->list($project, $region); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.ResourcePolicies/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->list($project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function patchTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/patchTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $resourcePolicy = 'resourcePolicy696111747'; - $resourcePolicyResource = new ResourcePolicy(); - $response = $gapicClient->patch($project, $region, $resourcePolicy, $resourcePolicyResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.ResourcePolicies/Patch', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getResourcePolicy(); - $this->assertProtobufEquals($resourcePolicy, $actualValue); - $actualValue = $actualApiRequestObject->getResourcePolicyResource(); - $this->assertProtobufEquals($resourcePolicyResource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function patchExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $resourcePolicy = 'resourcePolicy696111747'; - $resourcePolicyResource = new ResourcePolicy(); - $response = $gapicClient->patch($project, $region, $resourcePolicy, $resourcePolicyResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 - $etag = 'etag3123477'; - $iamOwned = false; - $version = 351608024; - $expectedResponse = new Policy(); - $expectedResponse->setEtag($etag); - $expectedResponse->setIamOwned($iamOwned); - $expectedResponse->setVersion($version); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionSetPolicyRequestResource = new RegionSetPolicyRequest(); - $resource = 'resource-341064690'; - $response = $gapicClient->setIamPolicy($project, $region, $regionSetPolicyRequestResource, $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.compute.v1.ResourcePolicies/SetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualRequestObject->getRegionSetPolicyRequestResource(); - $this->assertProtobufEquals($regionSetPolicyRequestResource, $actualValue); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionSetPolicyRequestResource = new RegionSetPolicyRequest(); - $resource = 'resource-341064690'; - try { - $gapicClient->setIamPolicy($project, $region, $regionSetPolicyRequestResource, $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 testIamPermissionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new TestPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $resource = 'resource-341064690'; - $testPermissionsRequestResource = new TestPermissionsRequest(); - $response = $gapicClient->testIamPermissions($project, $region, $resource, $testPermissionsRequestResource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.ResourcePolicies/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getTestPermissionsRequestResource(); - $this->assertProtobufEquals($testPermissionsRequestResource, $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $resource = 'resource-341064690'; - $testPermissionsRequestResource = new TestPermissionsRequest(); - try { - $gapicClient->testIamPermissions($project, $region, $resource, $testPermissionsRequestResource); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->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/Compute/tests/Unit/V1/RoutersClientTest.php b/Compute/tests/Unit/V1/RoutersClientTest.php deleted file mode 100644 index 950f0748d60d..000000000000 --- a/Compute/tests/Unit/V1/RoutersClientTest.php +++ /dev/null @@ -1,1667 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return RoutersClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new RoutersClient($options); - } - - /** @test */ - public function aggregatedListTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $items = [ - 'itemsKey' => new RoutersScopedList(), - ]; - $expectedResponse = new RouterAggregatedList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->aggregatedList($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertArrayHasKey('itemsKey', $expectedResponse->getItems()); - $this->assertArrayHasKey('itemsKey', $resources); - $this->assertEquals($expectedResponse->getItems()['itemsKey'], $resources['itemsKey']); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Routers/AggregatedList', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function aggregatedListExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->aggregatedList($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $router = 'router-925132983'; - $response = $gapicClient->delete($project, $region, $router); - $this->assertFalse($response->isDone()); - $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.compute.v1.Routers/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getRouter(); - $this->assertProtobufEquals($router, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $router = 'router-925132983'; - $response = $gapicClient->delete($project, $region, $router); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 deleteRoutePolicyTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteRoutePolicyTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteRoutePolicyTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $router = 'router-925132983'; - $response = $gapicClient->deleteRoutePolicy($project, $region, $router); - $this->assertFalse($response->isDone()); - $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.compute.v1.Routers/DeleteRoutePolicy', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getRouter(); - $this->assertProtobufEquals($router, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteRoutePolicyExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteRoutePolicyExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $router = 'router-925132983'; - $response = $gapicClient->deleteRoutePolicy($project, $region, $router); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $encryptedInterconnectRouter = false; - $id = 3355; - $kind = 'kind3292052'; - $name = 'name3373707'; - $network = 'network1843485230'; - $region2 = 'region2-690338393'; - $selfLink = 'selfLink-1691268851'; - $expectedResponse = new Router(); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setEncryptedInterconnectRouter($encryptedInterconnectRouter); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setName($name); - $expectedResponse->setNetwork($network); - $expectedResponse->setRegion($region2); - $expectedResponse->setSelfLink($selfLink); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $router = 'router-925132983'; - $response = $gapicClient->get($project, $region, $router); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Routers/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualRequestObject->getRouter(); - $this->assertProtobufEquals($router, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $router = 'router-925132983'; - try { - $gapicClient->get($project, $region, $router); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getNatIpInfoTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new NatIpInfoResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $router = 'router-925132983'; - $response = $gapicClient->getNatIpInfo($project, $region, $router); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Routers/GetNatIpInfo', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualRequestObject->getRouter(); - $this->assertProtobufEquals($router, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getNatIpInfoExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $router = 'router-925132983'; - try { - $gapicClient->getNatIpInfo($project, $region, $router); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getNatMappingInfoTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $resultElement = new VmEndpointNatMappings(); - $result = [ - $resultElement, - ]; - $expectedResponse = new VmEndpointNatMappingsList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setResult($result); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $router = 'router-925132983'; - $response = $gapicClient->getNatMappingInfo($project, $region, $router); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getResult()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Routers/GetNatMappingInfo', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualRequestObject->getRouter(); - $this->assertProtobufEquals($router, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getNatMappingInfoExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $router = 'router-925132983'; - try { - $gapicClient->getNatMappingInfo($project, $region, $router); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getRoutePolicyTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new RoutersGetRoutePolicyResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $router = 'router-925132983'; - $response = $gapicClient->getRoutePolicy($project, $region, $router); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Routers/GetRoutePolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualRequestObject->getRouter(); - $this->assertProtobufEquals($router, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getRoutePolicyExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $router = 'router-925132983'; - try { - $gapicClient->getRoutePolicy($project, $region, $router); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getRouterStatusTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $kind = 'kind3292052'; - $expectedResponse = new RouterStatusResponse(); - $expectedResponse->setKind($kind); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $router = 'router-925132983'; - $response = $gapicClient->getRouterStatus($project, $region, $router); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Routers/GetRouterStatus', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualRequestObject->getRouter(); - $this->assertProtobufEquals($router, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getRouterStatusExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $router = 'router-925132983'; - try { - $gapicClient->getRouterStatus($project, $region, $router); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $routerResource = new Router(); - $response = $gapicClient->insert($project, $region, $routerResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.Routers/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getRouterResource(); - $this->assertProtobufEquals($routerResource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $routerResource = new Router(); - $response = $gapicClient->insert($project, $region, $routerResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new Router(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new RouterList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->list($project, $region); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Routers/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->list($project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listBgpRoutesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $etag = 'etag3123477'; - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = 'nextPageToken-1530815211'; - $selfLink = 'selfLink-1691268851'; - $expectedResponse = new RoutersListBgpRoutes(); - $expectedResponse->setEtag($etag); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $router = 'router-925132983'; - $response = $gapicClient->listBgpRoutes($project, $region, $router); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Routers/ListBgpRoutes', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualRequestObject->getRouter(); - $this->assertProtobufEquals($router, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listBgpRoutesExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $router = 'router-925132983'; - try { - $gapicClient->listBgpRoutes($project, $region, $router); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listRoutePoliciesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $etag = 'etag3123477'; - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = 'nextPageToken-1530815211'; - $selfLink = 'selfLink-1691268851'; - $expectedResponse = new RoutersListRoutePolicies(); - $expectedResponse->setEtag($etag); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $router = 'router-925132983'; - $response = $gapicClient->listRoutePolicies($project, $region, $router); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Routers/ListRoutePolicies', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualRequestObject->getRouter(); - $this->assertProtobufEquals($router, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listRoutePoliciesExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $router = 'router-925132983'; - try { - $gapicClient->listRoutePolicies($project, $region, $router); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function patchTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/patchTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $router = 'router-925132983'; - $routerResource = new Router(); - $response = $gapicClient->patch($project, $region, $router, $routerResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.Routers/Patch', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getRouter(); - $this->assertProtobufEquals($router, $actualValue); - $actualValue = $actualApiRequestObject->getRouterResource(); - $this->assertProtobufEquals($routerResource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function patchExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $router = 'router-925132983'; - $routerResource = new Router(); - $response = $gapicClient->patch($project, $region, $router, $routerResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 patchRoutePolicyTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchRoutePolicyTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/patchRoutePolicyTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $routePolicyResource = new RoutePolicy(); - $router = 'router-925132983'; - $response = $gapicClient->patchRoutePolicy($project, $region, $routePolicyResource, $router); - $this->assertFalse($response->isDone()); - $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.compute.v1.Routers/PatchRoutePolicy', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getRoutePolicyResource(); - $this->assertProtobufEquals($routePolicyResource, $actualValue); - $actualValue = $actualApiRequestObject->getRouter(); - $this->assertProtobufEquals($router, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function patchRoutePolicyExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchRoutePolicyExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $routePolicyResource = new RoutePolicy(); - $router = 'router-925132983'; - $response = $gapicClient->patchRoutePolicy($project, $region, $routePolicyResource, $router); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 previewTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new RoutersPreviewResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $router = 'router-925132983'; - $routerResource = new Router(); - $response = $gapicClient->preview($project, $region, $router, $routerResource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Routers/Preview', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualRequestObject->getRouter(); - $this->assertProtobufEquals($router, $actualValue); - $actualValue = $actualRequestObject->getRouterResource(); - $this->assertProtobufEquals($routerResource, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function previewExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $router = 'router-925132983'; - $routerResource = new Router(); - try { - $gapicClient->preview($project, $region, $router, $routerResource); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/updateTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/updateTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $router = 'router-925132983'; - $routerResource = new Router(); - $response = $gapicClient->update($project, $region, $router, $routerResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.Routers/Update', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getRouter(); - $this->assertProtobufEquals($router, $actualValue); - $actualValue = $actualApiRequestObject->getRouterResource(); - $this->assertProtobufEquals($routerResource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function updateExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/updateExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $router = 'router-925132983'; - $routerResource = new Router(); - $response = $gapicClient->update($project, $region, $router, $routerResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 updateRoutePolicyTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/updateRoutePolicyTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/updateRoutePolicyTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $routePolicyResource = new RoutePolicy(); - $router = 'router-925132983'; - $response = $gapicClient->updateRoutePolicy($project, $region, $routePolicyResource, $router); - $this->assertFalse($response->isDone()); - $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.compute.v1.Routers/UpdateRoutePolicy', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getRoutePolicyResource(); - $this->assertProtobufEquals($routePolicyResource, $actualValue); - $actualValue = $actualApiRequestObject->getRouter(); - $this->assertProtobufEquals($router, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function updateRoutePolicyExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/updateRoutePolicyExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $routePolicyResource = new RoutePolicy(); - $router = 'router-925132983'; - $response = $gapicClient->updateRoutePolicy($project, $region, $routePolicyResource, $router); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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/Compute/tests/Unit/V1/RoutesClientTest.php b/Compute/tests/Unit/V1/RoutesClientTest.php deleted file mode 100644 index 3ad28ecb3bc1..000000000000 --- a/Compute/tests/Unit/V1/RoutesClientTest.php +++ /dev/null @@ -1,474 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return RoutesClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new RoutesClient($options); - } - - /** @test */ - public function deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $route = 'route108704329'; - $response = $gapicClient->delete($project, $route); - $this->assertFalse($response->isDone()); - $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.compute.v1.Routes/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRoute(); - $this->assertProtobufEquals($route, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $route = 'route108704329'; - $response = $gapicClient->delete($project, $route); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $destRange = 'destRange918198624'; - $id = 3355; - $kind = 'kind3292052'; - $name = 'name3373707'; - $network = 'network1843485230'; - $nextHopGateway = 'nextHopGateway-159695614'; - $nextHopHub = 'nextHopHub-1948804429'; - $nextHopIlb = 'nextHopIlb-1948803747'; - $nextHopInstance = 'nextHopInstance1467250071'; - $nextHopInterRegionCost = 1586170733; - $nextHopIp = 'nextHopIp1184061353'; - $nextHopMed = 1948800118; - $nextHopNetwork = 'nextHopNetwork1872908524'; - $nextHopOrigin = 'nextHopOrigin-1561859928'; - $nextHopPeering = 'nextHopPeering-661059074'; - $nextHopVpnTunnel = 'nextHopVpnTunnel-1627639147'; - $priority = 1165461084; - $routeStatus = 'routeStatus955033256'; - $routeType = 'routeType912759664'; - $selfLink = 'selfLink-1691268851'; - $expectedResponse = new Route(); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setDestRange($destRange); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setName($name); - $expectedResponse->setNetwork($network); - $expectedResponse->setNextHopGateway($nextHopGateway); - $expectedResponse->setNextHopHub($nextHopHub); - $expectedResponse->setNextHopIlb($nextHopIlb); - $expectedResponse->setNextHopInstance($nextHopInstance); - $expectedResponse->setNextHopInterRegionCost($nextHopInterRegionCost); - $expectedResponse->setNextHopIp($nextHopIp); - $expectedResponse->setNextHopMed($nextHopMed); - $expectedResponse->setNextHopNetwork($nextHopNetwork); - $expectedResponse->setNextHopOrigin($nextHopOrigin); - $expectedResponse->setNextHopPeering($nextHopPeering); - $expectedResponse->setNextHopVpnTunnel($nextHopVpnTunnel); - $expectedResponse->setPriority($priority); - $expectedResponse->setRouteStatus($routeStatus); - $expectedResponse->setRouteType($routeType); - $expectedResponse->setSelfLink($selfLink); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $route = 'route108704329'; - $response = $gapicClient->get($project, $route); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Routes/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRoute(); - $this->assertProtobufEquals($route, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $route = 'route108704329'; - try { - $gapicClient->get($project, $route); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $routeResource = new Route(); - $response = $gapicClient->insert($project, $routeResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.Routes/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRouteResource(); - $this->assertProtobufEquals($routeResource, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $routeResource = new Route(); - $response = $gapicClient->insert($project, $routeResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new Route(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new RouteList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->list($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Routes/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->list($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->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/Compute/tests/Unit/V1/SecurityPoliciesClientTest.php b/Compute/tests/Unit/V1/SecurityPoliciesClientTest.php deleted file mode 100644 index 132db6033847..000000000000 --- a/Compute/tests/Unit/V1/SecurityPoliciesClientTest.php +++ /dev/null @@ -1,1246 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return SecurityPoliciesClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new SecurityPoliciesClient($options); - } - - /** @test */ - public function addRuleTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/addRuleTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/addRuleTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $securityPolicy = 'securityPolicy1781695249'; - $securityPolicyRuleResource = new SecurityPolicyRule(); - $response = $gapicClient->addRule($project, $securityPolicy, $securityPolicyRuleResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.SecurityPolicies/AddRule', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getSecurityPolicy(); - $this->assertProtobufEquals($securityPolicy, $actualValue); - $actualValue = $actualApiRequestObject->getSecurityPolicyRuleResource(); - $this->assertProtobufEquals($securityPolicyRuleResource, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function addRuleExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/addRuleExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $securityPolicy = 'securityPolicy1781695249'; - $securityPolicyRuleResource = new SecurityPolicyRule(); - $response = $gapicClient->addRule($project, $securityPolicy, $securityPolicyRuleResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 aggregatedListTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $etag = 'etag3123477'; - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $items = [ - 'itemsKey' => new SecurityPoliciesScopedList(), - ]; - $expectedResponse = new SecurityPoliciesAggregatedList(); - $expectedResponse->setEtag($etag); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->aggregatedList($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertArrayHasKey('itemsKey', $expectedResponse->getItems()); - $this->assertArrayHasKey('itemsKey', $resources); - $this->assertEquals($expectedResponse->getItems()['itemsKey'], $resources['itemsKey']); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.SecurityPolicies/AggregatedList', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function aggregatedListExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->aggregatedList($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $securityPolicy = 'securityPolicy1781695249'; - $response = $gapicClient->delete($project, $securityPolicy); - $this->assertFalse($response->isDone()); - $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.compute.v1.SecurityPolicies/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getSecurityPolicy(); - $this->assertProtobufEquals($securityPolicy, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $securityPolicy = 'securityPolicy1781695249'; - $response = $gapicClient->delete($project, $securityPolicy); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $fingerprint = 'fingerprint-1375934236'; - $id = 3355; - $kind = 'kind3292052'; - $labelFingerprint = 'labelFingerprint714995737'; - $name = 'name3373707'; - $region = 'region-934795532'; - $selfLink = 'selfLink-1691268851'; - $type = 'type3575610'; - $expectedResponse = new SecurityPolicy(); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setFingerprint($fingerprint); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setLabelFingerprint($labelFingerprint); - $expectedResponse->setName($name); - $expectedResponse->setRegion($region); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setType($type); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $securityPolicy = 'securityPolicy1781695249'; - $response = $gapicClient->get($project, $securityPolicy); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.SecurityPolicies/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getSecurityPolicy(); - $this->assertProtobufEquals($securityPolicy, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $securityPolicy = 'securityPolicy1781695249'; - try { - $gapicClient->get($project, $securityPolicy); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getRuleTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $action = 'action-1422950858'; - $description = 'description-1724546052'; - $kind = 'kind3292052'; - $preview = true; - $priority2 = 978365527; - $expectedResponse = new SecurityPolicyRule(); - $expectedResponse->setAction($action); - $expectedResponse->setDescription($description); - $expectedResponse->setKind($kind); - $expectedResponse->setPreview($preview); - $expectedResponse->setPriority($priority2); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $securityPolicy = 'securityPolicy1781695249'; - $response = $gapicClient->getRule($project, $securityPolicy); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.SecurityPolicies/GetRule', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getSecurityPolicy(); - $this->assertProtobufEquals($securityPolicy, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getRuleExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $securityPolicy = 'securityPolicy1781695249'; - try { - $gapicClient->getRule($project, $securityPolicy); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $securityPolicyResource = new SecurityPolicy(); - $response = $gapicClient->insert($project, $securityPolicyResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.SecurityPolicies/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getSecurityPolicyResource(); - $this->assertProtobufEquals($securityPolicyResource, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $securityPolicyResource = new SecurityPolicy(); - $response = $gapicClient->insert($project, $securityPolicyResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $itemsElement = new SecurityPolicy(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new SecurityPolicyList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->list($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.SecurityPolicies/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->list($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listPreconfiguredExpressionSetsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new SecurityPoliciesListPreconfiguredExpressionSetsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->listPreconfiguredExpressionSets($project); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.SecurityPolicies/ListPreconfiguredExpressionSets', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listPreconfiguredExpressionSetsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->listPreconfiguredExpressionSets($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function patchTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/patchTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $securityPolicy = 'securityPolicy1781695249'; - $securityPolicyResource = new SecurityPolicy(); - $response = $gapicClient->patch($project, $securityPolicy, $securityPolicyResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.SecurityPolicies/Patch', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getSecurityPolicy(); - $this->assertProtobufEquals($securityPolicy, $actualValue); - $actualValue = $actualApiRequestObject->getSecurityPolicyResource(); - $this->assertProtobufEquals($securityPolicyResource, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function patchExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $securityPolicy = 'securityPolicy1781695249'; - $securityPolicyResource = new SecurityPolicy(); - $response = $gapicClient->patch($project, $securityPolicy, $securityPolicyResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 patchRuleTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchRuleTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/patchRuleTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $securityPolicy = 'securityPolicy1781695249'; - $securityPolicyRuleResource = new SecurityPolicyRule(); - $response = $gapicClient->patchRule($project, $securityPolicy, $securityPolicyRuleResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.SecurityPolicies/PatchRule', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getSecurityPolicy(); - $this->assertProtobufEquals($securityPolicy, $actualValue); - $actualValue = $actualApiRequestObject->getSecurityPolicyRuleResource(); - $this->assertProtobufEquals($securityPolicyRuleResource, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function patchRuleExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchRuleExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $securityPolicy = 'securityPolicy1781695249'; - $securityPolicyRuleResource = new SecurityPolicyRule(); - $response = $gapicClient->patchRule($project, $securityPolicy, $securityPolicyRuleResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 removeRuleTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/removeRuleTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/removeRuleTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $securityPolicy = 'securityPolicy1781695249'; - $response = $gapicClient->removeRule($project, $securityPolicy); - $this->assertFalse($response->isDone()); - $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.compute.v1.SecurityPolicies/RemoveRule', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getSecurityPolicy(); - $this->assertProtobufEquals($securityPolicy, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function removeRuleExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/removeRuleExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $securityPolicy = 'securityPolicy1781695249'; - $response = $gapicClient->removeRule($project, $securityPolicy); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 setLabelsTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setLabelsTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/setLabelsTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $globalSetLabelsRequestResource = new GlobalSetLabelsRequest(); - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $response = $gapicClient->setLabels($globalSetLabelsRequestResource, $project, $resource); - $this->assertFalse($response->isDone()); - $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.compute.v1.SecurityPolicies/SetLabels', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getGlobalSetLabelsRequestResource(); - $this->assertProtobufEquals($globalSetLabelsRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setLabelsExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setLabelsExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $globalSetLabelsRequestResource = new GlobalSetLabelsRequest(); - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $response = $gapicClient->setLabels($globalSetLabelsRequestResource, $project, $resource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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/Compute/tests/Unit/V1/ServiceAttachmentsClientTest.php b/Compute/tests/Unit/V1/ServiceAttachmentsClientTest.php deleted file mode 100644 index ec5ffe147c53..000000000000 --- a/Compute/tests/Unit/V1/ServiceAttachmentsClientTest.php +++ /dev/null @@ -1,898 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return ServiceAttachmentsClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new ServiceAttachmentsClient($options); - } - - /** @test */ - public function aggregatedListTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $items = [ - 'itemsKey' => new ServiceAttachmentsScopedList(), - ]; - $expectedResponse = new ServiceAttachmentAggregatedList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->aggregatedList($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertArrayHasKey('itemsKey', $expectedResponse->getItems()); - $this->assertArrayHasKey('itemsKey', $resources); - $this->assertEquals($expectedResponse->getItems()['itemsKey'], $resources['itemsKey']); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.ServiceAttachments/AggregatedList', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function aggregatedListExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->aggregatedList($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $serviceAttachment = 'serviceAttachment-1271655187'; - $response = $gapicClient->delete($project, $region, $serviceAttachment); - $this->assertFalse($response->isDone()); - $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.compute.v1.ServiceAttachments/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getServiceAttachment(); - $this->assertProtobufEquals($serviceAttachment, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $serviceAttachment = 'serviceAttachment-1271655187'; - $response = $gapicClient->delete($project, $region, $serviceAttachment); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $connectionPreference = 'connectionPreference822688988'; - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $enableProxyProtocol = false; - $fingerprint = 'fingerprint-1375934236'; - $id = 3355; - $kind = 'kind3292052'; - $name = 'name3373707'; - $producerForwardingRule = 'producerForwardingRule-825813935'; - $propagatedConnectionLimit = 1814764418; - $reconcileConnections = true; - $region2 = 'region2-690338393'; - $selfLink = 'selfLink-1691268851'; - $targetService = 'targetService-1609318905'; - $expectedResponse = new ServiceAttachment(); - $expectedResponse->setConnectionPreference($connectionPreference); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setEnableProxyProtocol($enableProxyProtocol); - $expectedResponse->setFingerprint($fingerprint); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setName($name); - $expectedResponse->setProducerForwardingRule($producerForwardingRule); - $expectedResponse->setPropagatedConnectionLimit($propagatedConnectionLimit); - $expectedResponse->setReconcileConnections($reconcileConnections); - $expectedResponse->setRegion($region2); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setTargetService($targetService); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $serviceAttachment = 'serviceAttachment-1271655187'; - $response = $gapicClient->get($project, $region, $serviceAttachment); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.ServiceAttachments/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualRequestObject->getServiceAttachment(); - $this->assertProtobufEquals($serviceAttachment, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $serviceAttachment = 'serviceAttachment-1271655187'; - try { - $gapicClient->get($project, $region, $serviceAttachment); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $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 - $etag = 'etag3123477'; - $iamOwned = false; - $version = 351608024; - $expectedResponse = new Policy(); - $expectedResponse->setEtag($etag); - $expectedResponse->setIamOwned($iamOwned); - $expectedResponse->setVersion($version); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $resource = 'resource-341064690'; - $response = $gapicClient->getIamPolicy($project, $region, $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.compute.v1.ServiceAttachments/GetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $resource = 'resource-341064690'; - try { - $gapicClient->getIamPolicy($project, $region, $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 insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $serviceAttachmentResource = new ServiceAttachment(); - $response = $gapicClient->insert($project, $region, $serviceAttachmentResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.ServiceAttachments/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getServiceAttachmentResource(); - $this->assertProtobufEquals($serviceAttachmentResource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $serviceAttachmentResource = new ServiceAttachment(); - $response = $gapicClient->insert($project, $region, $serviceAttachmentResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new ServiceAttachment(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new ServiceAttachmentList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->list($project, $region); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.ServiceAttachments/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->list($project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function patchTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/patchTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $serviceAttachment = 'serviceAttachment-1271655187'; - $serviceAttachmentResource = new ServiceAttachment(); - $response = $gapicClient->patch($project, $region, $serviceAttachment, $serviceAttachmentResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.ServiceAttachments/Patch', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getServiceAttachment(); - $this->assertProtobufEquals($serviceAttachment, $actualValue); - $actualValue = $actualApiRequestObject->getServiceAttachmentResource(); - $this->assertProtobufEquals($serviceAttachmentResource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function patchExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $serviceAttachment = 'serviceAttachment-1271655187'; - $serviceAttachmentResource = new ServiceAttachment(); - $response = $gapicClient->patch($project, $region, $serviceAttachment, $serviceAttachmentResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 - $etag = 'etag3123477'; - $iamOwned = false; - $version = 351608024; - $expectedResponse = new Policy(); - $expectedResponse->setEtag($etag); - $expectedResponse->setIamOwned($iamOwned); - $expectedResponse->setVersion($version); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionSetPolicyRequestResource = new RegionSetPolicyRequest(); - $resource = 'resource-341064690'; - $response = $gapicClient->setIamPolicy($project, $region, $regionSetPolicyRequestResource, $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.compute.v1.ServiceAttachments/SetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualRequestObject->getRegionSetPolicyRequestResource(); - $this->assertProtobufEquals($regionSetPolicyRequestResource, $actualValue); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionSetPolicyRequestResource = new RegionSetPolicyRequest(); - $resource = 'resource-341064690'; - try { - $gapicClient->setIamPolicy($project, $region, $regionSetPolicyRequestResource, $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 testIamPermissionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new TestPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $resource = 'resource-341064690'; - $testPermissionsRequestResource = new TestPermissionsRequest(); - $response = $gapicClient->testIamPermissions($project, $region, $resource, $testPermissionsRequestResource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.ServiceAttachments/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getTestPermissionsRequestResource(); - $this->assertProtobufEquals($testPermissionsRequestResource, $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $resource = 'resource-341064690'; - $testPermissionsRequestResource = new TestPermissionsRequest(); - try { - $gapicClient->testIamPermissions($project, $region, $resource, $testPermissionsRequestResource); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->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/Compute/tests/Unit/V1/SnapshotSettingsServiceClientTest.php b/Compute/tests/Unit/V1/SnapshotSettingsServiceClientTest.php deleted file mode 100644 index fd4fe58f927f..000000000000 --- a/Compute/tests/Unit/V1/SnapshotSettingsServiceClientTest.php +++ /dev/null @@ -1,237 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return SnapshotSettingsServiceClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new SnapshotSettingsServiceClient($options); - } - - /** @test */ - public function getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new SnapshotSettings(); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->get($project); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.SnapshotSettingsService/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->get($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function patchTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/patchTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $snapshotSettingsResource = new SnapshotSettings(); - $response = $gapicClient->patch($project, $snapshotSettingsResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.SnapshotSettingsService/Patch', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getSnapshotSettingsResource(); - $this->assertProtobufEquals($snapshotSettingsResource, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function patchExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $snapshotSettingsResource = new SnapshotSettings(); - $response = $gapicClient->patch($project, $snapshotSettingsResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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/Compute/tests/Unit/V1/SnapshotsClientTest.php b/Compute/tests/Unit/V1/SnapshotsClientTest.php deleted file mode 100644 index 37935e77bc1b..000000000000 --- a/Compute/tests/Unit/V1/SnapshotsClientTest.php +++ /dev/null @@ -1,817 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return SnapshotsClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new SnapshotsClient($options); - } - - /** @test */ - public function deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $snapshot = 'snapshot284874180'; - $response = $gapicClient->delete($project, $snapshot); - $this->assertFalse($response->isDone()); - $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.compute.v1.Snapshots/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getSnapshot(); - $this->assertProtobufEquals($snapshot, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $snapshot = 'snapshot284874180'; - $response = $gapicClient->delete($project, $snapshot); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $architecture = 'architecture839674195'; - $autoCreated = true; - $chainName = 'chainName-2078839479'; - $creationSizeBytes = 1199141901; - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $diskSizeGb = 757478089; - $downloadBytes = 971924980; - $enableConfidentialCompute = true; - $guestFlush = false; - $id = 3355; - $kind = 'kind3292052'; - $labelFingerprint = 'labelFingerprint714995737'; - $locationHint = 'locationHint-1796964143'; - $name = 'name3373707'; - $satisfiesPzi = false; - $satisfiesPzs = false; - $selfLink = 'selfLink-1691268851'; - $snapshotType = 'snapshotType1198091477'; - $sourceDisk = 'sourceDisk-85117119'; - $sourceDiskForRecoveryCheckpoint = 'sourceDiskForRecoveryCheckpoint-713903874'; - $sourceDiskId = 'sourceDiskId-1693292839'; - $sourceInstantSnapshot = 'sourceInstantSnapshot-317668858'; - $sourceInstantSnapshotId = 'sourceInstantSnapshotId-1859900940'; - $sourceSnapshotSchedulePolicy = 'sourceSnapshotSchedulePolicy-837985533'; - $sourceSnapshotSchedulePolicyId = 'sourceSnapshotSchedulePolicyId-2076994601'; - $status = 'status-892481550'; - $storageBytes = 2035244455; - $storageBytesStatus = 'storageBytesStatus1027609994'; - $expectedResponse = new Snapshot(); - $expectedResponse->setArchitecture($architecture); - $expectedResponse->setAutoCreated($autoCreated); - $expectedResponse->setChainName($chainName); - $expectedResponse->setCreationSizeBytes($creationSizeBytes); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setDiskSizeGb($diskSizeGb); - $expectedResponse->setDownloadBytes($downloadBytes); - $expectedResponse->setEnableConfidentialCompute($enableConfidentialCompute); - $expectedResponse->setGuestFlush($guestFlush); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setLabelFingerprint($labelFingerprint); - $expectedResponse->setLocationHint($locationHint); - $expectedResponse->setName($name); - $expectedResponse->setSatisfiesPzi($satisfiesPzi); - $expectedResponse->setSatisfiesPzs($satisfiesPzs); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setSnapshotType($snapshotType); - $expectedResponse->setSourceDisk($sourceDisk); - $expectedResponse->setSourceDiskForRecoveryCheckpoint($sourceDiskForRecoveryCheckpoint); - $expectedResponse->setSourceDiskId($sourceDiskId); - $expectedResponse->setSourceInstantSnapshot($sourceInstantSnapshot); - $expectedResponse->setSourceInstantSnapshotId($sourceInstantSnapshotId); - $expectedResponse->setSourceSnapshotSchedulePolicy($sourceSnapshotSchedulePolicy); - $expectedResponse->setSourceSnapshotSchedulePolicyId($sourceSnapshotSchedulePolicyId); - $expectedResponse->setStatus($status); - $expectedResponse->setStorageBytes($storageBytes); - $expectedResponse->setStorageBytesStatus($storageBytesStatus); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $snapshot = 'snapshot284874180'; - $response = $gapicClient->get($project, $snapshot); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Snapshots/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getSnapshot(); - $this->assertProtobufEquals($snapshot, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $snapshot = 'snapshot284874180'; - try { - $gapicClient->get($project, $snapshot); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $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 - $etag = 'etag3123477'; - $iamOwned = false; - $version = 351608024; - $expectedResponse = new Policy(); - $expectedResponse->setEtag($etag); - $expectedResponse->setIamOwned($iamOwned); - $expectedResponse->setVersion($version); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $response = $gapicClient->getIamPolicy($project, $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.compute.v1.Snapshots/GetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $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 - $project = 'project-309310695'; - $resource = 'resource-341064690'; - try { - $gapicClient->getIamPolicy($project, $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 insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $snapshotResource = new Snapshot(); - $response = $gapicClient->insert($project, $snapshotResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.Snapshots/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getSnapshotResource(); - $this->assertProtobufEquals($snapshotResource, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $snapshotResource = new Snapshot(); - $response = $gapicClient->insert($project, $snapshotResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new Snapshot(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new SnapshotList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->list($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Snapshots/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->list($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $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 - $etag = 'etag3123477'; - $iamOwned = false; - $version = 351608024; - $expectedResponse = new Policy(); - $expectedResponse->setEtag($etag); - $expectedResponse->setIamOwned($iamOwned); - $expectedResponse->setVersion($version); - $transport->addResponse($expectedResponse); - // Mock request - $globalSetPolicyRequestResource = new GlobalSetPolicyRequest(); - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $response = $gapicClient->setIamPolicy($globalSetPolicyRequestResource, $project, $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.compute.v1.Snapshots/SetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getGlobalSetPolicyRequestResource(); - $this->assertProtobufEquals($globalSetPolicyRequestResource, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $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 - $globalSetPolicyRequestResource = new GlobalSetPolicyRequest(); - $project = 'project-309310695'; - $resource = 'resource-341064690'; - try { - $gapicClient->setIamPolicy($globalSetPolicyRequestResource, $project, $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 setLabelsTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setLabelsTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/setLabelsTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $globalSetLabelsRequestResource = new GlobalSetLabelsRequest(); - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $response = $gapicClient->setLabels($globalSetLabelsRequestResource, $project, $resource); - $this->assertFalse($response->isDone()); - $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.compute.v1.Snapshots/SetLabels', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getGlobalSetLabelsRequestResource(); - $this->assertProtobufEquals($globalSetLabelsRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setLabelsExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setLabelsExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $globalSetLabelsRequestResource = new GlobalSetLabelsRequest(); - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $response = $gapicClient->setLabels($globalSetLabelsRequestResource, $project, $resource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 testIamPermissionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new TestPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $testPermissionsRequestResource = new TestPermissionsRequest(); - $response = $gapicClient->testIamPermissions($project, $resource, $testPermissionsRequestResource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Snapshots/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getTestPermissionsRequestResource(); - $this->assertProtobufEquals($testPermissionsRequestResource, $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 - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $testPermissionsRequestResource = new TestPermissionsRequest(); - try { - $gapicClient->testIamPermissions($project, $resource, $testPermissionsRequestResource); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->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/Compute/tests/Unit/V1/SslCertificatesClientTest.php b/Compute/tests/Unit/V1/SslCertificatesClientTest.php deleted file mode 100644 index 251597751d63..000000000000 --- a/Compute/tests/Unit/V1/SslCertificatesClientTest.php +++ /dev/null @@ -1,529 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return SslCertificatesClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new SslCertificatesClient($options); - } - - /** @test */ - public function aggregatedListTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $items = [ - 'itemsKey' => new SslCertificatesScopedList(), - ]; - $expectedResponse = new SslCertificateAggregatedList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->aggregatedList($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertArrayHasKey('itemsKey', $expectedResponse->getItems()); - $this->assertArrayHasKey('itemsKey', $resources); - $this->assertEquals($expectedResponse->getItems()['itemsKey'], $resources['itemsKey']); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.SslCertificates/AggregatedList', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function aggregatedListExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->aggregatedList($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $sslCertificate = 'sslCertificate-1027298332'; - $response = $gapicClient->delete($project, $sslCertificate); - $this->assertFalse($response->isDone()); - $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.compute.v1.SslCertificates/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getSslCertificate(); - $this->assertProtobufEquals($sslCertificate, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $sslCertificate = 'sslCertificate-1027298332'; - $response = $gapicClient->delete($project, $sslCertificate); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $certificate = 'certificate1952399767'; - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $expireTime = 'expireTime-96179731'; - $id = 3355; - $kind = 'kind3292052'; - $name = 'name3373707'; - $privateKey = 'privateKey1971943843'; - $region = 'region-934795532'; - $selfLink = 'selfLink-1691268851'; - $type = 'type3575610'; - $expectedResponse = new SslCertificate(); - $expectedResponse->setCertificate($certificate); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setExpireTime($expireTime); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setName($name); - $expectedResponse->setPrivateKey($privateKey); - $expectedResponse->setRegion($region); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setType($type); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $sslCertificate = 'sslCertificate-1027298332'; - $response = $gapicClient->get($project, $sslCertificate); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.SslCertificates/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getSslCertificate(); - $this->assertProtobufEquals($sslCertificate, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $sslCertificate = 'sslCertificate-1027298332'; - try { - $gapicClient->get($project, $sslCertificate); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $sslCertificateResource = new SslCertificate(); - $response = $gapicClient->insert($project, $sslCertificateResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.SslCertificates/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getSslCertificateResource(); - $this->assertProtobufEquals($sslCertificateResource, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $sslCertificateResource = new SslCertificate(); - $response = $gapicClient->insert($project, $sslCertificateResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new SslCertificate(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new SslCertificateList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->list($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.SslCertificates/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->list($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->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/Compute/tests/Unit/V1/SslPoliciesClientTest.php b/Compute/tests/Unit/V1/SslPoliciesClientTest.php deleted file mode 100644 index ee345330dba1..000000000000 --- a/Compute/tests/Unit/V1/SslPoliciesClientTest.php +++ /dev/null @@ -1,706 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return SslPoliciesClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new SslPoliciesClient($options); - } - - /** @test */ - public function aggregatedListTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $etag = 'etag3123477'; - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $items = [ - 'itemsKey' => new SslPoliciesScopedList(), - ]; - $expectedResponse = new SslPoliciesAggregatedList(); - $expectedResponse->setEtag($etag); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->aggregatedList($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertArrayHasKey('itemsKey', $expectedResponse->getItems()); - $this->assertArrayHasKey('itemsKey', $resources); - $this->assertEquals($expectedResponse->getItems()['itemsKey'], $resources['itemsKey']); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.SslPolicies/AggregatedList', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function aggregatedListExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->aggregatedList($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $sslPolicy = 'sslPolicy-1852293435'; - $response = $gapicClient->delete($project, $sslPolicy); - $this->assertFalse($response->isDone()); - $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.compute.v1.SslPolicies/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getSslPolicy(); - $this->assertProtobufEquals($sslPolicy, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $sslPolicy = 'sslPolicy-1852293435'; - $response = $gapicClient->delete($project, $sslPolicy); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $fingerprint = 'fingerprint-1375934236'; - $id = 3355; - $kind = 'kind3292052'; - $minTlsVersion = 'minTlsVersion8155943'; - $name = 'name3373707'; - $profile = 'profile-309425751'; - $region = 'region-934795532'; - $selfLink = 'selfLink-1691268851'; - $expectedResponse = new SslPolicy(); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setFingerprint($fingerprint); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setMinTlsVersion($minTlsVersion); - $expectedResponse->setName($name); - $expectedResponse->setProfile($profile); - $expectedResponse->setRegion($region); - $expectedResponse->setSelfLink($selfLink); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $sslPolicy = 'sslPolicy-1852293435'; - $response = $gapicClient->get($project, $sslPolicy); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.SslPolicies/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getSslPolicy(); - $this->assertProtobufEquals($sslPolicy, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $sslPolicy = 'sslPolicy-1852293435'; - try { - $gapicClient->get($project, $sslPolicy); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $sslPolicyResource = new SslPolicy(); - $response = $gapicClient->insert($project, $sslPolicyResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.SslPolicies/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getSslPolicyResource(); - $this->assertProtobufEquals($sslPolicyResource, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $sslPolicyResource = new SslPolicy(); - $response = $gapicClient->insert($project, $sslPolicyResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new SslPolicy(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new SslPoliciesList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->list($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.SslPolicies/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->list($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listAvailableFeaturesTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new SslPoliciesListAvailableFeaturesResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->listAvailableFeatures($project); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.SslPolicies/ListAvailableFeatures', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listAvailableFeaturesExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->listAvailableFeatures($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function patchTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/patchTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $sslPolicy = 'sslPolicy-1852293435'; - $sslPolicyResource = new SslPolicy(); - $response = $gapicClient->patch($project, $sslPolicy, $sslPolicyResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.SslPolicies/Patch', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getSslPolicy(); - $this->assertProtobufEquals($sslPolicy, $actualValue); - $actualValue = $actualApiRequestObject->getSslPolicyResource(); - $this->assertProtobufEquals($sslPolicyResource, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function patchExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $sslPolicy = 'sslPolicy-1852293435'; - $sslPolicyResource = new SslPolicy(); - $response = $gapicClient->patch($project, $sslPolicy, $sslPolicyResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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/Compute/tests/Unit/V1/StoragePoolTypesClientTest.php b/Compute/tests/Unit/V1/StoragePoolTypesClientTest.php deleted file mode 100644 index 5e37e604118c..000000000000 --- a/Compute/tests/Unit/V1/StoragePoolTypesClientTest.php +++ /dev/null @@ -1,313 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return StoragePoolTypesClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new StoragePoolTypesClient($options); - } - - /** @test */ - public function aggregatedListTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $items = [ - 'itemsKey' => new StoragePoolTypesScopedList(), - ]; - $expectedResponse = new StoragePoolTypeAggregatedList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->aggregatedList($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertArrayHasKey('itemsKey', $expectedResponse->getItems()); - $this->assertArrayHasKey('itemsKey', $resources); - $this->assertEquals($expectedResponse->getItems()['itemsKey'], $resources['itemsKey']); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.StoragePoolTypes/AggregatedList', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function aggregatedListExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->aggregatedList($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $id = 3355; - $kind = 'kind3292052'; - $maxPoolProvisionedCapacityGb = 1255880909; - $maxPoolProvisionedIops = 1095342084; - $maxPoolProvisionedThroughput = 1302669885; - $minPoolProvisionedCapacityGb = 345848161; - $minPoolProvisionedIops = 1194139030; - $minPoolProvisionedThroughput = 1242850773; - $minSizeGb = 1459020012; - $name = 'name3373707'; - $selfLink = 'selfLink-1691268851'; - $selfLinkWithId = 'selfLinkWithId-1029220862'; - $zone2 = 'zone2-696322977'; - $expectedResponse = new StoragePoolType(); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setMaxPoolProvisionedCapacityGb($maxPoolProvisionedCapacityGb); - $expectedResponse->setMaxPoolProvisionedIops($maxPoolProvisionedIops); - $expectedResponse->setMaxPoolProvisionedThroughput($maxPoolProvisionedThroughput); - $expectedResponse->setMinPoolProvisionedCapacityGb($minPoolProvisionedCapacityGb); - $expectedResponse->setMinPoolProvisionedIops($minPoolProvisionedIops); - $expectedResponse->setMinPoolProvisionedThroughput($minPoolProvisionedThroughput); - $expectedResponse->setMinSizeGb($minSizeGb); - $expectedResponse->setName($name); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setSelfLinkWithId($selfLinkWithId); - $expectedResponse->setZone($zone2); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $storagePoolType = 'storagePoolType1896612025'; - $zone = 'zone3744684'; - $response = $gapicClient->get($project, $storagePoolType, $zone); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.StoragePoolTypes/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getStoragePoolType(); - $this->assertProtobufEquals($storagePoolType, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $storagePoolType = 'storagePoolType1896612025'; - $zone = 'zone3744684'; - try { - $gapicClient->get($project, $storagePoolType, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new StoragePoolType(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new StoragePoolTypeList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->list($project, $zone); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.StoragePoolTypes/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $zone = 'zone3744684'; - try { - $gapicClient->list($project, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->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/Compute/tests/Unit/V1/StoragePoolsClientTest.php b/Compute/tests/Unit/V1/StoragePoolsClientTest.php deleted file mode 100644 index 29711d1cdee2..000000000000 --- a/Compute/tests/Unit/V1/StoragePoolsClientTest.php +++ /dev/null @@ -1,975 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return StoragePoolsClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new StoragePoolsClient($options); - } - - /** @test */ - public function aggregatedListTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $etag = 'etag3123477'; - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $items = [ - 'itemsKey' => new StoragePoolsScopedList(), - ]; - $expectedResponse = new StoragePoolAggregatedList(); - $expectedResponse->setEtag($etag); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->aggregatedList($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertArrayHasKey('itemsKey', $expectedResponse->getItems()); - $this->assertArrayHasKey('itemsKey', $resources); - $this->assertEquals($expectedResponse->getItems()['itemsKey'], $resources['itemsKey']); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.StoragePools/AggregatedList', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function aggregatedListExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->aggregatedList($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $storagePool = 'storagePool897344352'; - $zone = 'zone3744684'; - $response = $gapicClient->delete($project, $storagePool, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.StoragePools/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getStoragePool(); - $this->assertProtobufEquals($storagePool, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $storagePool = 'storagePool897344352'; - $zone = 'zone3744684'; - $response = $gapicClient->delete($project, $storagePool, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $capacityProvisioningType = 'capacityProvisioningType1325352199'; - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $id = 3355; - $kind = 'kind3292052'; - $labelFingerprint = 'labelFingerprint714995737'; - $name = 'name3373707'; - $performanceProvisioningType = 'performanceProvisioningType1542295293'; - $poolProvisionedCapacityGb = 1132075054; - $poolProvisionedIops = 1185834135; - $poolProvisionedThroughput = 1779828376; - $selfLink = 'selfLink-1691268851'; - $selfLinkWithId = 'selfLinkWithId-1029220862'; - $state = 'state109757585'; - $storagePoolType = 'storagePoolType1896612025'; - $zone2 = 'zone2-696322977'; - $expectedResponse = new StoragePool(); - $expectedResponse->setCapacityProvisioningType($capacityProvisioningType); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setLabelFingerprint($labelFingerprint); - $expectedResponse->setName($name); - $expectedResponse->setPerformanceProvisioningType($performanceProvisioningType); - $expectedResponse->setPoolProvisionedCapacityGb($poolProvisionedCapacityGb); - $expectedResponse->setPoolProvisionedIops($poolProvisionedIops); - $expectedResponse->setPoolProvisionedThroughput($poolProvisionedThroughput); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setSelfLinkWithId($selfLinkWithId); - $expectedResponse->setState($state); - $expectedResponse->setStoragePoolType($storagePoolType); - $expectedResponse->setZone($zone2); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $storagePool = 'storagePool897344352'; - $zone = 'zone3744684'; - $response = $gapicClient->get($project, $storagePool, $zone); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.StoragePools/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getStoragePool(); - $this->assertProtobufEquals($storagePool, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $storagePool = 'storagePool897344352'; - $zone = 'zone3744684'; - try { - $gapicClient->get($project, $storagePool, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $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 - $etag = 'etag3123477'; - $iamOwned = false; - $version = 351608024; - $expectedResponse = new Policy(); - $expectedResponse->setEtag($etag); - $expectedResponse->setIamOwned($iamOwned); - $expectedResponse->setVersion($version); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $zone = 'zone3744684'; - $response = $gapicClient->getIamPolicy($project, $resource, $zone); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.StoragePools/GetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $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 - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $zone = 'zone3744684'; - try { - $gapicClient->getIamPolicy($project, $resource, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $storagePoolResource = new StoragePool(); - $zone = 'zone3744684'; - $response = $gapicClient->insert($project, $storagePoolResource, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.StoragePools/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getStoragePoolResource(); - $this->assertProtobufEquals($storagePoolResource, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $storagePoolResource = new StoragePool(); - $zone = 'zone3744684'; - $response = $gapicClient->insert($project, $storagePoolResource, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $etag = 'etag3123477'; - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = 'nextPageToken-1530815211'; - $selfLink = 'selfLink-1691268851'; - $expectedResponse = new StoragePoolList(); - $expectedResponse->setEtag($etag); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->list($project, $zone); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.StoragePools/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $zone = 'zone3744684'; - try { - $gapicClient->list($project, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listDisksTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $etag = 'etag3123477'; - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = 'nextPageToken-1530815211'; - $selfLink = 'selfLink-1691268851'; - $expectedResponse = new StoragePoolListDisks(); - $expectedResponse->setEtag($etag); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $storagePool = 'storagePool897344352'; - $zone = 'zone3744684'; - $response = $gapicClient->listDisks($project, $storagePool, $zone); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.StoragePools/ListDisks', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getStoragePool(); - $this->assertProtobufEquals($storagePool, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listDisksExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $storagePool = 'storagePool897344352'; - $zone = 'zone3744684'; - try { - $gapicClient->listDisks($project, $storagePool, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $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 - $etag = 'etag3123477'; - $iamOwned = false; - $version = 351608024; - $expectedResponse = new Policy(); - $expectedResponse->setEtag($etag); - $expectedResponse->setIamOwned($iamOwned); - $expectedResponse->setVersion($version); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $zone = 'zone3744684'; - $zoneSetPolicyRequestResource = new ZoneSetPolicyRequest(); - $response = $gapicClient->setIamPolicy($project, $resource, $zone, $zoneSetPolicyRequestResource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.StoragePools/SetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $actualValue = $actualRequestObject->getZoneSetPolicyRequestResource(); - $this->assertProtobufEquals($zoneSetPolicyRequestResource, $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 - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $zone = 'zone3744684'; - $zoneSetPolicyRequestResource = new ZoneSetPolicyRequest(); - try { - $gapicClient->setIamPolicy($project, $resource, $zone, $zoneSetPolicyRequestResource); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $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 TestPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $testPermissionsRequestResource = new TestPermissionsRequest(); - $zone = 'zone3744684'; - $response = $gapicClient->testIamPermissions($project, $resource, $testPermissionsRequestResource, $zone); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.StoragePools/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getTestPermissionsRequestResource(); - $this->assertProtobufEquals($testPermissionsRequestResource, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $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 - $project = 'project-309310695'; - $resource = 'resource-341064690'; - $testPermissionsRequestResource = new TestPermissionsRequest(); - $zone = 'zone3744684'; - try { - $gapicClient->testIamPermissions($project, $resource, $testPermissionsRequestResource, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function updateTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/updateTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/updateTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $storagePool = 'storagePool897344352'; - $storagePoolResource = new StoragePool(); - $zone = 'zone3744684'; - $response = $gapicClient->update($project, $storagePool, $storagePoolResource, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.StoragePools/Update', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getStoragePool(); - $this->assertProtobufEquals($storagePool, $actualValue); - $actualValue = $actualApiRequestObject->getStoragePoolResource(); - $this->assertProtobufEquals($storagePoolResource, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function updateExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/updateExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $storagePool = 'storagePool897344352'; - $storagePoolResource = new StoragePool(); - $zone = 'zone3744684'; - $response = $gapicClient->update($project, $storagePool, $storagePoolResource, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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/Compute/tests/Unit/V1/SubnetworksClientTest.php b/Compute/tests/Unit/V1/SubnetworksClientTest.php deleted file mode 100644 index 629c610a1b93..000000000000 --- a/Compute/tests/Unit/V1/SubnetworksClientTest.php +++ /dev/null @@ -1,1244 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return SubnetworksClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new SubnetworksClient($options); - } - - /** @test */ - public function aggregatedListTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $items = [ - 'itemsKey' => new SubnetworksScopedList(), - ]; - $expectedResponse = new SubnetworkAggregatedList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->aggregatedList($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertArrayHasKey('itemsKey', $expectedResponse->getItems()); - $this->assertArrayHasKey('itemsKey', $resources); - $this->assertEquals($expectedResponse->getItems()['itemsKey'], $resources['itemsKey']); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Subnetworks/AggregatedList', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function aggregatedListExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->aggregatedList($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $subnetwork = 'subnetwork-1302785042'; - $response = $gapicClient->delete($project, $region, $subnetwork); - $this->assertFalse($response->isDone()); - $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.compute.v1.Subnetworks/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getSubnetwork(); - $this->assertProtobufEquals($subnetwork, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $subnetwork = 'subnetwork-1302785042'; - $response = $gapicClient->delete($project, $region, $subnetwork); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 expandIpCidrRangeTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/expandIpCidrRangeTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/expandIpCidrRangeTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $subnetwork = 'subnetwork-1302785042'; - $subnetworksExpandIpCidrRangeRequestResource = new SubnetworksExpandIpCidrRangeRequest(); - $response = $gapicClient->expandIpCidrRange($project, $region, $subnetwork, $subnetworksExpandIpCidrRangeRequestResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.Subnetworks/ExpandIpCidrRange', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getSubnetwork(); - $this->assertProtobufEquals($subnetwork, $actualValue); - $actualValue = $actualApiRequestObject->getSubnetworksExpandIpCidrRangeRequestResource(); - $this->assertProtobufEquals($subnetworksExpandIpCidrRangeRequestResource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function expandIpCidrRangeExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/expandIpCidrRangeExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $subnetwork = 'subnetwork-1302785042'; - $subnetworksExpandIpCidrRangeRequestResource = new SubnetworksExpandIpCidrRangeRequest(); - $response = $gapicClient->expandIpCidrRange($project, $region, $subnetwork, $subnetworksExpandIpCidrRangeRequestResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $enableFlowLogs = true; - $externalIpv6Prefix = 'externalIpv6Prefix1749911926'; - $fingerprint = 'fingerprint-1375934236'; - $gatewayAddress = 'gatewayAddress-77003527'; - $id = 3355; - $internalIpv6Prefix = 'internalIpv6Prefix-30600856'; - $ipCidrRange = 'ipCidrRange-2049366326'; - $ipCollection = 'ipCollection176818358'; - $ipv6AccessType = 'ipv6AccessType-569083171'; - $ipv6CidrRange = 'ipv6CidrRange-1874342390'; - $ipv6GceEndpoint = 'ipv6GceEndpoint-753359517'; - $kind = 'kind3292052'; - $name = 'name3373707'; - $network = 'network1843485230'; - $privateIpGoogleAccess = true; - $privateIpv6GoogleAccess = 'privateIpv6GoogleAccess1122018830'; - $purpose = 'purpose-220463842'; - $region2 = 'region2-690338393'; - $reservedInternalRange = 'reservedInternalRange-787493070'; - $role = 'role3506294'; - $selfLink = 'selfLink-1691268851'; - $stackType = 'stackType2036521617'; - $state = 'state109757585'; - $expectedResponse = new Subnetwork(); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setEnableFlowLogs($enableFlowLogs); - $expectedResponse->setExternalIpv6Prefix($externalIpv6Prefix); - $expectedResponse->setFingerprint($fingerprint); - $expectedResponse->setGatewayAddress($gatewayAddress); - $expectedResponse->setId($id); - $expectedResponse->setInternalIpv6Prefix($internalIpv6Prefix); - $expectedResponse->setIpCidrRange($ipCidrRange); - $expectedResponse->setIpCollection($ipCollection); - $expectedResponse->setIpv6AccessType($ipv6AccessType); - $expectedResponse->setIpv6CidrRange($ipv6CidrRange); - $expectedResponse->setIpv6GceEndpoint($ipv6GceEndpoint); - $expectedResponse->setKind($kind); - $expectedResponse->setName($name); - $expectedResponse->setNetwork($network); - $expectedResponse->setPrivateIpGoogleAccess($privateIpGoogleAccess); - $expectedResponse->setPrivateIpv6GoogleAccess($privateIpv6GoogleAccess); - $expectedResponse->setPurpose($purpose); - $expectedResponse->setRegion($region2); - $expectedResponse->setReservedInternalRange($reservedInternalRange); - $expectedResponse->setRole($role); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setStackType($stackType); - $expectedResponse->setState($state); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $subnetwork = 'subnetwork-1302785042'; - $response = $gapicClient->get($project, $region, $subnetwork); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Subnetworks/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualRequestObject->getSubnetwork(); - $this->assertProtobufEquals($subnetwork, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $subnetwork = 'subnetwork-1302785042'; - try { - $gapicClient->get($project, $region, $subnetwork); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $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 - $etag = 'etag3123477'; - $iamOwned = false; - $version = 351608024; - $expectedResponse = new Policy(); - $expectedResponse->setEtag($etag); - $expectedResponse->setIamOwned($iamOwned); - $expectedResponse->setVersion($version); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $resource = 'resource-341064690'; - $response = $gapicClient->getIamPolicy($project, $region, $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.compute.v1.Subnetworks/GetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $resource = 'resource-341064690'; - try { - $gapicClient->getIamPolicy($project, $region, $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 insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $subnetworkResource = new Subnetwork(); - $response = $gapicClient->insert($project, $region, $subnetworkResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.Subnetworks/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getSubnetworkResource(); - $this->assertProtobufEquals($subnetworkResource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $subnetworkResource = new Subnetwork(); - $response = $gapicClient->insert($project, $region, $subnetworkResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new Subnetwork(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new SubnetworkList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->list($project, $region); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Subnetworks/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->list($project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listUsableTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new UsableSubnetwork(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new UsableSubnetworksAggregatedList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->listUsable($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Subnetworks/ListUsable', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listUsableExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->listUsable($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function patchTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/patchTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $subnetwork = 'subnetwork-1302785042'; - $subnetworkResource = new Subnetwork(); - $response = $gapicClient->patch($project, $region, $subnetwork, $subnetworkResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.Subnetworks/Patch', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getSubnetwork(); - $this->assertProtobufEquals($subnetwork, $actualValue); - $actualValue = $actualApiRequestObject->getSubnetworkResource(); - $this->assertProtobufEquals($subnetworkResource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function patchExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $subnetwork = 'subnetwork-1302785042'; - $subnetworkResource = new Subnetwork(); - $response = $gapicClient->patch($project, $region, $subnetwork, $subnetworkResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 - $etag = 'etag3123477'; - $iamOwned = false; - $version = 351608024; - $expectedResponse = new Policy(); - $expectedResponse->setEtag($etag); - $expectedResponse->setIamOwned($iamOwned); - $expectedResponse->setVersion($version); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionSetPolicyRequestResource = new RegionSetPolicyRequest(); - $resource = 'resource-341064690'; - $response = $gapicClient->setIamPolicy($project, $region, $regionSetPolicyRequestResource, $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.compute.v1.Subnetworks/SetIamPolicy', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualRequestObject->getRegionSetPolicyRequestResource(); - $this->assertProtobufEquals($regionSetPolicyRequestResource, $actualValue); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionSetPolicyRequestResource = new RegionSetPolicyRequest(); - $resource = 'resource-341064690'; - try { - $gapicClient->setIamPolicy($project, $region, $regionSetPolicyRequestResource, $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 setPrivateIpGoogleAccessTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setPrivateIpGoogleAccessTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/setPrivateIpGoogleAccessTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $subnetwork = 'subnetwork-1302785042'; - $subnetworksSetPrivateIpGoogleAccessRequestResource = new SubnetworksSetPrivateIpGoogleAccessRequest(); - $response = $gapicClient->setPrivateIpGoogleAccess($project, $region, $subnetwork, $subnetworksSetPrivateIpGoogleAccessRequestResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.Subnetworks/SetPrivateIpGoogleAccess', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getSubnetwork(); - $this->assertProtobufEquals($subnetwork, $actualValue); - $actualValue = $actualApiRequestObject->getSubnetworksSetPrivateIpGoogleAccessRequestResource(); - $this->assertProtobufEquals($subnetworksSetPrivateIpGoogleAccessRequestResource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setPrivateIpGoogleAccessExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setPrivateIpGoogleAccessExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $subnetwork = 'subnetwork-1302785042'; - $subnetworksSetPrivateIpGoogleAccessRequestResource = new SubnetworksSetPrivateIpGoogleAccessRequest(); - $response = $gapicClient->setPrivateIpGoogleAccess($project, $region, $subnetwork, $subnetworksSetPrivateIpGoogleAccessRequestResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 testIamPermissionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new TestPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $resource = 'resource-341064690'; - $testPermissionsRequestResource = new TestPermissionsRequest(); - $response = $gapicClient->testIamPermissions($project, $region, $resource, $testPermissionsRequestResource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Subnetworks/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getTestPermissionsRequestResource(); - $this->assertProtobufEquals($testPermissionsRequestResource, $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $resource = 'resource-341064690'; - $testPermissionsRequestResource = new TestPermissionsRequest(); - try { - $gapicClient->testIamPermissions($project, $region, $resource, $testPermissionsRequestResource); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->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/Compute/tests/Unit/V1/TargetGrpcProxiesClientTest.php b/Compute/tests/Unit/V1/TargetGrpcProxiesClientTest.php deleted file mode 100644 index 432da41991fb..000000000000 --- a/Compute/tests/Unit/V1/TargetGrpcProxiesClientTest.php +++ /dev/null @@ -1,568 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return TargetGrpcProxiesClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new TargetGrpcProxiesClient($options); - } - - /** @test */ - public function deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $targetGrpcProxy = 'targetGrpcProxy-1605592453'; - $response = $gapicClient->delete($project, $targetGrpcProxy); - $this->assertFalse($response->isDone()); - $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.compute.v1.TargetGrpcProxies/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getTargetGrpcProxy(); - $this->assertProtobufEquals($targetGrpcProxy, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $targetGrpcProxy = 'targetGrpcProxy-1605592453'; - $response = $gapicClient->delete($project, $targetGrpcProxy); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $fingerprint = 'fingerprint-1375934236'; - $id = 3355; - $kind = 'kind3292052'; - $name = 'name3373707'; - $selfLink = 'selfLink-1691268851'; - $selfLinkWithId = 'selfLinkWithId-1029220862'; - $urlMap = 'urlMap-169850228'; - $validateForProxyless = true; - $expectedResponse = new TargetGrpcProxy(); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setFingerprint($fingerprint); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setName($name); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setSelfLinkWithId($selfLinkWithId); - $expectedResponse->setUrlMap($urlMap); - $expectedResponse->setValidateForProxyless($validateForProxyless); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $targetGrpcProxy = 'targetGrpcProxy-1605592453'; - $response = $gapicClient->get($project, $targetGrpcProxy); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.TargetGrpcProxies/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getTargetGrpcProxy(); - $this->assertProtobufEquals($targetGrpcProxy, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $targetGrpcProxy = 'targetGrpcProxy-1605592453'; - try { - $gapicClient->get($project, $targetGrpcProxy); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $targetGrpcProxyResource = new TargetGrpcProxy(); - $response = $gapicClient->insert($project, $targetGrpcProxyResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.TargetGrpcProxies/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getTargetGrpcProxyResource(); - $this->assertProtobufEquals($targetGrpcProxyResource, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $targetGrpcProxyResource = new TargetGrpcProxy(); - $response = $gapicClient->insert($project, $targetGrpcProxyResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new TargetGrpcProxy(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new TargetGrpcProxyList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->list($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.TargetGrpcProxies/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->list($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function patchTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/patchTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $targetGrpcProxy = 'targetGrpcProxy-1605592453'; - $targetGrpcProxyResource = new TargetGrpcProxy(); - $response = $gapicClient->patch($project, $targetGrpcProxy, $targetGrpcProxyResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.TargetGrpcProxies/Patch', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getTargetGrpcProxy(); - $this->assertProtobufEquals($targetGrpcProxy, $actualValue); - $actualValue = $actualApiRequestObject->getTargetGrpcProxyResource(); - $this->assertProtobufEquals($targetGrpcProxyResource, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function patchExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $targetGrpcProxy = 'targetGrpcProxy-1605592453'; - $targetGrpcProxyResource = new TargetGrpcProxy(); - $response = $gapicClient->patch($project, $targetGrpcProxy, $targetGrpcProxyResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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/Compute/tests/Unit/V1/TargetHttpProxiesClientTest.php b/Compute/tests/Unit/V1/TargetHttpProxiesClientTest.php deleted file mode 100644 index c225b95a373e..000000000000 --- a/Compute/tests/Unit/V1/TargetHttpProxiesClientTest.php +++ /dev/null @@ -1,766 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return TargetHttpProxiesClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new TargetHttpProxiesClient($options); - } - - /** @test */ - public function aggregatedListTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $items = [ - 'itemsKey' => new TargetHttpProxiesScopedList(), - ]; - $expectedResponse = new TargetHttpProxyAggregatedList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->aggregatedList($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertArrayHasKey('itemsKey', $expectedResponse->getItems()); - $this->assertArrayHasKey('itemsKey', $resources); - $this->assertEquals($expectedResponse->getItems()['itemsKey'], $resources['itemsKey']); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.TargetHttpProxies/AggregatedList', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function aggregatedListExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->aggregatedList($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $targetHttpProxy = 'targetHttpProxy206872421'; - $response = $gapicClient->delete($project, $targetHttpProxy); - $this->assertFalse($response->isDone()); - $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.compute.v1.TargetHttpProxies/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getTargetHttpProxy(); - $this->assertProtobufEquals($targetHttpProxy, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $targetHttpProxy = 'targetHttpProxy206872421'; - $response = $gapicClient->delete($project, $targetHttpProxy); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $fingerprint = 'fingerprint-1375934236'; - $httpKeepAliveTimeoutSec = 2057938782; - $id = 3355; - $kind = 'kind3292052'; - $name = 'name3373707'; - $proxyBind = true; - $region = 'region-934795532'; - $selfLink = 'selfLink-1691268851'; - $urlMap = 'urlMap-169850228'; - $expectedResponse = new TargetHttpProxy(); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setFingerprint($fingerprint); - $expectedResponse->setHttpKeepAliveTimeoutSec($httpKeepAliveTimeoutSec); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setName($name); - $expectedResponse->setProxyBind($proxyBind); - $expectedResponse->setRegion($region); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setUrlMap($urlMap); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $targetHttpProxy = 'targetHttpProxy206872421'; - $response = $gapicClient->get($project, $targetHttpProxy); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.TargetHttpProxies/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getTargetHttpProxy(); - $this->assertProtobufEquals($targetHttpProxy, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $targetHttpProxy = 'targetHttpProxy206872421'; - try { - $gapicClient->get($project, $targetHttpProxy); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $targetHttpProxyResource = new TargetHttpProxy(); - $response = $gapicClient->insert($project, $targetHttpProxyResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.TargetHttpProxies/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getTargetHttpProxyResource(); - $this->assertProtobufEquals($targetHttpProxyResource, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $targetHttpProxyResource = new TargetHttpProxy(); - $response = $gapicClient->insert($project, $targetHttpProxyResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new TargetHttpProxy(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new TargetHttpProxyList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->list($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.TargetHttpProxies/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->list($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function patchTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/patchTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $targetHttpProxy = 'targetHttpProxy206872421'; - $targetHttpProxyResource = new TargetHttpProxy(); - $response = $gapicClient->patch($project, $targetHttpProxy, $targetHttpProxyResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.TargetHttpProxies/Patch', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getTargetHttpProxy(); - $this->assertProtobufEquals($targetHttpProxy, $actualValue); - $actualValue = $actualApiRequestObject->getTargetHttpProxyResource(); - $this->assertProtobufEquals($targetHttpProxyResource, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function patchExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $targetHttpProxy = 'targetHttpProxy206872421'; - $targetHttpProxyResource = new TargetHttpProxy(); - $response = $gapicClient->patch($project, $targetHttpProxy, $targetHttpProxyResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 setUrlMapTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setUrlMapTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/setUrlMapTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $targetHttpProxy = 'targetHttpProxy206872421'; - $urlMapReferenceResource = new UrlMapReference(); - $response = $gapicClient->setUrlMap($project, $targetHttpProxy, $urlMapReferenceResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.TargetHttpProxies/SetUrlMap', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getTargetHttpProxy(); - $this->assertProtobufEquals($targetHttpProxy, $actualValue); - $actualValue = $actualApiRequestObject->getUrlMapReferenceResource(); - $this->assertProtobufEquals($urlMapReferenceResource, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setUrlMapExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setUrlMapExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $targetHttpProxy = 'targetHttpProxy206872421'; - $urlMapReferenceResource = new UrlMapReference(); - $response = $gapicClient->setUrlMap($project, $targetHttpProxy, $urlMapReferenceResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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/Compute/tests/Unit/V1/TargetHttpsProxiesClientTest.php b/Compute/tests/Unit/V1/TargetHttpsProxiesClientTest.php deleted file mode 100644 index b4116ebb74f4..000000000000 --- a/Compute/tests/Unit/V1/TargetHttpsProxiesClientTest.php +++ /dev/null @@ -1,1254 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return TargetHttpsProxiesClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new TargetHttpsProxiesClient($options); - } - - /** @test */ - public function aggregatedListTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $items = [ - 'itemsKey' => new TargetHttpsProxiesScopedList(), - ]; - $expectedResponse = new TargetHttpsProxyAggregatedList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->aggregatedList($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertArrayHasKey('itemsKey', $expectedResponse->getItems()); - $this->assertArrayHasKey('itemsKey', $resources); - $this->assertEquals($expectedResponse->getItems()['itemsKey'], $resources['itemsKey']); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.TargetHttpsProxies/AggregatedList', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function aggregatedListExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->aggregatedList($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $targetHttpsProxy = 'targetHttpsProxy-2095146900'; - $response = $gapicClient->delete($project, $targetHttpsProxy); - $this->assertFalse($response->isDone()); - $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.compute.v1.TargetHttpsProxies/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getTargetHttpsProxy(); - $this->assertProtobufEquals($targetHttpsProxy, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $targetHttpsProxy = 'targetHttpsProxy-2095146900'; - $response = $gapicClient->delete($project, $targetHttpsProxy); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $authorizationPolicy = 'authorizationPolicy-1576667208'; - $certificateMap = 'certificateMap-917278028'; - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $fingerprint = 'fingerprint-1375934236'; - $httpKeepAliveTimeoutSec = 2057938782; - $id = 3355; - $kind = 'kind3292052'; - $name = 'name3373707'; - $proxyBind = true; - $quicOverride = 'quicOverride2067189933'; - $region = 'region-934795532'; - $selfLink = 'selfLink-1691268851'; - $serverTlsPolicy = 'serverTlsPolicy1906438002'; - $sslPolicy = 'sslPolicy-1852293435'; - $tlsEarlyData = 'tlsEarlyData-1549504310'; - $urlMap = 'urlMap-169850228'; - $expectedResponse = new TargetHttpsProxy(); - $expectedResponse->setAuthorizationPolicy($authorizationPolicy); - $expectedResponse->setCertificateMap($certificateMap); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setFingerprint($fingerprint); - $expectedResponse->setHttpKeepAliveTimeoutSec($httpKeepAliveTimeoutSec); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setName($name); - $expectedResponse->setProxyBind($proxyBind); - $expectedResponse->setQuicOverride($quicOverride); - $expectedResponse->setRegion($region); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setServerTlsPolicy($serverTlsPolicy); - $expectedResponse->setSslPolicy($sslPolicy); - $expectedResponse->setTlsEarlyData($tlsEarlyData); - $expectedResponse->setUrlMap($urlMap); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $targetHttpsProxy = 'targetHttpsProxy-2095146900'; - $response = $gapicClient->get($project, $targetHttpsProxy); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.TargetHttpsProxies/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getTargetHttpsProxy(); - $this->assertProtobufEquals($targetHttpsProxy, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $targetHttpsProxy = 'targetHttpsProxy-2095146900'; - try { - $gapicClient->get($project, $targetHttpsProxy); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $targetHttpsProxyResource = new TargetHttpsProxy(); - $response = $gapicClient->insert($project, $targetHttpsProxyResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.TargetHttpsProxies/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getTargetHttpsProxyResource(); - $this->assertProtobufEquals($targetHttpsProxyResource, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $targetHttpsProxyResource = new TargetHttpsProxy(); - $response = $gapicClient->insert($project, $targetHttpsProxyResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new TargetHttpsProxy(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new TargetHttpsProxyList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->list($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.TargetHttpsProxies/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->list($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function patchTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/patchTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $targetHttpsProxy = 'targetHttpsProxy-2095146900'; - $targetHttpsProxyResource = new TargetHttpsProxy(); - $response = $gapicClient->patch($project, $targetHttpsProxy, $targetHttpsProxyResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.TargetHttpsProxies/Patch', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getTargetHttpsProxy(); - $this->assertProtobufEquals($targetHttpsProxy, $actualValue); - $actualValue = $actualApiRequestObject->getTargetHttpsProxyResource(); - $this->assertProtobufEquals($targetHttpsProxyResource, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function patchExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $targetHttpsProxy = 'targetHttpsProxy-2095146900'; - $targetHttpsProxyResource = new TargetHttpsProxy(); - $response = $gapicClient->patch($project, $targetHttpsProxy, $targetHttpsProxyResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 setCertificateMapTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setCertificateMapTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/setCertificateMapTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $targetHttpsProxiesSetCertificateMapRequestResource = new TargetHttpsProxiesSetCertificateMapRequest(); - $targetHttpsProxy = 'targetHttpsProxy-2095146900'; - $response = $gapicClient->setCertificateMap($project, $targetHttpsProxiesSetCertificateMapRequestResource, $targetHttpsProxy); - $this->assertFalse($response->isDone()); - $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.compute.v1.TargetHttpsProxies/SetCertificateMap', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getTargetHttpsProxiesSetCertificateMapRequestResource(); - $this->assertProtobufEquals($targetHttpsProxiesSetCertificateMapRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getTargetHttpsProxy(); - $this->assertProtobufEquals($targetHttpsProxy, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setCertificateMapExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setCertificateMapExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $targetHttpsProxiesSetCertificateMapRequestResource = new TargetHttpsProxiesSetCertificateMapRequest(); - $targetHttpsProxy = 'targetHttpsProxy-2095146900'; - $response = $gapicClient->setCertificateMap($project, $targetHttpsProxiesSetCertificateMapRequestResource, $targetHttpsProxy); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 setQuicOverrideTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setQuicOverrideTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/setQuicOverrideTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $targetHttpsProxiesSetQuicOverrideRequestResource = new TargetHttpsProxiesSetQuicOverrideRequest(); - $targetHttpsProxy = 'targetHttpsProxy-2095146900'; - $response = $gapicClient->setQuicOverride($project, $targetHttpsProxiesSetQuicOverrideRequestResource, $targetHttpsProxy); - $this->assertFalse($response->isDone()); - $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.compute.v1.TargetHttpsProxies/SetQuicOverride', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getTargetHttpsProxiesSetQuicOverrideRequestResource(); - $this->assertProtobufEquals($targetHttpsProxiesSetQuicOverrideRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getTargetHttpsProxy(); - $this->assertProtobufEquals($targetHttpsProxy, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setQuicOverrideExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setQuicOverrideExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $targetHttpsProxiesSetQuicOverrideRequestResource = new TargetHttpsProxiesSetQuicOverrideRequest(); - $targetHttpsProxy = 'targetHttpsProxy-2095146900'; - $response = $gapicClient->setQuicOverride($project, $targetHttpsProxiesSetQuicOverrideRequestResource, $targetHttpsProxy); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 setSslCertificatesTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setSslCertificatesTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/setSslCertificatesTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $targetHttpsProxiesSetSslCertificatesRequestResource = new TargetHttpsProxiesSetSslCertificatesRequest(); - $targetHttpsProxy = 'targetHttpsProxy-2095146900'; - $response = $gapicClient->setSslCertificates($project, $targetHttpsProxiesSetSslCertificatesRequestResource, $targetHttpsProxy); - $this->assertFalse($response->isDone()); - $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.compute.v1.TargetHttpsProxies/SetSslCertificates', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getTargetHttpsProxiesSetSslCertificatesRequestResource(); - $this->assertProtobufEquals($targetHttpsProxiesSetSslCertificatesRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getTargetHttpsProxy(); - $this->assertProtobufEquals($targetHttpsProxy, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setSslCertificatesExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setSslCertificatesExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $targetHttpsProxiesSetSslCertificatesRequestResource = new TargetHttpsProxiesSetSslCertificatesRequest(); - $targetHttpsProxy = 'targetHttpsProxy-2095146900'; - $response = $gapicClient->setSslCertificates($project, $targetHttpsProxiesSetSslCertificatesRequestResource, $targetHttpsProxy); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 setSslPolicyTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setSslPolicyTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/setSslPolicyTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $sslPolicyReferenceResource = new SslPolicyReference(); - $targetHttpsProxy = 'targetHttpsProxy-2095146900'; - $response = $gapicClient->setSslPolicy($project, $sslPolicyReferenceResource, $targetHttpsProxy); - $this->assertFalse($response->isDone()); - $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.compute.v1.TargetHttpsProxies/SetSslPolicy', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getSslPolicyReferenceResource(); - $this->assertProtobufEquals($sslPolicyReferenceResource, $actualValue); - $actualValue = $actualApiRequestObject->getTargetHttpsProxy(); - $this->assertProtobufEquals($targetHttpsProxy, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setSslPolicyExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setSslPolicyExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $sslPolicyReferenceResource = new SslPolicyReference(); - $targetHttpsProxy = 'targetHttpsProxy-2095146900'; - $response = $gapicClient->setSslPolicy($project, $sslPolicyReferenceResource, $targetHttpsProxy); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 setUrlMapTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setUrlMapTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/setUrlMapTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $targetHttpsProxy = 'targetHttpsProxy-2095146900'; - $urlMapReferenceResource = new UrlMapReference(); - $response = $gapicClient->setUrlMap($project, $targetHttpsProxy, $urlMapReferenceResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.TargetHttpsProxies/SetUrlMap', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getTargetHttpsProxy(); - $this->assertProtobufEquals($targetHttpsProxy, $actualValue); - $actualValue = $actualApiRequestObject->getUrlMapReferenceResource(); - $this->assertProtobufEquals($urlMapReferenceResource, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setUrlMapExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setUrlMapExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $targetHttpsProxy = 'targetHttpsProxy-2095146900'; - $urlMapReferenceResource = new UrlMapReference(); - $response = $gapicClient->setUrlMap($project, $targetHttpsProxy, $urlMapReferenceResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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/Compute/tests/Unit/V1/TargetInstancesClientTest.php b/Compute/tests/Unit/V1/TargetInstancesClientTest.php deleted file mode 100644 index c65428169d9e..000000000000 --- a/Compute/tests/Unit/V1/TargetInstancesClientTest.php +++ /dev/null @@ -1,671 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return TargetInstancesClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new TargetInstancesClient($options); - } - - /** @test */ - public function aggregatedListTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $items = [ - 'itemsKey' => new TargetInstancesScopedList(), - ]; - $expectedResponse = new TargetInstanceAggregatedList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->aggregatedList($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertArrayHasKey('itemsKey', $expectedResponse->getItems()); - $this->assertArrayHasKey('itemsKey', $resources); - $this->assertEquals($expectedResponse->getItems()['itemsKey'], $resources['itemsKey']); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.TargetInstances/AggregatedList', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function aggregatedListExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->aggregatedList($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $targetInstance = 'targetInstance826640259'; - $zone = 'zone3744684'; - $response = $gapicClient->delete($project, $targetInstance, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.TargetInstances/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getTargetInstance(); - $this->assertProtobufEquals($targetInstance, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $targetInstance = 'targetInstance826640259'; - $zone = 'zone3744684'; - $response = $gapicClient->delete($project, $targetInstance, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $id = 3355; - $instance = 'instance555127957'; - $kind = 'kind3292052'; - $name = 'name3373707'; - $natPolicy = 'natPolicy-1637703152'; - $network = 'network1843485230'; - $securityPolicy = 'securityPolicy1781695249'; - $selfLink = 'selfLink-1691268851'; - $zone2 = 'zone2-696322977'; - $expectedResponse = new TargetInstance(); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setId($id); - $expectedResponse->setInstance($instance); - $expectedResponse->setKind($kind); - $expectedResponse->setName($name); - $expectedResponse->setNatPolicy($natPolicy); - $expectedResponse->setNetwork($network); - $expectedResponse->setSecurityPolicy($securityPolicy); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setZone($zone2); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $targetInstance = 'targetInstance826640259'; - $zone = 'zone3744684'; - $response = $gapicClient->get($project, $targetInstance, $zone); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.TargetInstances/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getTargetInstance(); - $this->assertProtobufEquals($targetInstance, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $targetInstance = 'targetInstance826640259'; - $zone = 'zone3744684'; - try { - $gapicClient->get($project, $targetInstance, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $targetInstanceResource = new TargetInstance(); - $zone = 'zone3744684'; - $response = $gapicClient->insert($project, $targetInstanceResource, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.TargetInstances/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getTargetInstanceResource(); - $this->assertProtobufEquals($targetInstanceResource, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $targetInstanceResource = new TargetInstance(); - $zone = 'zone3744684'; - $response = $gapicClient->insert($project, $targetInstanceResource, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new TargetInstance(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new TargetInstanceList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->list($project, $zone); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.TargetInstances/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $zone = 'zone3744684'; - try { - $gapicClient->list($project, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setSecurityPolicyTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setSecurityPolicyTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/setSecurityPolicyTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $securityPolicyReferenceResource = new SecurityPolicyReference(); - $targetInstance = 'targetInstance826640259'; - $zone = 'zone3744684'; - $response = $gapicClient->setSecurityPolicy($project, $securityPolicyReferenceResource, $targetInstance, $zone); - $this->assertFalse($response->isDone()); - $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.compute.v1.TargetInstances/SetSecurityPolicy', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getSecurityPolicyReferenceResource(); - $this->assertProtobufEquals($securityPolicyReferenceResource, $actualValue); - $actualValue = $actualApiRequestObject->getTargetInstance(); - $this->assertProtobufEquals($targetInstance, $actualValue); - $actualValue = $actualApiRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $expectedOperationsRequestObject = new GetZoneOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setZone($zone); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.ZoneOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setSecurityPolicyExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new ZoneOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setSecurityPolicyExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $securityPolicyReferenceResource = new SecurityPolicyReference(); - $targetInstance = 'targetInstance826640259'; - $zone = 'zone3744684'; - $response = $gapicClient->setSecurityPolicy($project, $securityPolicyReferenceResource, $targetInstance, $zone); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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/Compute/tests/Unit/V1/TargetPoolsClientTest.php b/Compute/tests/Unit/V1/TargetPoolsClientTest.php deleted file mode 100644 index 4b256730dc33..000000000000 --- a/Compute/tests/Unit/V1/TargetPoolsClientTest.php +++ /dev/null @@ -1,1365 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return TargetPoolsClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new TargetPoolsClient($options); - } - - /** @test */ - public function addHealthCheckTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/addHealthCheckTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/addHealthCheckTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $targetPool = 'targetPool-2084687350'; - $targetPoolsAddHealthCheckRequestResource = new TargetPoolsAddHealthCheckRequest(); - $response = $gapicClient->addHealthCheck($project, $region, $targetPool, $targetPoolsAddHealthCheckRequestResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.TargetPools/AddHealthCheck', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getTargetPool(); - $this->assertProtobufEquals($targetPool, $actualValue); - $actualValue = $actualApiRequestObject->getTargetPoolsAddHealthCheckRequestResource(); - $this->assertProtobufEquals($targetPoolsAddHealthCheckRequestResource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function addHealthCheckExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/addHealthCheckExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $targetPool = 'targetPool-2084687350'; - $targetPoolsAddHealthCheckRequestResource = new TargetPoolsAddHealthCheckRequest(); - $response = $gapicClient->addHealthCheck($project, $region, $targetPool, $targetPoolsAddHealthCheckRequestResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 addInstanceTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/addInstanceTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/addInstanceTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $targetPool = 'targetPool-2084687350'; - $targetPoolsAddInstanceRequestResource = new TargetPoolsAddInstanceRequest(); - $response = $gapicClient->addInstance($project, $region, $targetPool, $targetPoolsAddInstanceRequestResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.TargetPools/AddInstance', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getTargetPool(); - $this->assertProtobufEquals($targetPool, $actualValue); - $actualValue = $actualApiRequestObject->getTargetPoolsAddInstanceRequestResource(); - $this->assertProtobufEquals($targetPoolsAddInstanceRequestResource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function addInstanceExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/addInstanceExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $targetPool = 'targetPool-2084687350'; - $targetPoolsAddInstanceRequestResource = new TargetPoolsAddInstanceRequest(); - $response = $gapicClient->addInstance($project, $region, $targetPool, $targetPoolsAddInstanceRequestResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 aggregatedListTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $items = [ - 'itemsKey' => new TargetPoolsScopedList(), - ]; - $expectedResponse = new TargetPoolAggregatedList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->aggregatedList($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertArrayHasKey('itemsKey', $expectedResponse->getItems()); - $this->assertArrayHasKey('itemsKey', $resources); - $this->assertEquals($expectedResponse->getItems()['itemsKey'], $resources['itemsKey']); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.TargetPools/AggregatedList', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function aggregatedListExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->aggregatedList($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $targetPool = 'targetPool-2084687350'; - $response = $gapicClient->delete($project, $region, $targetPool); - $this->assertFalse($response->isDone()); - $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.compute.v1.TargetPools/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getTargetPool(); - $this->assertProtobufEquals($targetPool, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $targetPool = 'targetPool-2084687350'; - $response = $gapicClient->delete($project, $region, $targetPool); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $backupPool = 'backupPool1119626361'; - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $failoverRatio = -2221401; - $id = 3355; - $kind = 'kind3292052'; - $name = 'name3373707'; - $region2 = 'region2-690338393'; - $securityPolicy = 'securityPolicy1781695249'; - $selfLink = 'selfLink-1691268851'; - $sessionAffinity = 'sessionAffinity1000759473'; - $expectedResponse = new TargetPool(); - $expectedResponse->setBackupPool($backupPool); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setFailoverRatio($failoverRatio); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setName($name); - $expectedResponse->setRegion($region2); - $expectedResponse->setSecurityPolicy($securityPolicy); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setSessionAffinity($sessionAffinity); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $targetPool = 'targetPool-2084687350'; - $response = $gapicClient->get($project, $region, $targetPool); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.TargetPools/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualRequestObject->getTargetPool(); - $this->assertProtobufEquals($targetPool, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $targetPool = 'targetPool-2084687350'; - try { - $gapicClient->get($project, $region, $targetPool); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getHealthTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $kind = 'kind3292052'; - $expectedResponse = new TargetPoolInstanceHealth(); - $expectedResponse->setKind($kind); - $transport->addResponse($expectedResponse); - // Mock request - $instanceReferenceResource = new InstanceReference(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $targetPool = 'targetPool-2084687350'; - $response = $gapicClient->getHealth($instanceReferenceResource, $project, $region, $targetPool); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.TargetPools/GetHealth', $actualFuncCall); - $actualValue = $actualRequestObject->getInstanceReferenceResource(); - $this->assertProtobufEquals($instanceReferenceResource, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualRequestObject->getTargetPool(); - $this->assertProtobufEquals($targetPool, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getHealthExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $instanceReferenceResource = new InstanceReference(); - $project = 'project-309310695'; - $region = 'region-934795532'; - $targetPool = 'targetPool-2084687350'; - try { - $gapicClient->getHealth($instanceReferenceResource, $project, $region, $targetPool); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $targetPoolResource = new TargetPool(); - $response = $gapicClient->insert($project, $region, $targetPoolResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.TargetPools/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getTargetPoolResource(); - $this->assertProtobufEquals($targetPoolResource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $targetPoolResource = new TargetPool(); - $response = $gapicClient->insert($project, $region, $targetPoolResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new TargetPool(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new TargetPoolList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->list($project, $region); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.TargetPools/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->list($project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function removeHealthCheckTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/removeHealthCheckTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/removeHealthCheckTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $targetPool = 'targetPool-2084687350'; - $targetPoolsRemoveHealthCheckRequestResource = new TargetPoolsRemoveHealthCheckRequest(); - $response = $gapicClient->removeHealthCheck($project, $region, $targetPool, $targetPoolsRemoveHealthCheckRequestResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.TargetPools/RemoveHealthCheck', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getTargetPool(); - $this->assertProtobufEquals($targetPool, $actualValue); - $actualValue = $actualApiRequestObject->getTargetPoolsRemoveHealthCheckRequestResource(); - $this->assertProtobufEquals($targetPoolsRemoveHealthCheckRequestResource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function removeHealthCheckExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/removeHealthCheckExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $targetPool = 'targetPool-2084687350'; - $targetPoolsRemoveHealthCheckRequestResource = new TargetPoolsRemoveHealthCheckRequest(); - $response = $gapicClient->removeHealthCheck($project, $region, $targetPool, $targetPoolsRemoveHealthCheckRequestResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 removeInstanceTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/removeInstanceTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/removeInstanceTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $targetPool = 'targetPool-2084687350'; - $targetPoolsRemoveInstanceRequestResource = new TargetPoolsRemoveInstanceRequest(); - $response = $gapicClient->removeInstance($project, $region, $targetPool, $targetPoolsRemoveInstanceRequestResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.TargetPools/RemoveInstance', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getTargetPool(); - $this->assertProtobufEquals($targetPool, $actualValue); - $actualValue = $actualApiRequestObject->getTargetPoolsRemoveInstanceRequestResource(); - $this->assertProtobufEquals($targetPoolsRemoveInstanceRequestResource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function removeInstanceExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/removeInstanceExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $targetPool = 'targetPool-2084687350'; - $targetPoolsRemoveInstanceRequestResource = new TargetPoolsRemoveInstanceRequest(); - $response = $gapicClient->removeInstance($project, $region, $targetPool, $targetPoolsRemoveInstanceRequestResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 setBackupTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setBackupTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/setBackupTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $targetPool = 'targetPool-2084687350'; - $targetReferenceResource = new TargetReference(); - $response = $gapicClient->setBackup($project, $region, $targetPool, $targetReferenceResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.TargetPools/SetBackup', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getTargetPool(); - $this->assertProtobufEquals($targetPool, $actualValue); - $actualValue = $actualApiRequestObject->getTargetReferenceResource(); - $this->assertProtobufEquals($targetReferenceResource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setBackupExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setBackupExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $targetPool = 'targetPool-2084687350'; - $targetReferenceResource = new TargetReference(); - $response = $gapicClient->setBackup($project, $region, $targetPool, $targetReferenceResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 setSecurityPolicyTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setSecurityPolicyTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/setSecurityPolicyTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $securityPolicyReferenceResource = new SecurityPolicyReference(); - $targetPool = 'targetPool-2084687350'; - $response = $gapicClient->setSecurityPolicy($project, $region, $securityPolicyReferenceResource, $targetPool); - $this->assertFalse($response->isDone()); - $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.compute.v1.TargetPools/SetSecurityPolicy', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getSecurityPolicyReferenceResource(); - $this->assertProtobufEquals($securityPolicyReferenceResource, $actualValue); - $actualValue = $actualApiRequestObject->getTargetPool(); - $this->assertProtobufEquals($targetPool, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setSecurityPolicyExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setSecurityPolicyExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $securityPolicyReferenceResource = new SecurityPolicyReference(); - $targetPool = 'targetPool-2084687350'; - $response = $gapicClient->setSecurityPolicy($project, $region, $securityPolicyReferenceResource, $targetPool); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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/Compute/tests/Unit/V1/TargetSslProxiesClientTest.php b/Compute/tests/Unit/V1/TargetSslProxiesClientTest.php deleted file mode 100644 index 5e6169683de7..000000000000 --- a/Compute/tests/Unit/V1/TargetSslProxiesClientTest.php +++ /dev/null @@ -1,1045 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return TargetSslProxiesClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new TargetSslProxiesClient($options); - } - - /** @test */ - public function deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $targetSslProxy = 'targetSslProxy875666765'; - $response = $gapicClient->delete($project, $targetSslProxy); - $this->assertFalse($response->isDone()); - $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.compute.v1.TargetSslProxies/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getTargetSslProxy(); - $this->assertProtobufEquals($targetSslProxy, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $targetSslProxy = 'targetSslProxy875666765'; - $response = $gapicClient->delete($project, $targetSslProxy); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $certificateMap = 'certificateMap-917278028'; - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $id = 3355; - $kind = 'kind3292052'; - $name = 'name3373707'; - $proxyHeader = 'proxyHeader-1987109506'; - $selfLink = 'selfLink-1691268851'; - $service = 'service1984153269'; - $sslPolicy = 'sslPolicy-1852293435'; - $expectedResponse = new TargetSslProxy(); - $expectedResponse->setCertificateMap($certificateMap); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setName($name); - $expectedResponse->setProxyHeader($proxyHeader); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setService($service); - $expectedResponse->setSslPolicy($sslPolicy); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $targetSslProxy = 'targetSslProxy875666765'; - $response = $gapicClient->get($project, $targetSslProxy); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.TargetSslProxies/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getTargetSslProxy(); - $this->assertProtobufEquals($targetSslProxy, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $targetSslProxy = 'targetSslProxy875666765'; - try { - $gapicClient->get($project, $targetSslProxy); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $targetSslProxyResource = new TargetSslProxy(); - $response = $gapicClient->insert($project, $targetSslProxyResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.TargetSslProxies/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getTargetSslProxyResource(); - $this->assertProtobufEquals($targetSslProxyResource, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $targetSslProxyResource = new TargetSslProxy(); - $response = $gapicClient->insert($project, $targetSslProxyResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new TargetSslProxy(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new TargetSslProxyList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->list($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.TargetSslProxies/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->list($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setBackendServiceTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setBackendServiceTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/setBackendServiceTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $targetSslProxiesSetBackendServiceRequestResource = new TargetSslProxiesSetBackendServiceRequest(); - $targetSslProxy = 'targetSslProxy875666765'; - $response = $gapicClient->setBackendService($project, $targetSslProxiesSetBackendServiceRequestResource, $targetSslProxy); - $this->assertFalse($response->isDone()); - $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.compute.v1.TargetSslProxies/SetBackendService', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getTargetSslProxiesSetBackendServiceRequestResource(); - $this->assertProtobufEquals($targetSslProxiesSetBackendServiceRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getTargetSslProxy(); - $this->assertProtobufEquals($targetSslProxy, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setBackendServiceExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setBackendServiceExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $targetSslProxiesSetBackendServiceRequestResource = new TargetSslProxiesSetBackendServiceRequest(); - $targetSslProxy = 'targetSslProxy875666765'; - $response = $gapicClient->setBackendService($project, $targetSslProxiesSetBackendServiceRequestResource, $targetSslProxy); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 setCertificateMapTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setCertificateMapTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/setCertificateMapTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $targetSslProxiesSetCertificateMapRequestResource = new TargetSslProxiesSetCertificateMapRequest(); - $targetSslProxy = 'targetSslProxy875666765'; - $response = $gapicClient->setCertificateMap($project, $targetSslProxiesSetCertificateMapRequestResource, $targetSslProxy); - $this->assertFalse($response->isDone()); - $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.compute.v1.TargetSslProxies/SetCertificateMap', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getTargetSslProxiesSetCertificateMapRequestResource(); - $this->assertProtobufEquals($targetSslProxiesSetCertificateMapRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getTargetSslProxy(); - $this->assertProtobufEquals($targetSslProxy, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setCertificateMapExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setCertificateMapExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $targetSslProxiesSetCertificateMapRequestResource = new TargetSslProxiesSetCertificateMapRequest(); - $targetSslProxy = 'targetSslProxy875666765'; - $response = $gapicClient->setCertificateMap($project, $targetSslProxiesSetCertificateMapRequestResource, $targetSslProxy); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 setProxyHeaderTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setProxyHeaderTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/setProxyHeaderTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $targetSslProxiesSetProxyHeaderRequestResource = new TargetSslProxiesSetProxyHeaderRequest(); - $targetSslProxy = 'targetSslProxy875666765'; - $response = $gapicClient->setProxyHeader($project, $targetSslProxiesSetProxyHeaderRequestResource, $targetSslProxy); - $this->assertFalse($response->isDone()); - $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.compute.v1.TargetSslProxies/SetProxyHeader', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getTargetSslProxiesSetProxyHeaderRequestResource(); - $this->assertProtobufEquals($targetSslProxiesSetProxyHeaderRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getTargetSslProxy(); - $this->assertProtobufEquals($targetSslProxy, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setProxyHeaderExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setProxyHeaderExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $targetSslProxiesSetProxyHeaderRequestResource = new TargetSslProxiesSetProxyHeaderRequest(); - $targetSslProxy = 'targetSslProxy875666765'; - $response = $gapicClient->setProxyHeader($project, $targetSslProxiesSetProxyHeaderRequestResource, $targetSslProxy); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 setSslCertificatesTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setSslCertificatesTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/setSslCertificatesTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $targetSslProxiesSetSslCertificatesRequestResource = new TargetSslProxiesSetSslCertificatesRequest(); - $targetSslProxy = 'targetSslProxy875666765'; - $response = $gapicClient->setSslCertificates($project, $targetSslProxiesSetSslCertificatesRequestResource, $targetSslProxy); - $this->assertFalse($response->isDone()); - $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.compute.v1.TargetSslProxies/SetSslCertificates', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getTargetSslProxiesSetSslCertificatesRequestResource(); - $this->assertProtobufEquals($targetSslProxiesSetSslCertificatesRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getTargetSslProxy(); - $this->assertProtobufEquals($targetSslProxy, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setSslCertificatesExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setSslCertificatesExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $targetSslProxiesSetSslCertificatesRequestResource = new TargetSslProxiesSetSslCertificatesRequest(); - $targetSslProxy = 'targetSslProxy875666765'; - $response = $gapicClient->setSslCertificates($project, $targetSslProxiesSetSslCertificatesRequestResource, $targetSslProxy); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 setSslPolicyTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setSslPolicyTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/setSslPolicyTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $sslPolicyReferenceResource = new SslPolicyReference(); - $targetSslProxy = 'targetSslProxy875666765'; - $response = $gapicClient->setSslPolicy($project, $sslPolicyReferenceResource, $targetSslProxy); - $this->assertFalse($response->isDone()); - $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.compute.v1.TargetSslProxies/SetSslPolicy', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getSslPolicyReferenceResource(); - $this->assertProtobufEquals($sslPolicyReferenceResource, $actualValue); - $actualValue = $actualApiRequestObject->getTargetSslProxy(); - $this->assertProtobufEquals($targetSslProxy, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setSslPolicyExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setSslPolicyExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $sslPolicyReferenceResource = new SslPolicyReference(); - $targetSslProxy = 'targetSslProxy875666765'; - $response = $gapicClient->setSslPolicy($project, $sslPolicyReferenceResource, $targetSslProxy); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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/Compute/tests/Unit/V1/TargetTcpProxiesClientTest.php b/Compute/tests/Unit/V1/TargetTcpProxiesClientTest.php deleted file mode 100644 index 5e4daddc9946..000000000000 --- a/Compute/tests/Unit/V1/TargetTcpProxiesClientTest.php +++ /dev/null @@ -1,765 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return TargetTcpProxiesClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new TargetTcpProxiesClient($options); - } - - /** @test */ - public function aggregatedListTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $items = [ - 'itemsKey' => new TargetTcpProxiesScopedList(), - ]; - $expectedResponse = new TargetTcpProxyAggregatedList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->aggregatedList($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertArrayHasKey('itemsKey', $expectedResponse->getItems()); - $this->assertArrayHasKey('itemsKey', $resources); - $this->assertEquals($expectedResponse->getItems()['itemsKey'], $resources['itemsKey']); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.TargetTcpProxies/AggregatedList', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function aggregatedListExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->aggregatedList($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $targetTcpProxy = 'targetTcpProxy503065442'; - $response = $gapicClient->delete($project, $targetTcpProxy); - $this->assertFalse($response->isDone()); - $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.compute.v1.TargetTcpProxies/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getTargetTcpProxy(); - $this->assertProtobufEquals($targetTcpProxy, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $targetTcpProxy = 'targetTcpProxy503065442'; - $response = $gapicClient->delete($project, $targetTcpProxy); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $id = 3355; - $kind = 'kind3292052'; - $name = 'name3373707'; - $proxyBind = true; - $proxyHeader = 'proxyHeader-1987109506'; - $region = 'region-934795532'; - $selfLink = 'selfLink-1691268851'; - $service = 'service1984153269'; - $expectedResponse = new TargetTcpProxy(); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setName($name); - $expectedResponse->setProxyBind($proxyBind); - $expectedResponse->setProxyHeader($proxyHeader); - $expectedResponse->setRegion($region); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setService($service); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $targetTcpProxy = 'targetTcpProxy503065442'; - $response = $gapicClient->get($project, $targetTcpProxy); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.TargetTcpProxies/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getTargetTcpProxy(); - $this->assertProtobufEquals($targetTcpProxy, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $targetTcpProxy = 'targetTcpProxy503065442'; - try { - $gapicClient->get($project, $targetTcpProxy); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $targetTcpProxyResource = new TargetTcpProxy(); - $response = $gapicClient->insert($project, $targetTcpProxyResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.TargetTcpProxies/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getTargetTcpProxyResource(); - $this->assertProtobufEquals($targetTcpProxyResource, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $targetTcpProxyResource = new TargetTcpProxy(); - $response = $gapicClient->insert($project, $targetTcpProxyResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new TargetTcpProxy(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new TargetTcpProxyList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->list($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.TargetTcpProxies/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->list($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setBackendServiceTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setBackendServiceTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/setBackendServiceTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $targetTcpProxiesSetBackendServiceRequestResource = new TargetTcpProxiesSetBackendServiceRequest(); - $targetTcpProxy = 'targetTcpProxy503065442'; - $response = $gapicClient->setBackendService($project, $targetTcpProxiesSetBackendServiceRequestResource, $targetTcpProxy); - $this->assertFalse($response->isDone()); - $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.compute.v1.TargetTcpProxies/SetBackendService', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getTargetTcpProxiesSetBackendServiceRequestResource(); - $this->assertProtobufEquals($targetTcpProxiesSetBackendServiceRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getTargetTcpProxy(); - $this->assertProtobufEquals($targetTcpProxy, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setBackendServiceExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setBackendServiceExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $targetTcpProxiesSetBackendServiceRequestResource = new TargetTcpProxiesSetBackendServiceRequest(); - $targetTcpProxy = 'targetTcpProxy503065442'; - $response = $gapicClient->setBackendService($project, $targetTcpProxiesSetBackendServiceRequestResource, $targetTcpProxy); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 setProxyHeaderTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setProxyHeaderTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/setProxyHeaderTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $targetTcpProxiesSetProxyHeaderRequestResource = new TargetTcpProxiesSetProxyHeaderRequest(); - $targetTcpProxy = 'targetTcpProxy503065442'; - $response = $gapicClient->setProxyHeader($project, $targetTcpProxiesSetProxyHeaderRequestResource, $targetTcpProxy); - $this->assertFalse($response->isDone()); - $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.compute.v1.TargetTcpProxies/SetProxyHeader', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getTargetTcpProxiesSetProxyHeaderRequestResource(); - $this->assertProtobufEquals($targetTcpProxiesSetProxyHeaderRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getTargetTcpProxy(); - $this->assertProtobufEquals($targetTcpProxy, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setProxyHeaderExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setProxyHeaderExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $targetTcpProxiesSetProxyHeaderRequestResource = new TargetTcpProxiesSetProxyHeaderRequest(); - $targetTcpProxy = 'targetTcpProxy503065442'; - $response = $gapicClient->setProxyHeader($project, $targetTcpProxiesSetProxyHeaderRequestResource, $targetTcpProxy); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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/Compute/tests/Unit/V1/TargetVpnGatewaysClientTest.php b/Compute/tests/Unit/V1/TargetVpnGatewaysClientTest.php deleted file mode 100644 index 57e05a54eadb..000000000000 --- a/Compute/tests/Unit/V1/TargetVpnGatewaysClientTest.php +++ /dev/null @@ -1,669 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return TargetVpnGatewaysClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new TargetVpnGatewaysClient($options); - } - - /** @test */ - public function aggregatedListTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $items = [ - 'itemsKey' => new TargetVpnGatewaysScopedList(), - ]; - $expectedResponse = new TargetVpnGatewayAggregatedList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->aggregatedList($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertArrayHasKey('itemsKey', $expectedResponse->getItems()); - $this->assertArrayHasKey('itemsKey', $resources); - $this->assertEquals($expectedResponse->getItems()['itemsKey'], $resources['itemsKey']); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.TargetVpnGateways/AggregatedList', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function aggregatedListExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->aggregatedList($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $targetVpnGateway = 'targetVpnGateway-4358069'; - $response = $gapicClient->delete($project, $region, $targetVpnGateway); - $this->assertFalse($response->isDone()); - $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.compute.v1.TargetVpnGateways/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getTargetVpnGateway(); - $this->assertProtobufEquals($targetVpnGateway, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $targetVpnGateway = 'targetVpnGateway-4358069'; - $response = $gapicClient->delete($project, $region, $targetVpnGateway); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $id = 3355; - $kind = 'kind3292052'; - $labelFingerprint = 'labelFingerprint714995737'; - $name = 'name3373707'; - $network = 'network1843485230'; - $region2 = 'region2-690338393'; - $selfLink = 'selfLink-1691268851'; - $status = 'status-892481550'; - $expectedResponse = new TargetVpnGateway(); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setLabelFingerprint($labelFingerprint); - $expectedResponse->setName($name); - $expectedResponse->setNetwork($network); - $expectedResponse->setRegion($region2); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setStatus($status); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $targetVpnGateway = 'targetVpnGateway-4358069'; - $response = $gapicClient->get($project, $region, $targetVpnGateway); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.TargetVpnGateways/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualRequestObject->getTargetVpnGateway(); - $this->assertProtobufEquals($targetVpnGateway, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $targetVpnGateway = 'targetVpnGateway-4358069'; - try { - $gapicClient->get($project, $region, $targetVpnGateway); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $targetVpnGatewayResource = new TargetVpnGateway(); - $response = $gapicClient->insert($project, $region, $targetVpnGatewayResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.TargetVpnGateways/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getTargetVpnGatewayResource(); - $this->assertProtobufEquals($targetVpnGatewayResource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $targetVpnGatewayResource = new TargetVpnGateway(); - $response = $gapicClient->insert($project, $region, $targetVpnGatewayResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new TargetVpnGateway(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new TargetVpnGatewayList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->list($project, $region); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.TargetVpnGateways/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->list($project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setLabelsTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setLabelsTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/setLabelsTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionSetLabelsRequestResource = new RegionSetLabelsRequest(); - $resource = 'resource-341064690'; - $response = $gapicClient->setLabels($project, $region, $regionSetLabelsRequestResource, $resource); - $this->assertFalse($response->isDone()); - $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.compute.v1.TargetVpnGateways/SetLabels', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getRegionSetLabelsRequestResource(); - $this->assertProtobufEquals($regionSetLabelsRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setLabelsExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setLabelsExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionSetLabelsRequestResource = new RegionSetLabelsRequest(); - $resource = 'resource-341064690'; - $response = $gapicClient->setLabels($project, $region, $regionSetLabelsRequestResource, $resource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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/Compute/tests/Unit/V1/UrlMapsClientTest.php b/Compute/tests/Unit/V1/UrlMapsClientTest.php deleted file mode 100644 index be133de6f5f9..000000000000 --- a/Compute/tests/Unit/V1/UrlMapsClientTest.php +++ /dev/null @@ -1,948 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return UrlMapsClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new UrlMapsClient($options); - } - - /** @test */ - public function aggregatedListTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $items = [ - 'itemsKey' => new UrlMapsScopedList(), - ]; - $expectedResponse = new UrlMapsAggregatedList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->aggregatedList($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertArrayHasKey('itemsKey', $expectedResponse->getItems()); - $this->assertArrayHasKey('itemsKey', $resources); - $this->assertEquals($expectedResponse->getItems()['itemsKey'], $resources['itemsKey']); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.UrlMaps/AggregatedList', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function aggregatedListExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->aggregatedList($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $urlMap = 'urlMap-169850228'; - $response = $gapicClient->delete($project, $urlMap); - $this->assertFalse($response->isDone()); - $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.compute.v1.UrlMaps/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getUrlMap(); - $this->assertProtobufEquals($urlMap, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $urlMap = 'urlMap-169850228'; - $response = $gapicClient->delete($project, $urlMap); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $creationTimestamp = 'creationTimestamp567396278'; - $defaultService = 'defaultService1980854967'; - $description = 'description-1724546052'; - $fingerprint = 'fingerprint-1375934236'; - $id = 3355; - $kind = 'kind3292052'; - $name = 'name3373707'; - $region = 'region-934795532'; - $selfLink = 'selfLink-1691268851'; - $expectedResponse = new UrlMap(); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDefaultService($defaultService); - $expectedResponse->setDescription($description); - $expectedResponse->setFingerprint($fingerprint); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setName($name); - $expectedResponse->setRegion($region); - $expectedResponse->setSelfLink($selfLink); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $urlMap = 'urlMap-169850228'; - $response = $gapicClient->get($project, $urlMap); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.UrlMaps/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getUrlMap(); - $this->assertProtobufEquals($urlMap, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $urlMap = 'urlMap-169850228'; - try { - $gapicClient->get($project, $urlMap); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $urlMapResource = new UrlMap(); - $response = $gapicClient->insert($project, $urlMapResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.UrlMaps/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getUrlMapResource(); - $this->assertProtobufEquals($urlMapResource, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $urlMapResource = new UrlMap(); - $response = $gapicClient->insert($project, $urlMapResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 invalidateCacheTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/invalidateCacheTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/invalidateCacheTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $cacheInvalidationRuleResource = new CacheInvalidationRule(); - $project = 'project-309310695'; - $urlMap = 'urlMap-169850228'; - $response = $gapicClient->invalidateCache($cacheInvalidationRuleResource, $project, $urlMap); - $this->assertFalse($response->isDone()); - $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.compute.v1.UrlMaps/InvalidateCache', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getCacheInvalidationRuleResource(); - $this->assertProtobufEquals($cacheInvalidationRuleResource, $actualValue); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getUrlMap(); - $this->assertProtobufEquals($urlMap, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function invalidateCacheExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/invalidateCacheExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $cacheInvalidationRuleResource = new CacheInvalidationRule(); - $project = 'project-309310695'; - $urlMap = 'urlMap-169850228'; - $response = $gapicClient->invalidateCache($cacheInvalidationRuleResource, $project, $urlMap); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new UrlMap(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new UrlMapList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->list($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.UrlMaps/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->list($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function patchTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/patchTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $urlMap = 'urlMap-169850228'; - $urlMapResource = new UrlMap(); - $response = $gapicClient->patch($project, $urlMap, $urlMapResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.UrlMaps/Patch', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getUrlMap(); - $this->assertProtobufEquals($urlMap, $actualValue); - $actualValue = $actualApiRequestObject->getUrlMapResource(); - $this->assertProtobufEquals($urlMapResource, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function patchExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/patchExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $urlMap = 'urlMap-169850228'; - $urlMapResource = new UrlMap(); - $response = $gapicClient->patch($project, $urlMap, $urlMapResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 updateTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/updateTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/updateTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $urlMap = 'urlMap-169850228'; - $urlMapResource = new UrlMap(); - $response = $gapicClient->update($project, $urlMap, $urlMapResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.UrlMaps/Update', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getUrlMap(); - $this->assertProtobufEquals($urlMap, $actualValue); - $actualValue = $actualApiRequestObject->getUrlMapResource(); - $this->assertProtobufEquals($urlMapResource, $actualValue); - $expectedOperationsRequestObject = new GetGlobalOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.GlobalOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function updateExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new GlobalOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/updateExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $urlMap = 'urlMap-169850228'; - $urlMapResource = new UrlMap(); - $response = $gapicClient->update($project, $urlMap, $urlMapResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 validateTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new UrlMapsValidateResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $urlMap = 'urlMap-169850228'; - $urlMapsValidateRequestResource = new UrlMapsValidateRequest(); - $response = $gapicClient->validate($project, $urlMap, $urlMapsValidateRequestResource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.UrlMaps/Validate', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getUrlMap(); - $this->assertProtobufEquals($urlMap, $actualValue); - $actualValue = $actualRequestObject->getUrlMapsValidateRequestResource(); - $this->assertProtobufEquals($urlMapsValidateRequestResource, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function validateExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $urlMap = 'urlMap-169850228'; - $urlMapsValidateRequestResource = new UrlMapsValidateRequest(); - try { - $gapicClient->validate($project, $urlMap, $urlMapsValidateRequestResource); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->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/Compute/tests/Unit/V1/VpnGatewaysClientTest.php b/Compute/tests/Unit/V1/VpnGatewaysClientTest.php deleted file mode 100644 index 59f0bbf77ca8..000000000000 --- a/Compute/tests/Unit/V1/VpnGatewaysClientTest.php +++ /dev/null @@ -1,810 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return VpnGatewaysClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new VpnGatewaysClient($options); - } - - /** @test */ - public function aggregatedListTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $items = [ - 'itemsKey' => new VpnGatewaysScopedList(), - ]; - $expectedResponse = new VpnGatewayAggregatedList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->aggregatedList($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertArrayHasKey('itemsKey', $expectedResponse->getItems()); - $this->assertArrayHasKey('itemsKey', $resources); - $this->assertEquals($expectedResponse->getItems()['itemsKey'], $resources['itemsKey']); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.VpnGateways/AggregatedList', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function aggregatedListExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->aggregatedList($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $vpnGateway = 'vpnGateway-1203928583'; - $response = $gapicClient->delete($project, $region, $vpnGateway); - $this->assertFalse($response->isDone()); - $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.compute.v1.VpnGateways/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getVpnGateway(); - $this->assertProtobufEquals($vpnGateway, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $vpnGateway = 'vpnGateway-1203928583'; - $response = $gapicClient->delete($project, $region, $vpnGateway); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $gatewayIpVersion = 'gatewayIpVersion1138816667'; - $id = 3355; - $kind = 'kind3292052'; - $labelFingerprint = 'labelFingerprint714995737'; - $name = 'name3373707'; - $network = 'network1843485230'; - $region2 = 'region2-690338393'; - $selfLink = 'selfLink-1691268851'; - $stackType = 'stackType2036521617'; - $expectedResponse = new VpnGateway(); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setGatewayIpVersion($gatewayIpVersion); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setLabelFingerprint($labelFingerprint); - $expectedResponse->setName($name); - $expectedResponse->setNetwork($network); - $expectedResponse->setRegion($region2); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setStackType($stackType); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $vpnGateway = 'vpnGateway-1203928583'; - $response = $gapicClient->get($project, $region, $vpnGateway); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.VpnGateways/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualRequestObject->getVpnGateway(); - $this->assertProtobufEquals($vpnGateway, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $vpnGateway = 'vpnGateway-1203928583'; - try { - $gapicClient->get($project, $region, $vpnGateway); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getStatusTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new VpnGatewaysGetStatusResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $vpnGateway = 'vpnGateway-1203928583'; - $response = $gapicClient->getStatus($project, $region, $vpnGateway); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.VpnGateways/GetStatus', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualRequestObject->getVpnGateway(); - $this->assertProtobufEquals($vpnGateway, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getStatusExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $vpnGateway = 'vpnGateway-1203928583'; - try { - $gapicClient->getStatus($project, $region, $vpnGateway); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $vpnGatewayResource = new VpnGateway(); - $response = $gapicClient->insert($project, $region, $vpnGatewayResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.VpnGateways/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getVpnGatewayResource(); - $this->assertProtobufEquals($vpnGatewayResource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $vpnGatewayResource = new VpnGateway(); - $response = $gapicClient->insert($project, $region, $vpnGatewayResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new VpnGateway(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new VpnGatewayList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->list($project, $region); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.VpnGateways/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->list($project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setLabelsTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setLabelsTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/setLabelsTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionSetLabelsRequestResource = new RegionSetLabelsRequest(); - $resource = 'resource-341064690'; - $response = $gapicClient->setLabels($project, $region, $regionSetLabelsRequestResource, $resource); - $this->assertFalse($response->isDone()); - $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.compute.v1.VpnGateways/SetLabels', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getRegionSetLabelsRequestResource(); - $this->assertProtobufEquals($regionSetLabelsRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setLabelsExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setLabelsExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionSetLabelsRequestResource = new RegionSetLabelsRequest(); - $resource = 'resource-341064690'; - $response = $gapicClient->setLabels($project, $region, $regionSetLabelsRequestResource, $resource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 testIamPermissionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new TestPermissionsResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $resource = 'resource-341064690'; - $testPermissionsRequestResource = new TestPermissionsRequest(); - $response = $gapicClient->testIamPermissions($project, $region, $resource, $testPermissionsRequestResource); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.VpnGateways/TestIamPermissions', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $actualValue = $actualRequestObject->getTestPermissionsRequestResource(); - $this->assertProtobufEquals($testPermissionsRequestResource, $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $resource = 'resource-341064690'; - $testPermissionsRequestResource = new TestPermissionsRequest(); - try { - $gapicClient->testIamPermissions($project, $region, $resource, $testPermissionsRequestResource); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->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/Compute/tests/Unit/V1/VpnTunnelsClientTest.php b/Compute/tests/Unit/V1/VpnTunnelsClientTest.php deleted file mode 100644 index 1c5ac7bffd25..000000000000 --- a/Compute/tests/Unit/V1/VpnTunnelsClientTest.php +++ /dev/null @@ -1,691 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return VpnTunnelsClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new VpnTunnelsClient($options); - } - - /** @test */ - public function aggregatedListTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $items = [ - 'itemsKey' => new VpnTunnelsScopedList(), - ]; - $expectedResponse = new VpnTunnelAggregatedList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->aggregatedList($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertArrayHasKey('itemsKey', $expectedResponse->getItems()); - $this->assertArrayHasKey('itemsKey', $resources); - $this->assertEquals($expectedResponse->getItems()['itemsKey'], $resources['itemsKey']); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.VpnTunnels/AggregatedList', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function aggregatedListExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->aggregatedList($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/deleteTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $vpnTunnel = 'vpnTunnel-2003662317'; - $response = $gapicClient->delete($project, $region, $vpnTunnel); - $this->assertFalse($response->isDone()); - $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.compute.v1.VpnTunnels/Delete', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getVpnTunnel(); - $this->assertProtobufEquals($vpnTunnel, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/deleteExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $vpnTunnel = 'vpnTunnel-2003662317'; - $response = $gapicClient->delete($project, $region, $vpnTunnel); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $detailedStatus = 'detailedStatus-740240799'; - $id = 3355; - $ikeVersion = 1292118044; - $kind = 'kind3292052'; - $labelFingerprint = 'labelFingerprint714995737'; - $name = 'name3373707'; - $peerExternalGateway = 'peerExternalGateway384956173'; - $peerExternalGatewayInterface = 620973433; - $peerGcpGateway = 'peerGcpGateway281867452'; - $peerIp = 'peerIp-690492124'; - $region2 = 'region2-690338393'; - $router = 'router-925132983'; - $selfLink = 'selfLink-1691268851'; - $sharedSecret = 'sharedSecret-154938422'; - $sharedSecretHash = 'sharedSecretHash935752803'; - $status = 'status-892481550'; - $targetVpnGateway = 'targetVpnGateway-4358069'; - $vpnGateway = 'vpnGateway-1203928583'; - $vpnGatewayInterface = 632850035; - $expectedResponse = new VpnTunnel(); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setDetailedStatus($detailedStatus); - $expectedResponse->setId($id); - $expectedResponse->setIkeVersion($ikeVersion); - $expectedResponse->setKind($kind); - $expectedResponse->setLabelFingerprint($labelFingerprint); - $expectedResponse->setName($name); - $expectedResponse->setPeerExternalGateway($peerExternalGateway); - $expectedResponse->setPeerExternalGatewayInterface($peerExternalGatewayInterface); - $expectedResponse->setPeerGcpGateway($peerGcpGateway); - $expectedResponse->setPeerIp($peerIp); - $expectedResponse->setRegion($region2); - $expectedResponse->setRouter($router); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setSharedSecret($sharedSecret); - $expectedResponse->setSharedSecretHash($sharedSecretHash); - $expectedResponse->setStatus($status); - $expectedResponse->setTargetVpnGateway($targetVpnGateway); - $expectedResponse->setVpnGateway($vpnGateway); - $expectedResponse->setVpnGatewayInterface($vpnGatewayInterface); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $vpnTunnel = 'vpnTunnel-2003662317'; - $response = $gapicClient->get($project, $region, $vpnTunnel); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.VpnTunnels/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualRequestObject->getVpnTunnel(); - $this->assertProtobufEquals($vpnTunnel, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $vpnTunnel = 'vpnTunnel-2003662317'; - try { - $gapicClient->get($project, $region, $vpnTunnel); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function insertTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/insertTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $vpnTunnelResource = new VpnTunnel(); - $response = $gapicClient->insert($project, $region, $vpnTunnelResource); - $this->assertFalse($response->isDone()); - $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.compute.v1.VpnTunnels/Insert', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getVpnTunnelResource(); - $this->assertProtobufEquals($vpnTunnelResource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function insertExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/insertExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $vpnTunnelResource = new VpnTunnel(); - $response = $gapicClient->insert($project, $region, $vpnTunnelResource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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 listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new VpnTunnel(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new VpnTunnelList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $response = $gapicClient->list($project, $region); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.VpnTunnels/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - try { - $gapicClient->list($project, $region); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function setLabelsTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setLabelsTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $transport->addResponse($incompleteOperation); - $completeOperation = new Operation(); - $completeOperation->setName('customOperations/setLabelsTest'); - $completeOperation->setStatus(Status::DONE); - $operationsTransport->addResponse($completeOperation); - // Mock request - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionSetLabelsRequestResource = new RegionSetLabelsRequest(); - $resource = 'resource-341064690'; - $response = $gapicClient->setLabels($project, $region, $regionSetLabelsRequestResource, $resource); - $this->assertFalse($response->isDone()); - $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.compute.v1.VpnTunnels/SetLabels', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualApiRequestObject->getRegion(); - $this->assertProtobufEquals($region, $actualValue); - $actualValue = $actualApiRequestObject->getRegionSetLabelsRequestResource(); - $this->assertProtobufEquals($regionSetLabelsRequestResource, $actualValue); - $actualValue = $actualApiRequestObject->getResource(); - $this->assertProtobufEquals($resource, $actualValue); - $expectedOperationsRequestObject = new GetRegionOperationRequest(); - $expectedOperationsRequestObject->setOperation($completeOperation->getName()); - $expectedOperationsRequestObject->setProject($project); - $expectedOperationsRequestObject->setRegion($region); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $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.cloud.compute.v1.RegionOperations/Get', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - } - - /** @test */ - public function setLabelsExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new RegionOperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('customOperations/setLabelsExceptionTest'); - $incompleteOperation->setStatus(Status::RUNNING); - $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 - $project = 'project-309310695'; - $region = 'region-934795532'; - $regionSetLabelsRequestResource = new RegionSetLabelsRequest(); - $resource = 'resource-341064690'; - $response = $gapicClient->setLabels($project, $region, $regionSetLabelsRequestResource, $resource); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - 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/Compute/tests/Unit/V1/ZoneOperationsClientTest.php b/Compute/tests/Unit/V1/ZoneOperationsClientTest.php deleted file mode 100644 index e7e84bb318a4..000000000000 --- a/Compute/tests/Unit/V1/ZoneOperationsClientTest.php +++ /dev/null @@ -1,423 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return ZoneOperationsClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new ZoneOperationsClient($options); - } - - /** @test */ - public function deleteTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $expectedResponse = new DeleteZoneOperationResponse(); - $transport->addResponse($expectedResponse); - // Mock request - $operation = 'operation1662702951'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->delete($operation, $project, $zone); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.ZoneOperations/Delete', $actualFuncCall); - $actualValue = $actualRequestObject->getOperation(); - $this->assertProtobufEquals($operation, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function deleteExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $operation = 'operation1662702951'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - try { - $gapicClient->delete($operation, $project, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $clientOperationId = 'clientOperationId-239630617'; - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $endTime = 'endTime1725551537'; - $httpErrorMessage = 'httpErrorMessage1276263769'; - $httpErrorStatusCode = 1386087020; - $id = 3355; - $insertTime = 'insertTime-103148397'; - $kind = 'kind3292052'; - $name = 'name3373707'; - $operationGroupId = 'operationGroupId40171187'; - $operationType = 'operationType-1432962286'; - $progress = 1001078227; - $region = 'region-934795532'; - $selfLink = 'selfLink-1691268851'; - $startTime = 'startTime-1573145462'; - $statusMessage = 'statusMessage-239442758'; - $targetId = 815576439; - $targetLink = 'targetLink-2084812312'; - $user = 'user3599307'; - $zone2 = 'zone2-696322977'; - $expectedResponse = new Operation(); - $expectedResponse->setClientOperationId($clientOperationId); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setEndTime($endTime); - $expectedResponse->setHttpErrorMessage($httpErrorMessage); - $expectedResponse->setHttpErrorStatusCode($httpErrorStatusCode); - $expectedResponse->setId($id); - $expectedResponse->setInsertTime($insertTime); - $expectedResponse->setKind($kind); - $expectedResponse->setName($name); - $expectedResponse->setOperationGroupId($operationGroupId); - $expectedResponse->setOperationType($operationType); - $expectedResponse->setProgress($progress); - $expectedResponse->setRegion($region); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setStartTime($startTime); - $expectedResponse->setStatusMessage($statusMessage); - $expectedResponse->setTargetId($targetId); - $expectedResponse->setTargetLink($targetLink); - $expectedResponse->setUser($user); - $expectedResponse->setZone($zone2); - $transport->addResponse($expectedResponse); - // Mock request - $operation = 'operation1662702951'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->get($operation, $project, $zone); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.ZoneOperations/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getOperation(); - $this->assertProtobufEquals($operation, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $operation = 'operation1662702951'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - try { - $gapicClient->get($operation, $project, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new Operation(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new OperationList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->list($project, $zone); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.ZoneOperations/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $zone = 'zone3744684'; - try { - $gapicClient->list($project, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function waitTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $clientOperationId = 'clientOperationId-239630617'; - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $endTime = 'endTime1725551537'; - $httpErrorMessage = 'httpErrorMessage1276263769'; - $httpErrorStatusCode = 1386087020; - $id = 3355; - $insertTime = 'insertTime-103148397'; - $kind = 'kind3292052'; - $name = 'name3373707'; - $operationGroupId = 'operationGroupId40171187'; - $operationType = 'operationType-1432962286'; - $progress = 1001078227; - $region = 'region-934795532'; - $selfLink = 'selfLink-1691268851'; - $startTime = 'startTime-1573145462'; - $statusMessage = 'statusMessage-239442758'; - $targetId = 815576439; - $targetLink = 'targetLink-2084812312'; - $user = 'user3599307'; - $zone2 = 'zone2-696322977'; - $expectedResponse = new Operation(); - $expectedResponse->setClientOperationId($clientOperationId); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setEndTime($endTime); - $expectedResponse->setHttpErrorMessage($httpErrorMessage); - $expectedResponse->setHttpErrorStatusCode($httpErrorStatusCode); - $expectedResponse->setId($id); - $expectedResponse->setInsertTime($insertTime); - $expectedResponse->setKind($kind); - $expectedResponse->setName($name); - $expectedResponse->setOperationGroupId($operationGroupId); - $expectedResponse->setOperationType($operationType); - $expectedResponse->setProgress($progress); - $expectedResponse->setRegion($region); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setStartTime($startTime); - $expectedResponse->setStatusMessage($statusMessage); - $expectedResponse->setTargetId($targetId); - $expectedResponse->setTargetLink($targetLink); - $expectedResponse->setUser($user); - $expectedResponse->setZone($zone2); - $transport->addResponse($expectedResponse); - // Mock request - $operation = 'operation1662702951'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->wait($operation, $project, $zone); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.ZoneOperations/Wait', $actualFuncCall); - $actualValue = $actualRequestObject->getOperation(); - $this->assertProtobufEquals($operation, $actualValue); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function waitExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $operation = 'operation1662702951'; - $project = 'project-309310695'; - $zone = 'zone3744684'; - try { - $gapicClient->wait($operation, $project, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->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/Compute/tests/Unit/V1/ZonesClientTest.php b/Compute/tests/Unit/V1/ZonesClientTest.php deleted file mode 100644 index 5a08afe93382..000000000000 --- a/Compute/tests/Unit/V1/ZonesClientTest.php +++ /dev/null @@ -1,216 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return ZonesClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new ZonesClient($options); - } - - /** @test */ - public function getTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $creationTimestamp = 'creationTimestamp567396278'; - $description = 'description-1724546052'; - $id = 3355; - $kind = 'kind3292052'; - $name = 'name3373707'; - $region = 'region-934795532'; - $selfLink = 'selfLink-1691268851'; - $status = 'status-892481550'; - $supportsPzs = true; - $expectedResponse = new Zone(); - $expectedResponse->setCreationTimestamp($creationTimestamp); - $expectedResponse->setDescription($description); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setName($name); - $expectedResponse->setRegion($region); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setStatus($status); - $expectedResponse->setSupportsPzs($supportsPzs); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $zone = 'zone3744684'; - $response = $gapicClient->get($project, $zone); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Zones/Get', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $actualValue = $actualRequestObject->getZone(); - $this->assertProtobufEquals($zone, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - $zone = 'zone3744684'; - try { - $gapicClient->get($project, $zone); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $id = 'id3355'; - $kind = 'kind3292052'; - $nextPageToken = ''; - $selfLink = 'selfLink-1691268851'; - $itemsElement = new Zone(); - $items = [ - $itemsElement, - ]; - $expectedResponse = new ZoneList(); - $expectedResponse->setId($id); - $expectedResponse->setKind($kind); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setSelfLink($selfLink); - $expectedResponse->setItems($items); - $transport->addResponse($expectedResponse); - // Mock request - $project = 'project-309310695'; - $response = $gapicClient->list($project); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getItems()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.compute.v1.Zones/List', $actualFuncCall); - $actualValue = $actualRequestObject->getProject(); - $this->assertProtobufEquals($project, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal error'; - $expectedExceptionMessage = json_encode([ - 'message' => 'internal error', - 'code' => Code::DATA_LOSS, - 'status' => 'DATA_LOSS', - 'details' => [], - ], JSON_PRETTY_PRINT); - $transport->addResponse(null, $status); - // Mock request - $project = 'project-309310695'; - try { - $gapicClient->list($project); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } -} From 598084fd87b886ccd0f2233cfe2ada1a3cfeb422 Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Fri, 12 Sep 2025 23:33:52 +0000 Subject: [PATCH 2/4] use gax dev-main (revert this later) --- Compute/composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Compute/composer.json b/Compute/composer.json index bce5b8a6e600..3c3581b50717 100644 --- a/Compute/composer.json +++ b/Compute/composer.json @@ -5,7 +5,7 @@ "minimum-stability": "stable", "require": { "php": "^8.1", - "google/gax": "^1.36.0" + "google/gax": "dev-main as 1.37.0" }, "require-dev": { "phpunit/phpunit": "^9.0", From aebc7a5af86670e5584c8150c15a62e914e0dc34 Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Sat, 13 Sep 2025 09:20:34 -0700 Subject: [PATCH 3/4] update root gax so that tests pass --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 85b2b7ef0a53..6132b51faaaa 100644 --- a/composer.json +++ b/composer.json @@ -63,7 +63,7 @@ "monolog/monolog": "^2.9||^3.0", "psr/http-message": "^1.0|^2.0", "ramsey/uuid": "^4.0", - "google/gax": "^1.36.0", + "google/gax": "dev-main as 1.37.0", "google/auth": "^1.42" }, "require-dev": { From d2ee09f51003d0a33f3e8772f8ee0540997d65c0 Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Sat, 13 Sep 2025 09:25:17 -0700 Subject: [PATCH 4/4] update to latest GAX --- Compute/composer.json | 2 +- composer.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Compute/composer.json b/Compute/composer.json index 3c3581b50717..28b7d592cd13 100644 --- a/Compute/composer.json +++ b/Compute/composer.json @@ -5,7 +5,7 @@ "minimum-stability": "stable", "require": { "php": "^8.1", - "google/gax": "dev-main as 1.37.0" + "google/gax": "^1.37.0" }, "require-dev": { "phpunit/phpunit": "^9.0", diff --git a/composer.json b/composer.json index 6132b51faaaa..c463859b2a43 100644 --- a/composer.json +++ b/composer.json @@ -63,7 +63,7 @@ "monolog/monolog": "^2.9||^3.0", "psr/http-message": "^1.0|^2.0", "ramsey/uuid": "^4.0", - "google/gax": "dev-main as 1.37.0", + "google/gax": "^1.37.0", "google/auth": "^1.42" }, "require-dev": {